MCPcopy Create free account
hub / github.com/Tencent/Hardcoder / getcrc4

Function getcrc4

libapp2sys/src/main/cpp/util.h:168–179  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

166static const uint8_t crc4_table[16] = {0, 3, 6, 5, 12, 15, 10, 9, 11, 8, 13, 14, 7, 4, 1, 2};
167
168static uint32_t getcrc4(void *data, uint32_t len) { // RETURN 4 bit crc
169 uint8_t *p = (uint8_t *) data;
170
171 uint8_t crc = 0;
172 for (uint32_t k = 0; k < len; k++) {
173 crc ^= p[k] >> 4;
174 crc = crc4_table[crc];
175 crc ^= p[k] & 0xF;
176 crc = crc4_table[crc];
177 }
178 return crc;
179}
180
181static unsigned int Crc32Table[256] = {0};
182

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected