NumCpp  2.12.1
A Templatized Header Only C++ Implementation of the Python NumPy Library
nc::edac Namespace Reference

Namespaces

namespace  detail
 

Functions

template<std::size_t DataBits, std::size_t EncodedBits, std::enable_if_t< greaterThan_v< EncodedBits, DataBits >, int > = 0>
int decode (std::bitset< EncodedBits > encodedBits, std::bitset< DataBits > &decodedBits)
 
template<std::size_t DataBits>
boost::dynamic_bitset encode (const std::bitset< DataBits > &dataBits)
 

Function Documentation

◆ decode()

template<std::size_t DataBits, std::size_t EncodedBits, std::enable_if_t< greaterThan_v< EncodedBits, DataBits >, int > = 0>
int nc::edac::decode ( std::bitset< EncodedBits >  encodedBits,
std::bitset< DataBits > &  decodedBits 
)

Returns the Hamming SECDED decoded bits for the enocoded bits https://en.wikipedia.org/wiki/Hamming_code

Parameters
encodedBitsthe encoded bits to decode
decodedBitsthe output decoded bits
Returns
int status (0=no errors, 1=1 corrected error, 2=2 errors detected)
Exceptions
std::runtime_errorif DataBits and EncodedBits are not consistent
std::runtime_errorif the number of data bits does not represent a valid Hamming SECDED code

◆ encode()

template<std::size_t DataBits>
boost::dynamic_bitset nc::edac::encode ( const std::bitset< DataBits > &  dataBits)

Returns the Hamming SECDED encoded bits for the data bits

Parameters
dataBitsthe data bits to encode
Returns
encoded data bits
Exceptions
std::runtime_errorif the number of data bits does not represent a valid Hamming SECDED code