AceCRC
1.1.1
Cyclic Redundancy Check (CRC) algorithms (e.g. crc16ccitt, crc32) programmatically converted from C99 code generated by pycrc (https://pycrc.org) to Arduino C++ using namespaces and PROGMEM flash memory.
src
ace_crc
crc16ccitt_bit.cpp
Go to the documentation of this file.
1
20
#include "
crc16ccitt_bit.hpp
"
// header file converted by AceCRC
21
#include <stdlib.h>
22
#include <stdint.h>
23
#include <stdbool.h>
24
25
namespace
ace_crc {
26
namespace
crc16ccitt_bit {
27
28
29
30
crc_t
crc_update
(
crc_t
crc,
const
void
*data,
size_t
data_len)
31
{
32
const
unsigned
char
*d = (
const
unsigned
char
*)data;
33
uint8_t i;
34
crc_t
bit;
35
unsigned
char
c;
36
37
while
(data_len--) {
38
c = *d++;
39
for
(i = 0x80; i > 0; i >>= 1) {
40
bit = (crc & 0x8000) ^ ((c & i) ? 0x8000 : 0);
41
crc <<= 1;
42
if
(bit) {
43
crc ^= 0x1021;
44
}
45
}
46
crc &= 0xffff;
47
}
48
return
crc & 0xffff;
49
}
50
51
}
// crc16ccitt_bit
52
}
// ace_crc
ace_crc::crc16ccitt_bit::crc_update
crc_t crc_update(crc_t crc, const void *data, size_t data_len)
Update the crc value with new data.
Definition:
crc16ccitt_bit.cpp:30
crc16ccitt_bit.hpp
Functions and types for CRC checks.
ace_crc::crc16ccitt_bit::crc_t
uint16_t crc_t
The type of the CRC values.
Definition:
crc16ccitt_bit.hpp:68
Generated by
1.9.1