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 500 of file bitset.h.

501 {
503
504 if (result._storage.template is<fixed_bitset>() &&
505 rhs._storage.template is<fixed_bitset>()) {
506 // Both are fixed, use the fixed implementation
507 *result._storage.template ptr<fixed_bitset>() ^=
508 *rhs._storage.template ptr<fixed_bitset>();
509 } else {
510 // At least one is dynamic, handle bit by bit
512 result.size() > rhs.size() ? result.size() : rhs.size();
513
514 // Resize if needed
515 if (result.size() < max_size) {
517 }
518
519 // XOR bits from rhs
520 for (uint32_t i = 0; i < rhs.size(); ++i) {
521 result.set(i, result.test(i) != rhs.test(i));
522 }
523 }
524
525 return result;
526 }
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