Fix compilation error on 64-bit platforms.

This commit is contained in:
tls 2009-03-25 19:21:39 +00:00
parent a34cd18b76
commit 3559a90485
1 changed files with 3 additions and 5 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: crc32.c,v 1.2 2009/03/25 18:41:06 tls Exp $ */
/* $NetBSD: crc32.c,v 1.3 2009/03/25 19:21:39 tls Exp $ */
/* crc32.c -- compute the CRC-32 of a data stream
*
@ -19,8 +19,6 @@
#include <sys/param.h>
#include <machine/endian.h>
#define z_ptrdiff_t int32_t
typedef uint32_t u4;
/* Definitions for doing the crc four data bytes at a time. */
@ -50,7 +48,7 @@ uint32_t crc32(uint32_t crc, const uint8_t *buf, size_t len)
c = (u4)crc;
c = ~c;
while (len && ((z_ptrdiff_t)buf & 3)) {
while (len && ((uintptr_t)buf & 3)) {
c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8);
len--;
}
@ -94,7 +92,7 @@ uint32_t crc32(
c = REV((u4)crc);
c = ~c;
while (len && ((z_ptrdiff_t)buf & 3)) {
while (len && ((uintptr_t)buf & 3)) {
c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8);
len--;
}