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

◆ operator~()

bitset_dynamic fl::bitset_dynamic::operator~ ( ) const
inline

Definition at line 427 of file bitset_dynamic.h.

427 {
428 bitset_dynamic result(_size);
429
430 if (!_blocks || !result._blocks) {
431 return result;
432 }
433
434 for (fl::u32 i = 0; i < _block_count; ++i) {
435 result._blocks[i] = ~_blocks[i];
436 }
437
438 // Clear any bits beyond size
439 if (_block_count > 0 && _size % bits_per_block != 0) {
440 fl::u32 last_block_idx = (_size - 1) / bits_per_block;
441 fl::u32 last_bit_pos = (_size - 1) % bits_per_block;
442 block_type mask =
443 static_cast<block_type>((static_cast<block_type>(1) << (last_bit_pos + 1)) - 1);
444 result._blocks[last_block_idx] &= mask;
445 }
446
447 return result;
448 }
block_type * _blocks
bitset_dynamic()=default
static constexpr fl::u32 bits_per_block

References bitset_dynamic(), _block_count, _blocks, _size, and bits_per_block.

+ Here is the call graph for this function: