27#if defined(__GNUC__) || defined(__clang__)
28#define XPOINT_PACKED __attribute__((packed))
42 return (nBits == 0u) ? 0u : (uint16_t)((nBits + 31u) / 32u);
53 explicit BitPool(uint32_t nBits);
65 BitPool(uint32_t *words, uint32_t nBits);
75 return _words !=
nullptr;
85 bool get(uint32_t n)
const
87 return (_words[n >> 5] >> (n & 0x1Fu)) & 1u;
98 void set(uint32_t n,
bool v)
101 _words[n >> 5] |= (1u << (n & 0x1Fu));
103 _words[n >> 5] &= ~(1u << (n & 0x1Fu));
#define XPOINT_PACKED
Definition BitPool.h:30
BitPool(const BitPool &)=delete
void set(uint32_t n, bool v)
Write bit n.
Definition BitPool.h:98
BitPool & operator=(const BitPool &)=delete
bool valid() const
True if the pool has a valid (non-null) word array.
Definition BitPool.h:73
bool get(uint32_t n) const
Read bit n.
Definition BitPool.h:85
static uint16_t wordsFor(uint32_t nBits)
Words required to hold nBits bits.
Definition BitPool.h:40