34 if (other.
_size > 0) {
44 other._blocks =
nullptr;
45 other._block_count = 0;
52 if (other.
_size > 0) {
70 other._blocks =
nullptr;
71 other._block_count = 0;
95 if (new_size ==
_size)
103 if (new_block_count > 0) {
104 new_blocks =
new block_type[new_block_count]();
128 (
static_cast<block_type>(1) << (last_bit_pos + 1)) - 1;
131 _blocks[last_block_idx] &= mask;
134 for (uint32_t i = last_block_idx + 1; i <
_block_count; ++i) {
175 void set(uint32_t
pos,
bool value)
noexcept {
203 (
static_cast<block_type>(1) << (last_bit_pos + 1)) - 1;
204 _blocks[last_block_idx] &= mask;
213 return (
_blocks[idx] >> off) & 1;
233 bool any() const noexcept {
245 bool all() const noexcept {
258 (
static_cast<block_type>(1) << (last_bit_pos + 1)) - 1;
276 for (uint32_t i = 0; i < min_blocks; ++i) {
288 for (uint32_t i = 0; i < min_blocks; ++i) {
306 for (uint32_t i = 0; i < min_blocks; ++i) {
332 (
static_cast<block_type>(1) << (last_bit_pos + 1)) - 1;
333 result.
_blocks[last_block_idx] &= mask;
bool all() const noexcept
bitset_dynamic & operator=(const bitset_dynamic &other)
uint32_t size() const noexcept
void set(uint32_t pos, bool value) noexcept
bool none() const noexcept
bool test(uint32_t pos) const noexcept
bitset_dynamic operator&(const bitset_dynamic &other) const
bool operator[](uint32_t pos) const noexcept
static uint32_t calc_block_count(uint32_t bit_count)
bitset_dynamic operator|(const bitset_dynamic &other) const
void resize(uint32_t new_size)
void reset(uint32_t pos) noexcept
bitset_dynamic(const bitset_dynamic &other)
void flip(uint32_t pos) noexcept
void assign(size_t n, bool val)
void set(uint32_t pos) noexcept
bitset_dynamic operator~() const
static constexpr uint32_t bits_per_block
bool any() const noexcept
bitset_dynamic(uint32_t size)
bitset_dynamic operator^(const bitset_dynamic &other) const
bitset_dynamic(bitset_dynamic &&other) noexcept
uint32_t count() const noexcept
bitset_dynamic & operator=(bitset_dynamic &&other) noexcept
Implements a simple red square effect for 2D LED grids.