codec.crc ≡
template < auto Width, uint<Width> P, uint<Width> Init, uint<Width> XorOut, bool ReflectInput, bool ReflectOutput, auto MaxBytes, auto ThreadCount > class crc_calculator §source
Cyclic Redundancy Check (CRC) computation
Example CRC-32 with 64-bytes/cycle input width and 4 simultaneous input streams:
crc_calculator<32, 0xEDB88320, 0xFFFFFFFF, 0xFFFFFFFF, true, true, 64, 4> crc_calc;
Parameters
-
auto WidthWidth (in bits) of the computed CRC.
-
uint<Width> PThe reversed polynomial.
-
uint<Width> InitThe initial value of CRC.
-
uint<Width> XorOutThe value to XOR with the final result.
-
bool ReflectInputWhether to reverse the bits of each input byte.
-
bool ReflectOutputWhether to reverse the bits of the CRC output result.
-
auto MaxBytesThe maximum number of bytes that can be processed per call.
-
auto ThreadCountNumber of CRC values that can be computed concurrently.
Methods
-
inline uint<Width> compute( count_t<ThreadCount> identifier, uint8[MaxBytes] input, count_t<MaxBytes> input_bytes, bool reset ) §source
Process up to
MaxBytesof new input data.Arguments
-
count_t<ThreadCount> identifier
Which of the
ThreadCountCRCs to update. -
uint8[MaxBytes] input
Input data.
-
count_t<MaxBytes> input_bytes
Number of valid bytes in the input data.
-
bool reset
Indicates if CRC value should be reset before processing
input. Should be set totrueon the first call associated with a particular input stream.
-