summaryrefslogtreecommitdiff
path: root/crc32.c
diff options
context:
space:
mode:
authorMark Adler <madler@alumni.caltech.edu>2011-09-09 23:22:37 -0700
committerMark Adler <madler@alumni.caltech.edu>2011-09-09 23:22:37 -0700
commit4b5a43a219d51066c01ff2ab86af18b967f2d0dd (patch)
tree4dcaf0cd18751d04cf638a9a6ec521990d4f2e90 /crc32.c
parent086e982175da84b3db958191031380794315f95f (diff)
downloadzlib-4b5a43a219d51066c01ff2ab86af18b967f2d0dd.tar.gz
zlib 1.2.0.5v1.2.0.5
Diffstat (limited to 'crc32.c')
-rw-r--r--crc32.c15
1 files changed, 7 insertions, 8 deletions
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 <rbrown64@csc.com.au> 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--;
}