29 #ifndef __etl_crc16_kermit__
30 #define __etl_crc16_kermit__
34 #include "static_assert.h"
54 template <const
int ENDIANNESS = endian::little>
59 typedef uint16_t value_type;
74 template<
typename TIterator>
92 template<
typename TValue>
97 if (ENDIANNESS == endian::little)
99 for (
int i = 0; i <
sizeof(TValue); ++i)
101 add(uint8_t((value >> (i * 8)) & 0xFF));
106 for (
int i =
sizeof(TValue) - 1; i >= 0; --i)
108 add(uint8_t((value >> (i * 8)) & 0xFF));
118 crc = (crc >> 8) ^ CRC_KERMIT[(crc ^ value) & 0xFF];
125 template<
typename TIterator>
146 template<
typename TValue>
157 operator value_type ()
const
crc16_kermit< ENDIANNESS > & operator+=(TValue value)
Definition: crc16_kermit.h:147
Definition: type_traits.h:130
void reset()
Resets the CRC to the initial state.
Definition: crc16_kermit.h:84
void add(TIterator begin, const TIterator end)
Definition: crc16_kermit.h:126
crc16_kermit(TIterator begin, const TIterator end)
Definition: crc16_kermit.h:75
crc16_kermit()
Default constructor.
Definition: crc16_kermit.h:64
Definition: algorithm.h:43
TContainer::iterator end(TContainer &container)
Definition: container.h:95
TContainer::iterator begin(TContainer &container)
Definition: container.h:45
void add(TValue value)
Definition: crc16_kermit.h:93
const uint16_t CRC_KERMIT[]
Definition: crc16_kermit.h:47
Definition: crc16_kermit.h:55
value_type value() const
Gets the CRC value.
Definition: crc16_kermit.h:138
void add(uint8_t value)
Definition: crc16_kermit.h:116