Useful helper functions for handeling bitsets.
More...
#include <bitsetutility.h>
|
template<size_t N> |
static bool | parityIsOdd (std::bitset< N > bits) |
| Returns the parity of bits in a bitset. More...
|
|
template<size_t N> |
static std::bitset< N > | createBitset (const uint8_t data[], size_t dataSize, size_t firstBit) |
| Copies a part of an array into a bitset. More...
|
|
template<size_t N> |
static size_t | insertBitsetInBuffer (std::bitset< N > bitset, uint8_t buffer[], size_t bufferSize, size_t firstBit) |
| Insert a bitset in a array. More...
|
|
Useful helper functions for handeling bitsets.
- Note
- They are used in ecc classes.
Definition at line 22 of file bitsetutility.h.
◆ createBitset()
template<size_t N>
std::bitset< N > semf::BitsetUtility::createBitset |
( |
const uint8_t |
data[], |
|
|
size_t |
dataSize, |
|
|
size_t |
firstBit |
|
) |
| |
|
static |
Copies a part of an array into a bitset.
- Template Parameters
-
Number | of bits in the bit set. |
- Parameters
-
data | The array with the data. |
dataSize | The size of the data. |
firstBit | The first bit to be copied into the bitset. |
- Returns
- The bitset with the bits.
Definition at line 65 of file bitsetutility.h.
◆ insertBitsetInBuffer()
template<size_t N>
static size_t semf::BitsetUtility::insertBitsetInBuffer |
( |
std::bitset< N > |
bitset, |
|
|
uint8_t |
buffer[], |
|
|
size_t |
bufferSize, |
|
|
size_t |
firstBit |
|
) |
| |
|
static |
Insert a bitset in a array.
- Template Parameters
-
N | Number of bits in the bit set. |
- Parameters
-
bitset | The bitset which should be inserted into the array. |
buffer | The array in which the bitset is stored. |
bufferSize | The size of the buffer. |
firstBit | The position in which the bitset is stored in the array. |
- Returns
- The number of bits written into the array.
◆ parityIsOdd()
template<size_t N>
bool semf::BitsetUtility::parityIsOdd |
( |
std::bitset< N > |
bits | ) |
|
|
static |
Returns the parity of bits in a bitset.
- Template Parameters
-
Number | of bits in the bit set. |
- Parameters
-
bits | The bits for which parity is to be calculated. |
- Returns
- true if ther parity is odd.
Definition at line 59 of file bitsetutility.h.