MCPcopy Create free account
hub / github.com/RsyncProject/rsync / crc32

Function crc32

zlib/crc32.c:202–231  ·  view source on GitHub ↗

========================================================================= */

Source from the content-addressed store, hash-verified

200
201/* ========================================================================= */
202unsigned long ZEXPORT crc32(unsigned long crc, const unsigned char FAR *buf, uInt len)
203{
204 if (buf == Z_NULL) return 0UL;
205
206#ifdef DYNAMIC_CRC_TABLE
207 if (crc_table_empty)
208 make_crc_table();
209#endif /* DYNAMIC_CRC_TABLE */
210
211#ifdef BYFOUR
212 if (sizeof(void *) == sizeof(ptrdiff_t)) {
213 z_crc_t endian;
214
215 endian = 1;
216 if (*((unsigned char *)(&endian)))
217 return crc32_little(crc, buf, len);
218 else
219 return crc32_big(crc, buf, len);
220 }
221#endif /* BYFOUR */
222 crc = crc ^ 0xffffffffUL;
223 while (len >= 8) {
224 DO8;
225 len -= 8;
226 }
227 if (len) do {
228 DO1;
229 } while (--len);
230 return crc ^ 0xffffffffUL;
231}
232
233#ifdef BYFOUR
234

Callers 4

inflate.cFile · 0.85
deflateResetKeepFunction · 0.85
deflateFunction · 0.85
ifFunction · 0.85

Calls 3

make_crc_tableFunction · 0.85
crc32_littleFunction · 0.85
crc32_bigFunction · 0.85

Tested by

no test coverage detected