From 4b5a43a219d51066c01ff2ab86af18b967f2d0dd Mon Sep 17 00:00:00 2001 From: Mark Adler Date: Fri, 9 Sep 2011 23:22:37 -0700 Subject: zlib 1.2.0.5 --- crc32.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'crc32.c') diff --git a/crc32.c b/crc32.c index 1622569..689b288 100644 --- a/crc32.c +++ b/crc32.c @@ -5,8 +5,8 @@ * Thanks to Rodney Brown for his contribution of faster * CRC methods: exclusive-oring 32 bits of data at a time, and pre-computing * tables for updating the shift register in one step with three exclusive-ors - * instead of four steps with four exclusive-ors. This results about a 50% - * increase in speed on a Power PC using gcc -O3. + * instead of four steps with four exclusive-ors. This results about a factor + * of two increase in speed on a Power PC G4 (PPC7455) using gcc -O3. */ /* @(#) $Id$ */ @@ -18,7 +18,7 @@ # endif /* !DYNAMIC_CRC_TABLE */ #endif /* MAKECRCH */ -#include "zutil.h" /* for STDC and FAR definitions */ +#include "zutil.h" /* for STDC and FAR definitions */ #define local static @@ -203,7 +203,7 @@ unsigned long ZEXPORT crc32(crc, buf, len) #endif /* DYNAMIC_CRC_TABLE */ #ifdef BYFOUR - { + if (sizeof(void *) == sizeof(ptrdiff_t)) { u4 endian; endian = 1; @@ -212,7 +212,7 @@ unsigned long ZEXPORT crc32(crc, buf, len) else return crc32_big(crc, buf, len); } -#else /* !BYFOUR */ +#endif /* BYFOUR */ crc = crc ^ 0xffffffffUL; while (len >= 8) { DO8; @@ -222,7 +222,6 @@ unsigned long ZEXPORT crc32(crc, buf, len) DO1; } while (--len); return crc ^ 0xffffffffUL; -#endif /* BYFOUR */ } #ifdef BYFOUR @@ -244,7 +243,7 @@ local unsigned long crc32_little(crc, buf, len) c = (u4)crc; c = ~c; - while (len && ((size_t)buf & 3)) { + while (len && ((ptrdiff_t)buf & 3)) { c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8); len--; } @@ -284,7 +283,7 @@ local unsigned long crc32_big(crc, buf, len) c = REV((u4)crc); c = ~c; - while (len && ((size_t)buf & 3)) { + while (len && ((ptrdiff_t)buf & 3)) { c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8); len--; } -- cgit v1.2.1