FastLED 3.9.15
|
A simple fixed-size Bitset implementation similar to std::Bitset.
#include <bitset.h>
Classes | |
struct | Proxy |
Public Member Functions | |
constexpr | BitsetFixed () noexcept |
Constructs a BitsetFixed with all bits reset. | |
bool | all () const noexcept |
bool | any () const noexcept |
Queries. | |
void | assign (size_t n, bool value) |
uint32_t | count () const noexcept |
Returns the number of set bits. | |
BitsetFixed & | flip () noexcept |
Flips all bits. | |
BitsetFixed & | flip (uint32_t pos) |
Flips (toggles) the bit at position pos. | |
bool | none () const noexcept |
BitsetFixed & | operator&= (const BitsetFixed &other) noexcept |
Bitwise AND. | |
Proxy | operator[] (uint32_t pos) |
bool | operator[] (uint32_t pos) const noexcept |
Returns the value of the bit at position pos. | |
BitsetFixed & | operator^= (const BitsetFixed &other) noexcept |
Bitwise XOR. | |
BitsetFixed & | operator|= (const BitsetFixed &other) noexcept |
Bitwise OR. | |
void | reset () noexcept |
Resets all bits to zero. | |
BitsetFixed & | reset (uint32_t pos) |
Clears the bit at position pos. | |
BitsetFixed & | set (uint32_t pos, bool value=true) |
Sets or clears the bit at position pos. | |
constexpr uint32_t | size () const noexcept |
Size of the BitsetFixed (number of bits). | |
bool | test (uint32_t pos) const noexcept |
Tests whether the bit at position pos is set. | |
Private Types | |
using | block_type = uint64_t |
Private Attributes | |
block_type | _blocks [block_count] |
Static Private Attributes | |
static constexpr uint32_t | bits_per_block = 8 * sizeof(uint64_t) |
static constexpr uint32_t | block_count |
Friends | |
BitsetFixed | operator& (BitsetFixed lhs, const BitsetFixed &rhs) noexcept |
Friend operators for convenience. | |
BitsetFixed | operator^ (BitsetFixed lhs, const BitsetFixed &rhs) noexcept |
BitsetFixed | operator| (BitsetFixed lhs, const BitsetFixed &rhs) noexcept |
BitsetFixed | operator~ (BitsetFixed bs) noexcept |