MCPcopy Create free account
hub / github.com/TeleHuman/TextOp / crc32_core

Function crc32_core

TextOpDeploy/src/textop_ctrl/src/motor_crc_hg.cpp:26–46  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24}
25
26uint32_t crc32_core(uint32_t *ptr, uint32_t len) {
27 uint32_t xbit = 0;
28 uint32_t data = 0;
29 uint32_t CRC32 = 0xFFFFFFFF;
30 const uint32_t dwPolynomial = 0x04c11db7;
31 for (uint32_t i = 0; i < len; i++) {
32 xbit = 1 << 31;
33 data = ptr[i];
34 for (uint32_t bits = 0; bits < 32; bits++) {
35 if (CRC32 & 0x80000000) {
36 CRC32 <<= 1;
37 CRC32 ^= dwPolynomial;
38 } else
39 CRC32 <<= 1;
40 if (data & xbit) CRC32 ^= dwPolynomial;
41
42 xbit >>= 1;
43 }
44 }
45 return CRC32;
46}

Callers 1

get_crcFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected