MCPcopy Create free account
hub / github.com/F-Stack/f-stack / crcspeed64big

Function crcspeed64big

app/redis-6.2.6/src/crcspeed.c:183–213  ·  view source on GitHub ↗

Calculate a non-inverted CRC eight bytes at a time on a big-endian * architecture. */

Source from the content-addressed store, hash-verified

181 * architecture.
182 */
183uint64_t crcspeed64big(uint64_t big_table[8][256], uint64_t crc, void *buf,
184 size_t len) {
185 unsigned char *next = buf;
186
187 crc = rev8(crc);
188 while (len && ((uintptr_t)next & 7) != 0) {
189 crc = big_table[0][(crc >> 56) ^ *next++] ^ (crc << 8);
190 len--;
191 }
192
193 while (len >= 8) {
194 crc ^= *(uint64_t *)next;
195 crc = big_table[0][crc & 0xff] ^
196 big_table[1][(crc >> 8) & 0xff] ^
197 big_table[2][(crc >> 16) & 0xff] ^
198 big_table[3][(crc >> 24) & 0xff] ^
199 big_table[4][(crc >> 32) & 0xff] ^
200 big_table[5][(crc >> 40) & 0xff] ^
201 big_table[6][(crc >> 48) & 0xff] ^
202 big_table[7][crc >> 56];
203 next += 8;
204 len -= 8;
205 }
206
207 while (len) {
208 crc = big_table[0][(crc >> 56) ^ *next++] ^ (crc << 8);
209 len--;
210 }
211
212 return rev8(crc);
213}
214
215/* WARNING: Completely untested on big endian architecture. Possibly broken. */
216uint16_t crcspeed16big(uint16_t big_table[8][256], uint16_t crc_in, void *buf,

Callers 1

crcspeed64nativeFunction · 0.85

Calls 1

rev8Function · 0.85

Tested by

no test coverage detected