jaulib v1.3.6
Jau Support Library (C++, Java, ..)
Loading...
Searching...
No Matches
jau::bitfield< BitSize > Class Template Reference

Simple bitfield template for efficient bit storage access in O(1). More...

#include <bitfield.hpp>

Collaboration diagram for jau::bitfield< BitSize >:

Public Member Functions

constexpr bitfield () noexcept
 
size_t bitCount () const noexcept
 
constexpr void clear () noexcept
 
constexpr void clr (size_t bitnum) noexcept
 
bool copy (size_t srcBitnum, size_t dstBitnum) noexcept
 
uint32_t copyu32 (size_t srcBitnum, size_t dstBitnum, size_t length) noexcept
 
constexpr bool get (size_t bitnum) const noexcept
 
uint32_t getu32 (size_t lowBitnum, size_t length) const noexcept
 
constexpr void put (size_t bitnum, bool v) noexcept
 
void putu32 (size_t lowBitnum, size_t length, uint32_t data) noexcept
 
constexpr void set (size_t bitnum) noexcept
 

Static Public Member Functions

static constexpr bool in_range (size_t bitnum)
 

Static Public Attributes

static constexpr size_t bit_size = BitSize
 
static constexpr size_t unit_bit_size = 32
 
static constexpr size_t unit_shift = 5
 

Detailed Description

template<size_t BitSize>
class jau::bitfield< BitSize >

Simple bitfield template for efficient bit storage access in O(1).

Implementations utilizes an in-memory std::array<uint32_t, (BitSize+31)/5>.

Definition at line 41 of file bitfield.hpp.

Constructor & Destructor Documentation

◆ bitfield()

template<size_t BitSize>
jau::bitfield< BitSize >::bitfield ( )
inlineconstexprnoexcept

Definition at line 68 of file bitfield.hpp.

Member Function Documentation

◆ in_range()

template<size_t BitSize>
static constexpr bool jau::bitfield< BitSize >::in_range ( size_t bitnum)
inlinestaticconstexpr

Definition at line 66 of file bitfield.hpp.

◆ clear()

template<size_t BitSize>
void jau::bitfield< BitSize >::clear ( )
inlineconstexprnoexcept

Definition at line 71 of file bitfield.hpp.

Here is the caller graph for this function:

◆ get()

template<size_t BitSize>
bool jau::bitfield< BitSize >::get ( size_t bitnum) const
inlineconstexprnoexcept

Definition at line 78 of file bitfield.hpp.

Here is the caller graph for this function:

◆ put()

template<size_t BitSize>
void jau::bitfield< BitSize >::put ( size_t bitnum,
bool v )
inlineconstexprnoexcept

Definition at line 87 of file bitfield.hpp.

Here is the caller graph for this function:

◆ set()

template<size_t BitSize>
void jau::bitfield< BitSize >::set ( size_t bitnum)
inlineconstexprnoexcept

Definition at line 101 of file bitfield.hpp.

◆ clr()

template<size_t BitSize>
void jau::bitfield< BitSize >::clr ( size_t bitnum)
inlineconstexprnoexcept

Definition at line 103 of file bitfield.hpp.

◆ copy()

template<size_t BitSize>
bool jau::bitfield< BitSize >::copy ( size_t srcBitnum,
size_t dstBitnum )
inlinenoexcept

Definition at line 106 of file bitfield.hpp.

◆ getu32()

template<size_t BitSize>
uint32_t jau::bitfield< BitSize >::getu32 ( size_t lowBitnum,
size_t length ) const
inlinenoexcept

Definition at line 113 of file bitfield.hpp.

Here is the caller graph for this function:

◆ putu32()

template<size_t BitSize>
void jau::bitfield< BitSize >::putu32 ( size_t lowBitnum,
size_t length,
uint32_t data )
inlinenoexcept

Definition at line 139 of file bitfield.hpp.

Here is the caller graph for this function:

◆ copyu32()

template<size_t BitSize>
uint32_t jau::bitfield< BitSize >::copyu32 ( size_t srcBitnum,
size_t dstBitnum,
size_t length )
inlinenoexcept

Definition at line 166 of file bitfield.hpp.

◆ bitCount()

template<size_t BitSize>
size_t jau::bitfield< BitSize >::bitCount ( ) const
inlinenoexcept

Definition at line 173 of file bitfield.hpp.

Member Data Documentation

◆ unit_shift

template<size_t BitSize>
size_t jau::bitfield< BitSize >::unit_shift = 5
staticconstexpr

Definition at line 43 of file bitfield.hpp.

◆ unit_bit_size

template<size_t BitSize>
size_t jau::bitfield< BitSize >::unit_bit_size = 32
staticconstexpr

Definition at line 44 of file bitfield.hpp.

◆ bit_size

template<size_t BitSize>
size_t jau::bitfield< BitSize >::bit_size = BitSize
staticconstexpr

Definition at line 45 of file bitfield.hpp.


The documentation for this class was generated from the following file: