PIP 5.6.1
Platform-Independent Primitives
Public Member Functions | List of all members
PICRC< L, N > Class Template Reference

Generic table-driven CRC calculator for a polynomial width L. More...

#include <picrc.h>

Public Member Functions

 PICRC (const N &poly=N())
 Constructs a calculator with the specified polynomial and default CRC conventions.
 
 PICRC (const N &poly, bool reverse_poly_, const N &initial, const N &out_xor)
 Constructs a calculator with fully specified initialization parameters.
 
void setInitial (const N &v)
 Sets the initial CRC value.
 
void setOutXor (const N &v)
 Sets the final XOR value.
 
void setReversePolynome (bool yes)
 Enables or disables polynomial bit reversal and rebuilds the lookup table.
 
void setReverseOutBeforeXOR (bool yes)
 Reverses the resulting CRC before applying the output XOR.
 
void setReverseDataBytes (bool yes)
 Reverses bits in each input byte before processing.
 
void initTable ()
 Rebuilds the 256-entry lookup table for the current polynomial settings.
 
calculate (const void *data, int size)
 Calculates CRC for a raw memory block.
 
calculate (const PIByteArray &d)
 Calculates CRC for a byte array.
 
calculate (const char *str)
 Calculates CRC for a null-terminated string.
 

Detailed Description

template<uint L, typename N = uint_cl<L>>
class PICRC< L, N >

Generic table-driven CRC calculator for a polynomial width L.