13 uint32_t
ar_crc32(uint32_t crc32,
const unsigned char *data,
size_t data_len)
19 for (i = 128; i; i >>= 1) {
20 h = (h >> 1) ^ ((h & 1) ? 0xEDB88320 : 0);
21 for (j = 0; j < 256; j += 2 * i) {
28 crc32 = crc32 ^ 0xFFFFFFFF;
29 while (data_len-- > 0) {
30 crc32 = (crc32 >> 8) ^
crc_table[(crc32 ^ *data++) & 0xFF];
32 return crc32 ^ 0xFFFFFFFF;
39 uint32_t
ar_crc32(uint32_t crc,
const unsigned char *data,
size_t data_len)
41 #if SIZE_MAX > UINT32_MAX
42 while (data_len > UINT32_MAX) {
43 crc = crc32(crc, data, UINT32_MAX);
45 data_len -= UINT32_MAX;
48 return crc32(crc, data, (uint32_t)data_len);