AceCRC  0.3.1
Cyclic Redundancy Check (CRC) algorithms (e.g. crc32(), crc16ccitt()) programmatically converted from C99 code generated by pycrc (https://pycrc.org) to Arduino C++ using namespaces and PROGMEM flash memory.
crc32_nibble.hpp
Go to the documentation of this file.
1 
44 #ifndef ACE_CRC_CRC32_NIBBLE_HPP
45 #define ACE_CRC_CRC32_NIBBLE_HPP
46 
47 #include <stdlib.h>
48 #include <stdint.h>
49 
50 namespace ace_crc {
51 namespace crc32_nibble {
52 
53 
60 const uint8_t CRC_ALGO_TABLE_DRIVEN = 1;
61 
62 
68 typedef uint32_t crc_t;
69 
70 
76 inline crc_t crc_init(void)
77 {
78  return 0xffffffff;
79 }
80 
81 
90 crc_t crc_update(crc_t crc, const void *data, size_t data_len);
91 
92 
99 inline crc_t crc_finalize(crc_t crc)
100 {
101  return crc ^ 0xffffffff;
102 }
103 
104 
112 inline crc_t crc_calculate(const void *data, size_t data_len) {
113  crc_t crc = crc_init();
114  crc = crc_update(crc, data, data_len);
115  return crc_finalize(crc);
116 }
117 
118 } // crc32_nibble
119 } // ace_crc
120 
121 #endif /* ACE_CRC_CRC32_NIBBLE_HPP */
ace_crc::crc32_nibble::crc_t
uint32_t crc_t
The type of the CRC values.
Definition: crc32_nibble.hpp:68