Added clang-tidy config and cleaned up the code a little.

This commit is contained in:
2024-08-18 13:30:40 +02:00
parent 9f011952c2
commit 6d111904d4
7 changed files with 142 additions and 65 deletions

View File

@@ -6,7 +6,6 @@
#include <array>
#include <atomic>
#include <cassert>
#include <cstddef>
namespace mijin
@@ -32,8 +31,9 @@ private:
using byte_type = std::conditional_t<threadSafe, std::atomic_uint8_t, std::uint8_t>;
std::array<byte_type, (numBits + 7) / 8> bytes;
public:
[[nodiscard]] bool get(std::size_t index) const {
assert(index < numBits);
[[nodiscard]] bool get(std::size_t index) const
{
MIJIN_ASSERT(index < numBits, "BitArray: index out of range.");
return (bytes[index / 8] & (1 << (index % 8)));
}
void set(std::size_t index, bool value)