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

◆ operator|

template<uint32_t N = 256>
BitsetInlined operator| ( const BitsetInlined< N > & lhs,
const BitsetInlined< N > & rhs )
friend

Definition at line 470 of file bitset.h.

471 {
473
474 if (result._storage.template is<fixed_bitset>() &&
475 rhs._storage.template is<fixed_bitset>()) {
476 // Both are fixed, use the fixed implementation
477 *result._storage.template ptr<fixed_bitset>() |=
478 *rhs._storage.template ptr<fixed_bitset>();
479 } else {
480 // At least one is dynamic, handle bit by bit
482 result.size() > rhs.size() ? result.size() : rhs.size();
483
484 // Resize if needed
485 if (result.size() < max_size) {
487 }
488
489 // Set bits from rhs
490 for (uint32_t i = 0; i < rhs.size(); ++i) {
491 if (rhs.test(i)) {
492 result.set(i);
493 }
494 }
495 }
496
497 return result;
498 }
bool test(uint32_t pos) const noexcept
Tests whether the bit at position pos is set.
Definition bitset.h:383
BitsetInlined & set(uint32_t pos, bool value=true)
Sets or clears the bit at position pos.
Definition bitset.h:332
uint32_t size() const noexcept
Size of the Bitset (number of bits).
Definition bitset.h:430
void resize(uint32_t new_size)
Resizes the Bitset if needed.
Definition bitset.h:291
Variant< fixed_bitset, bitset_dynamic > _storage
Definition bitset.h:229
A Bitset implementation with inline storage that can grow if needed.
Definition bitset.h:225