A bounds-safe one-dimensional vector-like structure of efficiently packed bits.
More...
|
| Bitfield () |
| Default constructor which initializes to size 0.
|
|
| Bitfield (size_t b_size) |
| Constructor which sets the initial size to b_size bits. More...
|
|
void | Delete () |
| Deletes the stored data, resets the size to 0, and releases the memory.
|
|
bool | IsEmpty () const |
| True if the size is 0.
|
|
BitfieldBool | operator[] (size_t x) |
| Bounds-checked access of the element at index x. More...
|
|
BitfieldBool | operator() (size_t x) |
| Identical to operator[].
|
|
BitfieldBoolConst | operator[] (size_t x) const |
| Const version of operator[].
|
|
BitfieldBoolConst | operator() (size_t x) const |
| Const version of operator[].
|
|
BitfieldBool | At (size_t x) |
| Const version of At()
|
|
BitfieldBoolConst | At (size_t x) const |
| Identical to operator[].
|
|
size_t | size () const |
| Return the current number of bits.
|
|
size_t | reserved () const |
| Return the number of bits for which space is reserved.
|
|
void | Zero () |
| Set all bits to zero.
|
|
void | ZeroRange (const size_t start, const size_t end) |
| Set all bits to zero between index start and end, inclusive.
|
|
Data1D< u32 > & | Raw () |
| Provides raw access to the Data1D<u32> in which the bits are packed. More...
|
|
void | Reserve (const size_t reserve_size) |
| Reserve storage without resizing the Bitfield. More...
|
|
void | Resize (const size_t resize_size) |
| Resize the array, reallocating if necessary. More...
|
|
void | Crop () |
| Reduce memory consumption to only that necessary for size() bits.
|
|
void | Clear () |
| Identical to Delete()
|
|
void | Append (const bool new_bit) |
| Add a bit to the end, expanding if necessary. More...
|
|
void | Append (const Bitfield &other) |
| Append bits from another Bitfield to this Bitfield. More...
|
|
void | ExpandSet (size_t pos, const bool new_bit) |
| Assign new_bit to index pos, expanding if necessary to reach that index.
|
|
Bitfield & | operator+= (const bool new_bit) |
| Appends new_bit, expanding as necessary. More...
|
|
Bitfield & | operator+= (const Bitfield &other) |
| Appends the bits from other, expanding as necessary. More...
|
|
bool | Check (const size_t x) const |
| True if index x is within the Bitfield.
|
|
void | Assert (const size_t x) const |
| Throws ErrorMsgBounds if index x is out of bounds for this Bitfield.
|
|
size_t | CountOnes () const |
| Efficiently determines the total number of true / 1 values in the Bitfield.
|
|
size_t | CountZeroes () const |
| Efficiently determines the total number of false / 0 values in the Bitfield.
|
|
A bounds-safe one-dimensional vector-like structure of efficiently packed bits.
It provides efficient resizing and append operations, and bounds-safe array access.
- See also
- Bitfield2D
-
Bitfield3D