semf
semf::BitsetUtility Class Reference

Useful helper functions for handeling bitsets. More...

#include <bitsetutility.h>

Collaboration diagram for semf::BitsetUtility:
Collaboration graph

Static Public Member Functions

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...
 

Detailed Description

Useful helper functions for handeling bitsets.

Note
They are used in ecc classes.

Definition at line 22 of file bitsetutility.h.

Member Function Documentation

◆ 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
Numberof bits in the bit set.
Parameters
dataThe array with the data.
dataSizeThe size of the data.
firstBitThe 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
NNumber of bits in the bit set.
Parameters
bitsetThe bitset which should be inserted into the array.
bufferThe array in which the bitset is stored.
bufferSizeThe size of the buffer.
firstBitThe 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
Numberof bits in the bit set.
Parameters
bitsThe bits for which parity is to be calculated.
Returns
true if ther parity is odd.

Definition at line 59 of file bitsetutility.h.