FastLED 3.9.15
Loading...
Searching...
No Matches

◆ flip() [1/2]

FL_DISABLE_WARNING_POP void fl::bitset_dynamic::flip ( )
inlinenoexcept

Definition at line 217 of file bitset_dynamic.h.

217 {
218 if (!_blocks) return;
219
220 for (fl::u32 i = 0; i < _block_count; ++i) {
221 _blocks[i] = ~_blocks[i];
222 }
223
224 // Clear any bits beyond size
225 if (_block_count > 0 && _size % bits_per_block != 0) {
226 fl::u32 last_block_idx = (_size - 1) / bits_per_block;
227 fl::u32 last_bit_pos = (_size - 1) % bits_per_block;
228 block_type mask =
229 static_cast<block_type>((static_cast<block_type>(1) << (last_bit_pos + 1)) - 1);
230 _blocks[last_block_idx] &= mask;
231 }
232 }
block_type * _blocks
static constexpr fl::u32 bits_per_block

References _block_count, _blocks, _size, and bits_per_block.