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

◆ all()

bool fl::bitset_dynamic::all ( ) const
inline

Definition at line 280 of file bitset_dynamic.h.

280 {
281 if (_size == 0)
282 return true;
283
284 if (!_blocks) return false;
285
286 for (fl::u32 i = 0; i < _block_count - 1; ++i) {
287 if (_blocks[i] != static_cast<block_type>(~block_type(0)))
288 return false;
289 }
290
291 // Check last block with mask for valid bits
292 if (_block_count > 0) {
293 fl::u32 last_bit_pos = (_size - 1) % bits_per_block;
294 block_type mask =
295 static_cast<block_type>((static_cast<block_type>(1) << (last_bit_pos + 1)) - 1);
296 return (_blocks[_block_count - 1] & mask) == mask;
297 }
298
299 return true;
300 }
fl::unique_ptr< block_type[]> _blocks
static constexpr fl::u32 bits_per_block

References _block_count, _blocks, _size, bits_per_block, and FL_NOEXCEPT.