#include <BitPool.h>
|
| | BitPool (uint32_t nBits) |
| | Heap-owning constructor.
|
| |
| | BitPool (uint32_t *words, uint32_t nBits) |
| | Non-owning constructor.
|
| |
| | ~BitPool () |
| |
| | BitPool (const BitPool &)=delete |
| |
| BitPool & | operator= (const BitPool &)=delete |
| |
| bool | valid () const |
| | True if the pool has a valid (non-null) word array.
|
| |
| bool | get (uint32_t n) const |
| | Read bit n.
|
| |
| void | set (uint32_t n, bool v) |
| | Write bit n.
|
| |
| void | clear () |
| | Zero all words in the pool.
|
| |
|
| static uint16_t | wordsFor (uint32_t nBits) |
| | Words required to hold nBits bits.
|
| |
◆ BitPool() [1/3]
| BitPool::BitPool |
( |
uint32_t |
nBits | ) |
|
|
explicit |
Heap-owning constructor.
Allocates wordsFor(nBits) uint32_t words and zeros them. The destructor frees the allocation.
- Parameters
-
| [in] | nBits | Total number of bits to store. |
◆ BitPool() [2/3]
| BitPool::BitPool |
( |
uint32_t * |
words, |
|
|
uint32_t |
nBits |
|
) |
| |
Non-owning constructor.
Uses a caller-supplied word array; the destructor does not free it. The array must contain at least wordsFor(nBits) elements and must outlive this object.
- Parameters
-
| [in] | words | Pointer to the caller-owned word array. |
| [in] | nBits | Total number of bits the pool represents. |
◆ ~BitPool()
◆ BitPool() [3/3]
| BitPool::BitPool |
( |
const BitPool & |
| ) |
|
|
delete |
◆ clear()
Zero all words in the pool.
◆ get()
| bool BitPool::get |
( |
uint32_t |
n | ) |
const |
|
inline |
Read bit n.
No bounds check — caller must ensure n < nBits.
- Returns
- true if bit n is set, false otherwise.
◆ operator=()
◆ set()
| void BitPool::set |
( |
uint32_t |
n, |
|
|
bool |
v |
|
) |
| |
|
inline |
Write bit n.
No bounds check — caller must ensure n < nBits.
- Parameters
-
| [in] | n | Bit index. |
| [in] | v | Value to write. |
◆ valid()
| bool BitPool::valid |
( |
| ) |
const |
|
inline |
True if the pool has a valid (non-null) word array.
◆ wordsFor()
| static uint16_t BitPool::wordsFor |
( |
uint32_t |
nBits | ) |
|
|
inlinestatic |
Words required to hold nBits bits.
- Returns
- 0 for nBits == 0, otherwise ceil(nBits / 32).
The documentation for this class was generated from the following files: