pabigot  0.1.1
C++ support classes
Data Structures | Typedefs | Functions
pabigot::crc::details Namespace Reference

Internal support for pabigot::crc. More...

Data Structures

class  base_crc
 CRC core framework using Rocksoft^tm Model characteristics. More...
 
struct  uint_size_traits
 Entry-point to identifying unsigned integral types supporting a specific number of bits. More...
 
struct  uint_size_traits< 1 >
 
struct  uint_size_traits< 2 >
 
struct  uint_size_traits< 3 >
 
struct  uint_size_traits< 4 >
 
struct  uint_support
 Type and policy traits providing support for operations on B-bit values. More...
 
struct  uint_traits
 Extend the size-related traits with functionality operating on the specific types. More...
 

Typedefs

using uint8_traits = uint_traits< 4 >
 for uint8_t
 
using uint16_traits = uint_traits< 3 >
 for uint16_t
 
using uint32_traits = uint_traits< 2 >
 for uint32_t
 
using uint64_traits = uint_traits< 1 >
 for uint64_t
 

Functions

template<typename UI >
static constexpr UI reverse_low_bits (const UI &v, unsigned int bits)
 Reverse bits [0..bits) of v. More...
 
template<unsigned int B>
constexpr unsigned int uint_category ()
 Compute the #uint_size_traits category value for a required bit length. More...
 
template<typename CRC , size_t... n>
constexpr auto lookup_table (std::index_sequence< n... >)
 Use a template parameter pack to fill out a 256-element std::initializer_list for a std::array.
 
template<typename CRC >
constexpr auto lookup_table ()
 Return a std::array for the CRC byte-indexed table. More...
 

Detailed Description

Internal support for pabigot::crc.

Applications should not need to use any of these.

Function Documentation

◆ lookup_table()

template<typename CRC >
constexpr auto pabigot::crc::details::lookup_table ( )
constexpr

Return a std::array for the CRC byte-indexed table.

Template Parameters
Afully instantiated class. a std::array with 256 elements where element i is the result of invoking crc::lookup_for_byte on i.

◆ reverse_low_bits()

template<typename UI >
static constexpr UI pabigot::crc::details::reverse_low_bits ( const UI &  v,
unsigned int  bits 
)
staticconstexpr

Reverse bits [0..bits) of v.

Template Parameters
UIan unsigned integral type
Parameters
va value, the low bits bits of which contain data
bitsthe number of valid bits within a word of type UI
Returns
the result of reversing the low bits bits of v.
Note
Keep this outside of the traits classes since the same underlying fast_type may be shared for different sizes.

◆ uint_category()

template<unsigned int B>
constexpr unsigned int pabigot::crc::details::uint_category ( )
constexpr

Compute the #uint_size_traits category value for a required bit length.

Template Parameters
Bthe number of bits required in an unsigned integer.
Returns
the category value for B