MCPcopy Create free account
hub / github.com/Meituan-Dianping/SQLAdvisor / crc32_little

Function crc32_little

zlib/crc32.c:262–293  ·  view source on GitHub ↗

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

(crc, buf, len)

Source from the content-addressed store, hash-verified

260
261/* ========================================================================= */
262local unsigned long crc32_little(crc, buf, len)
263 unsigned long crc;
264 const unsigned char FAR *buf;
265 unsigned len;
266{
267 register u4 c;
268 register const u4 FAR *buf4;
269
270 c = (u4)crc;
271 c = ~c;
272 while (len && ((ptrdiff_t)buf & 3)) {
273 c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8);
274 len--;
275 }
276
277 buf4 = (const u4 FAR *)(const void FAR *)buf;
278 while (len >= 32) {
279 DOLIT32;
280 len -= 32;
281 }
282 while (len >= 4) {
283 DOLIT4;
284 len -= 4;
285 }
286 buf = (const unsigned char FAR *)buf4;
287
288 if (len) do {
289 c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8);
290 } while (--len);
291 c = ~c;
292 return (unsigned long)c;
293}
294
295/* ========================================================================= */
296#define DOBIG4 c ^= *++buf4; \

Callers 1

crc32Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected