#include <Bitset.hpp>
template<size_t S>
class Bitset< S >
Definition at line 21 of file Bitset.hpp.
◆ Bitset() [1/2]
Construct a new Bitset object and initalize the bitmap to zero.
Definition at line 28 of file Bitset.hpp.
◆ Bitset() [2/2]
Construct a new Bitset object and initialize the bitmap with the desired value.
- Parameters
-
Definition at line 39 of file Bitset.hpp.
41 for (
size_t i = 0; i < S; i++)
◆ FindFirstBit()
template<size_t S>
size_t Bitset< S >::FindFirstBit |
( |
bool |
isSet | ) |
|
|
inline |
Finds and returns the position of the first clear bit.
- Parameters
-
isSet | If true, find the first bit that is set. |
- Returns
- size_t Position of the first bit with desired polarity. If all bits are polarized, SIZE_MAX is returned.
Definition at line 116 of file Bitset.hpp.
118 for (
size_t i = 0; i < S; i++) {
119 if (
Test(i) == isSet)
◆ FindFirstRange()
template<size_t S>
size_t Bitset< S >::FindFirstRange |
( |
size_t |
count, |
|
|
bool |
isSet |
|
) |
| |
|
inline |
Finds a range of count
clear bits and returns the starting position.
- Parameters
-
count | Number of clear bits desired |
isSet | If true, find the first range of count bits that are set. |
- Returns
- size_t Position of the first bit with desired range and polarity. If all bits are polarized, SIZE_MAX is returned.
Definition at line 133 of file Bitset.hpp.
135 size_t checkLow, checkHigh, check, idx, offset;
136 size_t mask = ((size_t)1 << count) - (size_t)1;
137 for (
size_t i = 0UL; i < S - count; i++) {
140 checkLow =
map[idx] >> offset;
141 checkHigh = offset ?
map[idx + 1] << (
TypeSize() - offset) : 0;
142 check = checkLow | checkHigh;
144 if ((check & mask) == isSet)
◆ Flip()
template<size_t S>
void Bitset< S >::Flip |
( |
size_t |
pos | ) |
|
|
inline |
Flip the bit at the given position.
- Parameters
-
pos | Target bit to be flipped |
Definition at line 80 of file Bitset.hpp.
◆ Index()
template<size_t S>
size_t Bitset< S >::Index |
( |
size_t |
bit | ) |
|
|
inlineprivate |
◆ Offset()
template<size_t S>
size_t Bitset< S >::Offset |
( |
size_t |
bit | ) |
|
|
inlineprivate |
◆ operator[]()
template<size_t S>
bool Bitset< S >::operator[] |
( |
size_t |
pos | ) |
|
|
inline |
Return the value of the bit at the given position Same functionality as Test() as an operator This operator cannot be used to set a bit, only test.
- Parameters
-
- Returns
- bool Bit value
Definition at line 104 of file Bitset.hpp.
◆ Reset()
template<size_t S>
void Bitset< S >::Reset |
( |
size_t |
pos | ) |
|
|
inline |
Reset (clear) the bit at the given position.
- Parameters
-
pos | Target bit to be reset |
Definition at line 70 of file Bitset.hpp.
◆ Set()
template<size_t S>
void Bitset< S >::Set |
( |
size_t |
pos | ) |
|
|
inline |
Set the bit for a given position.
- Parameters
-
Definition at line 60 of file Bitset.hpp.
◆ Size()
Returns the size of the bitset in bytes.
- Returns
- size_t Size of the bitset in bytes
Definition at line 50 of file Bitset.hpp.
◆ Test()
template<size_t S>
bool Bitset< S >::Test |
( |
size_t |
pos | ) |
|
|
inline |
Return the value of the bit at the given position.
- Parameters
-
- Returns
- bool Bit value
Definition at line 91 of file Bitset.hpp.
◆ TypeSize()
template<size_t S>
size_t Bitset< S >::TypeSize |
( |
| ) |
|
|
inlineprivate |
Definition at line 152 of file Bitset.hpp.
154 return sizeof(size_t) * CHAR_BIT;
◆ map
The documentation for this class was generated from the following file: