73# ifdef CRCPP_USE_CPP11
75# define crcpp_uint8 ::std::uint8_t
78# define crcpp_uint8 uint8_t
83# ifdef CRCPP_USE_CPP11
85# define crcpp_uint16 ::std::uint16_t
88# define crcpp_uint16 uint16_t
93# ifdef CRCPP_USE_CPP11
95# define crcpp_uint32 ::std::uint32_t
98# define crcpp_uint32 uint32_t
103# ifdef CRCPP_USE_CPP11
105# define crcpp_uint64 ::std::uint64_t
108# define crcpp_uint64 uint64_t
113# ifdef CRCPP_USE_CPP11
115# define crcpp_size ::std::size_t
118# define crcpp_size size_t
122#ifdef CRCPP_USE_CPP11
124# define crcpp_constexpr constexpr
127# define crcpp_constexpr const
130#ifdef CRCPP_USE_NAMESPACE
146 template <
typename CRCType, crcpp_u
int16 CRCW
idth>
152 template <
typename CRCType, crcpp_u
int16 CRCW
idth>
168 template <
typename CRCType, crcpp_u
int16 CRCW
idth>
174#ifdef CRCPP_USE_CPP11
182 CRCType
operator[](
unsigned char index)
const;
193 template <
typename CRCType, crcpp_u
int16 CRCW
idth>
196 template <
typename CRCType, crcpp_u
int16 CRCW
idth>
199 template <
typename CRCType, crcpp_u
int16 CRCW
idth>
202 template <
typename CRCType, crcpp_u
int16 CRCW
idth>
205 template <
typename CRCType, crcpp_u
int16 CRCW
idth>
208 template <
typename CRCType, crcpp_u
int16 CRCW
idth>
211 template <
typename CRCType, crcpp_u
int16 CRCW
idth>
214 template <
typename CRCType, crcpp_u
int16 CRCW
idth>
219#ifdef CRCPP_INCLUDE_ESOTERIC_CRC_DEFINITIONS
231#ifdef CRCPP_INCLUDE_ESOTERIC_CRC_DEFINITIONS
251#ifdef CRCPP_INCLUDE_ESOTERIC_CRC_DEFINITIONS
260#ifdef CRCPP_INCLUDE_ESOTERIC_CRC_DEFINITIONS
268#ifdef CRCPP_INCLUDE_ESOTERIC_CRC_DEFINITIONS
281#ifdef CRCPP_INCLUDE_ESOTERIC_CRC_DEFINITIONS
286#ifdef CRCPP_INCLUDE_ESOTERIC_CRC_DEFINITIONS
292#ifdef CRCPP_USE_CPP11
301#ifndef CRCPP_USE_CPP11
307 template <
typename IntegerType>
310 template <
typename CRCType, crcpp_u
int16 CRCW
idth>
311 static CRCType
Finalize(CRCType remainder, CRCType finalXOR,
bool reflectOutput);
313 template <
typename CRCType, crcpp_u
int16 CRCW
idth>
314 static CRCType
UndoFinalize(CRCType remainder, CRCType finalXOR,
bool reflectOutput);
316 template <
typename CRCType, crcpp_u
int16 CRCW
idth>
319 template <
typename CRCType, crcpp_u
int16 CRCW
idth>
322 template <
typename CRCType, crcpp_u
int16 CRCW
idth>
334template <
typename CRCType, crcpp_u
int16 CRCW
idth>
347template <
typename CRCType, crcpp_u
int16 CRCW
idth>
354#ifdef CRCPP_USE_CPP11
361template <
typename CRCType, crcpp_u
int16 CRCW
idth>
375template <
typename CRCType, crcpp_u
int16 CRCW
idth>
387template <
typename CRCType, crcpp_u
int16 CRCW
idth>
400template <
typename CRCType, crcpp_u
int16 CRCW
idth>
411template <
typename CRCType, crcpp_u
int16 CRCW
idth>
415 static crcpp_constexpr CRCType BIT_MASK((CRCType(1) << (CRCWidth - CRCType(1))) |
416 ((CRCType(1) << (CRCWidth - CRCType(1))) - CRCType(1)));
419 static crcpp_constexpr CRCType SHIFT((CHAR_BIT >= CRCWidth) ?
static_cast<CRCType
>(CHAR_BIT - CRCWidth) : 0);
422 unsigned char byte = 0;
434 if (!
parameters.reflectInput && CRCWidth < CHAR_BIT)
438 crc =
static_cast<CRCType
>(crc << SHIFT);
455template <
typename CRCType, crcpp_u
int16 CRCW
idth>
475template <
typename CRCType, crcpp_u
int16 CRCW
idth>
496template <
typename CRCType, crcpp_u
int16 CRCW
idth>
519template <
typename CRCType, crcpp_u
int16 CRCW
idth>
542template <
typename CRCType, crcpp_u
int16 CRCW
idth>
549 crcpp_size wholeNumberOfBytes = size / CHAR_BIT;
550 if (wholeNumberOfBytes > 0)
555 crcpp_size remainingNumberOfBits = size % CHAR_BIT;
556 if (remainingNumberOfBits != 0)
558 unsigned char lastByte = *(
reinterpret_cast<const unsigned char *
>(data) + wholeNumberOfBytes);
577template <
typename CRCType, crcpp_u
int16 CRCW
idth>
584 crcpp_size wholeNumberOfBytes = size / CHAR_BIT;
585 if (wholeNumberOfBytes > 0)
590 crcpp_size remainingNumberOfBits = size % CHAR_BIT;
591 if (remainingNumberOfBits != 0)
593 unsigned char lastByte = *(
reinterpret_cast<const unsigned char *
>(data) + wholeNumberOfBytes);
611template <
typename CRCType, crcpp_u
int16 CRCW
idth>
620 crcpp_size wholeNumberOfBytes = size / CHAR_BIT;
621 if (wholeNumberOfBytes > 0)
626 crcpp_size remainingNumberOfBits = size % CHAR_BIT;
627 if (remainingNumberOfBits != 0)
629 unsigned char lastByte = *(
reinterpret_cast<const unsigned char *
>(data) + wholeNumberOfBytes);
649template <
typename CRCType, crcpp_u
int16 CRCW
idth>
658 crcpp_size wholeNumberOfBytes = size / CHAR_BIT;
659 if (wholeNumberOfBytes > 0)
664 crcpp_size remainingNumberOfBits = size % CHAR_BIT;
665 if (remainingNumberOfBits > 0)
667 unsigned char lastByte = *(
reinterpret_cast<const unsigned char *
>(data) + wholeNumberOfBytes);
683template <
typename IntegerType>
686 IntegerType reversedValue(0);
690 reversedValue =
static_cast<IntegerType
>((reversedValue << 1) | (value & 1));
691 value =
static_cast<IntegerType
>(value >> 1);
694 return reversedValue;
706template <
typename CRCType, crcpp_u
int16 CRCW
idth>
707inline CRCType
CRC::Finalize(CRCType remainder, CRCType finalXOR,
bool reflectOutput)
710 static crcpp_constexpr CRCType BIT_MASK = (CRCType(1) << (CRCWidth - CRCType(1))) |
711 ((CRCType(1) << (CRCWidth - CRCType(1))) - CRCType(1));
715 remainder =
Reflect(remainder, CRCWidth);
718 return (remainder ^ finalXOR) & BIT_MASK;
738template <
typename CRCType, crcpp_u
int16 CRCW
idth>
742 static crcpp_constexpr CRCType BIT_MASK = (CRCType(1) << (CRCWidth - CRCType(1))) |
743 ((CRCType(1) << (CRCWidth - CRCType(1))) - CRCType(1));
745 crc = (crc & BIT_MASK) ^ finalXOR;
765template <
typename CRCType, crcpp_u
int16 CRCW
idth>
768#ifdef CRCPP_USE_CPP11
771 static_assert(::std::numeric_limits<CRCType>::digits >= CRCWidth,
"CRCType is too small to contain a CRC of width CRCWidth.");
775 enum { static_assert_failed_CRCType_is_too_small_to_contain_a_CRC_of_width_CRCWidth = 1 / (::std::numeric_limits<CRCType>::digits >= CRCWidth ? 1 : 0) };
778 const unsigned char * current =
reinterpret_cast<const unsigned char *
>(data);
787 remainder =
static_cast<CRCType
>(remainder ^ *current++);
792#ifdef CRCPP_BRANCHLESS
798 remainder =
static_cast<CRCType
>((remainder >> 1) ^ ((remainder & 1) * polynomial));
800 remainder =
static_cast<CRCType
>((remainder & 1) ? ((remainder >> 1) ^ polynomial) : (remainder >> 1));
805 else if (CRCWidth >= CHAR_BIT)
807 static crcpp_constexpr CRCType CRC_WIDTH_MINUS_ONE(CRCWidth - CRCType(1));
808#ifndef CRCPP_BRANCHLESS
809 static crcpp_constexpr CRCType CRC_HIGHEST_BIT_MASK(CRCType(1) << CRC_WIDTH_MINUS_ONE);
812 static crcpp_constexpr CRCType SHIFT((CRCWidth >= CHAR_BIT) ?
static_cast<CRCType
>(CRCWidth - CHAR_BIT) : 0);
816 remainder =
static_cast<CRCType
>(remainder ^ (
static_cast<CRCType
>(*current++) << SHIFT));
821#ifdef CRCPP_BRANCHLESS
827 remainder =
static_cast<CRCType
>((remainder << 1) ^ (((remainder >> CRC_WIDTH_MINUS_ONE) & 1) * parameters.
polynomial));
829 remainder =
static_cast<CRCType
>((remainder & CRC_HIGHEST_BIT_MASK) ? ((remainder << 1) ^ parameters.
polynomial) : (remainder << 1));
837#ifndef CRCPP_BRANCHLESS
838 static crcpp_constexpr CRCType CHAR_BIT_HIGHEST_BIT_MASK(CRCType(1) << CHAR_BIT_MINUS_ONE);
841 static crcpp_constexpr CRCType SHIFT((CHAR_BIT >= CRCWidth) ?
static_cast<CRCType
>(CHAR_BIT - CRCWidth) : 0);
843 CRCType polynomial =
static_cast<CRCType
>(parameters.
polynomial << SHIFT);
844 remainder =
static_cast<CRCType
>(remainder << SHIFT);
848 remainder =
static_cast<CRCType
>(remainder ^ *current++);
853#ifdef CRCPP_BRANCHLESS
859 remainder =
static_cast<CRCType
>((remainder << 1) ^ (((remainder >> CHAR_BIT_MINUS_ONE) & 1) * polynomial));
861 remainder =
static_cast<CRCType
>((remainder & CHAR_BIT_HIGHEST_BIT_MASK) ? ((remainder << 1) ^ polynomial) : (remainder << 1));
866 remainder =
static_cast<CRCType
>(remainder >> SHIFT);
882template <
typename CRCType, crcpp_u
int16 CRCW
idth>
885 const unsigned char * current =
reinterpret_cast<const unsigned char *
>(data);
891#if defined(WIN32) || defined(_WIN32) || defined(WINCE)
895# pragma warning (push)
896# pragma warning (disable : 4333)
898 remainder =
static_cast<CRCType
>((remainder >> CHAR_BIT) ^ lookupTable[
static_cast<unsigned char>(remainder ^ *current++)]);
899#if defined(WIN32) || defined(_WIN32) || defined(WINCE)
900# pragma warning (pop)
904 else if (CRCWidth >= CHAR_BIT)
907 static crcpp_constexpr CRCType SHIFT((CRCWidth >= CHAR_BIT) ?
static_cast<CRCType
>(CRCWidth - CHAR_BIT) : 0);
911 remainder =
static_cast<CRCType
>((remainder << CHAR_BIT) ^ lookupTable[static_cast<unsigned char>((remainder >> SHIFT) ^ *current++)]);
917 static crcpp_constexpr CRCType SHIFT((CHAR_BIT >= CRCWidth) ?
static_cast<CRCType
>(CHAR_BIT - CRCWidth) : 0);
919 remainder =
static_cast<CRCType
>(remainder << SHIFT);
924 remainder = lookupTable[
static_cast<unsigned char>(remainder ^ *current++)];
927 remainder =
static_cast<CRCType
>(remainder >> SHIFT);
933template <
typename CRCType, crcpp_u
int16 CRCW
idth>
941 remainder =
static_cast<CRCType
>(remainder ^ byte);
946#ifdef CRCPP_BRANCHLESS
952 remainder =
static_cast<CRCType
>((remainder >> 1) ^ ((remainder & 1) * polynomial));
954 remainder =
static_cast<CRCType
>((remainder & 1) ? ((remainder >> 1) ^ polynomial) : (remainder >> 1));
958 else if (CRCWidth >= CHAR_BIT)
960 static crcpp_constexpr CRCType CRC_WIDTH_MINUS_ONE(CRCWidth - CRCType(1));
961#ifndef CRCPP_BRANCHLESS
962 static crcpp_constexpr CRCType CRC_HIGHEST_BIT_MASK(CRCType(1) << CRC_WIDTH_MINUS_ONE);
965 static crcpp_constexpr CRCType SHIFT((CRCWidth >= CHAR_BIT) ?
static_cast<CRCType
>(CRCWidth - CHAR_BIT) : 0);
967 remainder =
static_cast<CRCType
>(remainder ^ (
static_cast<CRCType
>(byte) << SHIFT));
972#ifdef CRCPP_BRANCHLESS
978 remainder =
static_cast<CRCType
>((remainder << 1) ^ (((remainder >> CRC_WIDTH_MINUS_ONE) & 1) * parameters.
polynomial));
980 remainder =
static_cast<CRCType
>((remainder & CRC_HIGHEST_BIT_MASK) ? ((remainder << 1) ^ parameters.
polynomial) : (remainder << 1));
987#ifndef CRCPP_BRANCHLESS
988 static crcpp_constexpr CRCType CHAR_BIT_HIGHEST_BIT_MASK(CRCType(1) << CHAR_BIT_MINUS_ONE);
991 static crcpp_constexpr CRCType SHIFT((CHAR_BIT >= CRCWidth) ?
static_cast<CRCType
>(CHAR_BIT - CRCWidth) : 0);
993 CRCType polynomial =
static_cast<CRCType
>(parameters.
polynomial << SHIFT);
994 remainder =
static_cast<CRCType
>((remainder << SHIFT) ^ byte);
999#ifdef CRCPP_BRANCHLESS
1005 remainder =
static_cast<CRCType
>((remainder << 1) ^ (((remainder >> CHAR_BIT_MINUS_ONE) & 1) * polynomial));
1007 remainder =
static_cast<CRCType
>((remainder & CHAR_BIT_HIGHEST_BIT_MASK) ? ((remainder << 1) ^ polynomial) : (remainder << 1));
1011 remainder =
static_cast<CRCType
>(remainder >> SHIFT);
1017#ifdef CRCPP_INCLUDE_ESOTERIC_CRC_DEFINITIONS
1200#ifdef CRCPP_INCLUDE_ESOTERIC_CRC_DEFINITIONS
1527#ifdef CRCPP_INCLUDE_ESOTERIC_CRC_DEFINITIONS
1655#ifdef CRCPP_INCLUDE_ESOTERIC_CRC_DEFINITIONS
1766#ifdef CRCPP_INCLUDE_ESOTERIC_CRC_DEFINITIONS
1969#ifdef CRCPP_INCLUDE_ESOTERIC_CRC_DEFINITIONS
2025#ifdef CRCPP_INCLUDE_ESOTERIC_CRC_DEFINITIONS
2081#ifdef CRCPP_USE_NAMESPACE
#define crcpp_constexpr
Compile-time expression definition.
Definition CRC.h:124
#define crcpp_uint16
Unsigned 16-bit integer definition, used primarily for parameter definitions.
Definition CRC.h:85
#define crcpp_size
Unsigned size definition, used for specifying data sizes.
Definition CRC.h:115
static CRCType CalculateBits(const void *data, crcpp_size size, const Parameters< CRCType, CRCWidth > ¶meters)
Computes a CRC.
Definition CRC.h:543
CRC(const CRC &other)=delete
static const Parameters< crcpp_uint16, 12 > & CRC_12_DECT()
Returns a set of parameters for CRC-12 DECT (aka CRC-12 X-CRC).
Definition CRC.h:1376
static const Parameters< crcpp_uint32, 24 > & CRC_24_NRC()
Returns a set of parameters for CRC-24 NR-C.
Definition CRC.h:1908
static const Parameters< crcpp_uint32, 24 > & CRC_24_FLEXRAYB()
Returns a set of parameters for CRC-24 FlexRay-B.
Definition CRC.h:1851
static const Parameters< crcpp_uint32, 24 > & CRC_24_LTEB()
Returns a set of parameters for CRC-24 LTE-B/NR-B.
Definition CRC.h:1889
static const Parameters< crcpp_uint16, 10 > & CRC_10()
Returns a set of parameters for CRC-10 ITU.
Definition CRC.h:1285
static const Parameters< crcpp_uint8, 6 > & CRC_6_ITU()
Returns a set of parameters for CRC-6 ITU.
Definition CRC.h:1138
static const Parameters< crcpp_uint8, 7 > & CRC_7()
Returns a set of parameters for CRC-7 JEDEC.
Definition CRC.h:1175
static const Parameters< crcpp_uint8, 4 > & CRC_4_ITU()
Returns a set of parameters for CRC-4 ITU.
Definition CRC.h:1030
CRC & operator=(const CRC &other)=delete
static const Parameters< crcpp_uint8, 5 > & CRC_5_EPC()
Returns a set of parameters for CRC-5 EPC.
Definition CRC.h:1048
static const Parameters< crcpp_uint16, 16 > & CRC_16_XMODEM()
Returns a set of parameters for CRC-16 XMODEM (aka CRC-16 ZMODEM, CRC-16 ACORN, CRC-16 LTE).
Definition CRC.h:1760
static CRCType CalculateRemainderBits(unsigned char byte, crcpp_size numBits, const Parameters< CRCType, CRCWidth > ¶meters, CRCType remainder)
Definition CRC.h:934
static const Parameters< crcpp_uint32, 30 > & CRC_30()
Returns a set of parameters for CRC-30 CDMA.
Definition CRC.h:1926
static const Parameters< crcpp_uint16, 16 > & CRC_16_DECTR()
Returns a set of parameters for CRC-16 DECT-R (aka CRC-16 R-CRC).
Definition CRC.h:1576
static const Parameters< crcpp_uint32, 17 > & CRC_17_CAN()
Returns a set of parameters for CRC-17 CAN.
Definition CRC.h:1779
static const Parameters< crcpp_uint8, 8 > & CRC_8()
Returns a set of parameters for CRC-8 SMBus.
Definition CRC.h:1194
static const Parameters< crcpp_uint32, 24 > & CRC_24()
Returns a set of parameters for CRC-24 OPENPGP.
Definition CRC.h:1815
static const Parameters< crcpp_uint16, 15 > & CRC_15_MPT1327()
Returns a set of parameters for CRC-15 MPT1327.
Definition CRC.h:1448
static const Parameters< crcpp_uint32, 32 > & CRC_32_MPEG2()
Returns a set of parameters for CRC-32 MPEG-2.
Definition CRC.h:2001
static CRCType UndoFinalize(CRCType remainder, CRCType finalXOR, bool reflectOutput)
Undoes the process of computing the final reflection and XOR of a CRC remainder.
Definition CRC.h:739
static const Parameters< crcpp_uint32, 24 > & CRC_24_FLEXRAYA()
Returns a set of parameters for CRC-24 FlexRay-A.
Definition CRC.h:1833
static const Parameters< crcpp_uint16, 16 > & CRC_16_MAXIM()
Returns a set of parameters for CRC-16 MAXIM.
Definition CRC.h:1668
static const Parameters< crcpp_uint32, 32 > & CRC_32_C()
Returns a set of parameters for CRC-32 C (aka CRC-32 ISCSI, CRC-32 Castagnoli, CRC-32 Interlaken).
Definition CRC.h:1982
static const Parameters< crcpp_uint16, 13 > & CRC_13_BBC()
Returns a set of parameters for CRC-13 BBC.
Definition CRC.h:1412
static const Parameters< crcpp_uint8, 8 > & CRC_8_MAXIM()
Returns a set of parameters for CRC-8 MAXIM (aka CRC-8 DOW-CRC).
Definition CRC.h:1231
static const Parameters< crcpp_uint8, 8 > & CRC_8_WCDMA()
Returns a set of parameters for CRC-8 WCDMA.
Definition CRC.h:1249
static const Parameters< crcpp_uint16, 16 > & CRC_16_BUYPASS()
Returns a set of parameters for CRC-16 BUYPASS (aka CRC-16 VERIFONE, CRC-16 UMTS).
Definition CRC.h:1485
static CRCType CalculateRemainder(const void *data, crcpp_size size, const Parameters< CRCType, CRCWidth > ¶meters, CRCType remainder)
Computes a CRC remainder.
Definition CRC.h:766
static const Parameters< crcpp_uint8, 6 > & CRC_6_NR()
Returns a set of parameters for CRC-6 NR.
Definition CRC.h:1157
static const Parameters< crcpp_uint32, 24 > & CRC_24_LTEA()
Returns a set of parameters for CRC-24 LTE-A/NR-A.
Definition CRC.h:1870
static const Parameters< crcpp_uint16, 15 > & CRC_15()
Returns a set of parameters for CRC-15 CAN.
Definition CRC.h:1430
static const Parameters< crcpp_uint16, 16 > & CRC_16_DECTX()
Returns a set of parameters for CRC-16 DECT-X (aka CRC-16 X-CRC).
Definition CRC.h:1594
static const Parameters< crcpp_uint32, 21 > & CRC_21_CAN()
Returns a set of parameters for CRC-21 CAN.
Definition CRC.h:1797
static const Parameters< crcpp_uint16, 12 > & CRC_12_UMTS()
Returns a set of parameters for CRC-12 UMTS (aka CRC-12 3GPP).
Definition CRC.h:1394
static const Parameters< crcpp_uint16, 16 > & CRC_16_CMS()
Returns a set of parameters for CRC-16 CMS.
Definition CRC.h:1558
static const Parameters< crcpp_uint16, 10 > & CRC_10_CDMA2000()
Returns a set of parameters for CRC-10 CDMA2000.
Definition CRC.h:1303
CRC & operator=(CRC &&other)=delete
static const Parameters< crcpp_uint8, 6 > & CRC_6_CDMA2000B()
Returns a set of parameters for CRC-6 CDMA2000-B.
Definition CRC.h:1120
static const Parameters< crcpp_uint16, 16 > & CRC_16_KERMIT()
Returns a set of parameters for CRC-16 KERMIT (aka CRC-16 CCITT, CRC-16 CCITT-TRUE).
Definition CRC.h:1649
static const Parameters< crcpp_uint16, 11 > & CRC_11()
Returns a set of parameters for CRC-11 FlexRay.
Definition CRC.h:1321
static const Parameters< crcpp_uint32, 32 > & CRC_32_Q()
Returns a set of parameters for CRC-32 Q.
Definition CRC.h:2038
static const Parameters< crcpp_uint16, 16 > & CRC_16_T10DIF()
Returns a set of parameters for CRC-16 T10-DIF.
Definition CRC.h:1704
static const Parameters< crcpp_uint16, 16 > & CRC_16_MCRF4XX()
Returns a set of parameters for CRC-16 MCRF4XX.
Definition CRC.h:1521
static const Parameters< crcpp_uint16, 12 > & CRC_12_CDMA2000()
Returns a set of parameters for CRC-12 CDMA2000.
Definition CRC.h:1358
static const Parameters< crcpp_uint16, 16 > & CRC_16_GENIBUS()
Returns a set of parameters for CRC-16 GENIBUS (aka CRC-16 EPC, CRC-16 I-CODE, CRC-16 DARC).
Definition CRC.h:1631
static IntegerType Reflect(IntegerType value, crcpp_uint16 numBits)
Reflects (i.e. reverses the bits within) an integer value.
Definition CRC.h:684
static const Parameters< crcpp_uint8, 8 > & CRC_8_EBU()
Returns a set of parameters for CRC-8 EBU (aka CRC-8 AES).
Definition CRC.h:1213
static const Parameters< crcpp_uint8, 5 > & CRC_5_USB()
Returns a set of parameters for CRC-5 USB.
Definition CRC.h:1084
static const Parameters< crcpp_uint16, 16 > & CRC_16_USB()
Returns a set of parameters for CRC-16 USB.
Definition CRC.h:1722
static const Parameters< crcpp_uint16, 16 > & CRC_16_MODBUS()
Returns a set of parameters for CRC-16 MODBUS.
Definition CRC.h:1686
static const Parameters< crcpp_uint32, 32 > & CRC_32_BZIP2()
Returns a set of parameters for CRC-32 BZIP2 (aka CRC-32 AAL5, CRC-32 DECT-B, CRC-32 B-CRC).
Definition CRC.h:1963
static const Parameters< crcpp_uint16, 16 > & CRC_16_CDMA2000()
Returns a set of parameters for CRC-16 CDMA2000.
Definition CRC.h:1540
static const Parameters< crcpp_uint16, 16 > & CRC_16_CCITTFALSE()
Returns a set of parameters for CRC-16 CCITT FALSE.
Definition CRC.h:1503
static const Parameters< crcpp_uint32, 32 > & CRC_32_POSIX()
Returns a set of parameters for CRC-32 POSIX.
Definition CRC.h:2019
static const Parameters< crcpp_uint16, 11 > & CRC_11_NR()
Returns a set of parameters for CRC-11 NR.
Definition CRC.h:1340
static const Parameters< crcpp_uint16, 16 > & CRC_16_X25()
Returns a set of parameters for CRC-16 X-25 (aka CRC-16 IBM-SDLC, CRC-16 ISO-HDLC,...
Definition CRC.h:1742
static const Parameters< crcpp_uint8, 6 > & CRC_6_CDMA2000A()
Returns a set of parameters for CRC-6 CDMA2000-A.
Definition CRC.h:1102
static const Parameters< crcpp_uint8, 5 > & CRC_5_ITU()
Returns a set of parameters for CRC-5 ITU.
Definition CRC.h:1066
static const Parameters< crcpp_uint8, 8 > & CRC_8_LTE()
Returns a set of parameters for CRC-8 LTE.
Definition CRC.h:1267
static CRCType Calculate(const void *data, crcpp_size size, const Parameters< CRCType, CRCWidth > ¶meters)
Computes a CRC.
Definition CRC.h:456
static const Parameters< crcpp_uint16, 16 > & CRC_16_DNP()
Returns a set of parameters for CRC-16 DNP.
Definition CRC.h:1612
static const Parameters< crcpp_uint16, 16 > & CRC_16_ARC()
Returns a set of parameters for CRC-16 ARC (aka CRC-16 IBM, CRC-16 LHA).
Definition CRC.h:1467
static const Parameters< crcpp_uint32, 32 > & CRC_32()
Returns a set of parameters for CRC-32 (aka CRC-32 ADCCP, CRC-32 PKZip).
Definition CRC.h:1945
static const Parameters< crcpp_uint64, 64 > & CRC_64()
Returns a set of parameters for CRC-64 ECMA.
Definition CRC.h:2074
static CRCType Finalize(CRCType remainder, CRCType finalXOR, bool reflectOutput)
Computes the final reflection and XOR of a CRC remainder.
Definition CRC.h:707
static const Parameters< crcpp_uint64, 40 > & CRC_40_GSM()
Returns a set of parameters for CRC-40 GSM.
Definition CRC.h:2056
CRC parameters.
Definition CRC.h:154
Table< CRCType, CRCWidth > MakeTable() const
Returns a CRC lookup table construct using these CRC parameters.
Definition CRC.h:335
CRCType initialValue
Initial CRC value.
Definition CRC.h:156
CRCType polynomial
CRC polynomial.
Definition CRC.h:155
CRCType finalXOR
Value to XOR with the final CRC.
Definition CRC.h:157
bool reflectInput
true to reflect all input bytes
Definition CRC.h:158
bool reflectOutput
true to reflect the output CRC (reflection occurs before the final XOR)
Definition CRC.h:159
CRC lookup table. After construction, the CRC parameters are fixed.
Definition CRC.h:170
const CRCType * GetTable() const
Gets the CRC table.
Definition CRC.h:388
const Parameters< CRCType, CRCWidth > & GetParameters() const
Gets the CRC parameters used to construct the CRC table.
Definition CRC.h:376
CRCType operator[](unsigned char index) const
Gets an entry in the CRC table.
Definition CRC.h:401
Table(const Parameters< CRCType, CRCWidth > ¶meters)
Constructs a CRC table from a set of CRC parameters.
Definition CRC.h:348
CRCType table[1<< CHAR_BIT]
CRC lookup table.
Definition CRC.h:188
void InitTable()
Initializes a CRC table.
Definition CRC.h:412
Parameters< CRCType, CRCWidth > parameters
CRC parameters used to construct the table.
Definition CRC.h:187