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

Function crc32_core

TextOpDeploy/src/unitree_mujoco/example/cpp/stand_go2.cpp:54–84  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

52};
53
54uint32_t crc32_core(uint32_t *ptr, uint32_t len)
55{
56 unsigned int xbit = 0;
57 unsigned int data = 0;
58 unsigned int CRC32 = 0xFFFFFFFF;
59 const unsigned int dwPolynomial = 0x04c11db7;
60
61 for (unsigned int i = 0; i < len; i++)
62 {
63 xbit = 1 << 31;
64 data = ptr[i];
65 for (unsigned int bits = 0; bits < 32; bits++)
66 {
67 if (CRC32 & 0x80000000)
68 {
69 CRC32 <<= 1;
70 CRC32 ^= dwPolynomial;
71 }
72 else
73 {
74 CRC32 <<= 1;
75 }
76
77 if (data & xbit)
78 CRC32 ^= dwPolynomial;
79 xbit >>= 1;
80 }
81 }
82
83 return CRC32;
84}
85
86void Custom::Init()
87{

Callers 1

LowCmdWriteMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected