template<size_t N, typename storage_type = uint8_t>
aes70::bitset struct

Simple fixed length bitset implementation. This is functionally equivalent to std::bitset, however it does not throw exceptions.

Public static variables

static const size_t storage_size
static const size_t storage_bits
static const size_t count
static const size_t size

Constructors, destructors, conversion operators

bitset() constexpr

Public functions

void set(size_t n, bool value = true)
void set()
auto get(size_t n) const -> storage_type
auto test(size_t n) const -> bool
void clear(size_t n)
void clear()
void reset(size_t n)
auto find_first(size_t n = 0, bool value = true) const -> size_t
auto find_first_zero(size_t n = 0) const -> size_t

Function documentation

template<size_tN, typenamestorage_type>
aes70::bitset<N, storage_type>::bitset() constexpr

Create a bitset with uninitialized storage.

template<size_tN, typenamestorage_type>
void aes70::bitset<N, storage_type>::set(size_t n, bool value = true)

Set the given bit to 1 or given value.

template<size_tN, typenamestorage_type>
void aes70::bitset<N, storage_type>::set()

Set all bits to 1.

template<size_tN, typenamestorage_type>
storage_type aes70::bitset<N, storage_type>::get(size_t n) const

Get the storage element which contains the given bit with all other bits masked set to zero.

This method returns 0 if and only if the given bit is 0.

template<size_tN, typenamestorage_type>
bool aes70::bitset<N, storage_type>::test(size_t n) const

Test a single bit.

template<size_tN, typenamestorage_type>
void aes70::bitset<N, storage_type>::clear(size_t n)

Clear the given bit, i.e. set it to 0.

template<size_tN, typenamestorage_type>
void aes70::bitset<N, storage_type>::clear()

Clear all bits.

template<size_tN, typenamestorage_type>
void aes70::bitset<N, storage_type>::reset(size_t n)

Set a bit to 0.

template<size_tN, typenamestorage_type>
size_t aes70::bitset<N, storage_type>::find_first(size_t n = 0, bool value = true) const

Find the index of the first bit with given value starting from position n, inclusive. If not bit such bit has been found the method will return the number of bits in this bitset.

template<size_tN, typenamestorage_type>
size_t aes70::bitset<N, storage_type>::find_first_zero(size_t n = 0) const

Find the first zero bit in thie bitset starting from position n.

Variable documentation

template<size_tN, typenamestorage_type>
static const size_t aes70::bitset<N, storage_type>::storage_size

Size of the storage_type.

template<size_tN, typenamestorage_type>
static const size_t aes70::bitset<N, storage_type>::storage_bits

Bits per storage_type.

template<size_tN, typenamestorage_type>
static const size_t aes70::bitset<N, storage_type>::count

Number of elements of type storage_type in the underlying array.

template<size_tN, typenamestorage_type>
static const size_t aes70::bitset<N, storage_type>::size

Number of bits in this bitset.