diff options
author | jb <jb@FreeBSD.org> | 1998-03-10 05:03:49 +0000 |
---|---|---|
committer | jb <jb@FreeBSD.org> | 1998-03-10 05:03:49 +0000 |
commit | 3993727e630e0d7a6b7efef91fa8eb08cf4b62bf (patch) | |
tree | 5a3faab89b17f643a7a86dfb08ce976dd9534067 /usr.bin/cksum/crc32.c | |
parent | 757dddeeb5cd4b11dbbab454753dcdef1458bb26 (diff) | |
download | FreeBSD-src-3993727e630e0d7a6b7efef91fa8eb08cf4b62bf.zip FreeBSD-src-3993727e630e0d7a6b7efef91fa8eb08cf4b62bf.tar.gz |
cksum does a 32-bit checksum, so it needs to use u_int32_t variables,
not u_long. With this change, cksum stops core dumping on alpha (not
a good sign!) and actually computes the same values as it does on i386.
Diffstat (limited to 'usr.bin/cksum/crc32.c')
-rw-r--r-- | usr.bin/cksum/crc32.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/usr.bin/cksum/crc32.c b/usr.bin/cksum/crc32.c index 51aff76..1cc29a2 100644 --- a/usr.bin/cksum/crc32.c +++ b/usr.bin/cksum/crc32.c @@ -11,13 +11,15 @@ * Spencer Garrett <srg@quick.com> */ +#include <sys/types.h> + #define CRC(crc, ch) (crc = (crc >> 8) ^ crctab[(crc ^ (ch)) & 0xff]) /* generated using the AUTODIN II polynomial * x^32 + x^26 + x^23 + x^22 + x^16 + * x^12 + x^11 + x^10 + x^8 + x^7 + x^5 + x^4 + x^2 + x^1 + 1 */ -unsigned long crctab[256] = { +static const u_int32_t crctab[256] = { 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, @@ -88,14 +90,14 @@ unsigned long crctab[256] = { #include <sys/types.h> #include <unistd.h> -u_long crc32_total = 0 ; +u_int32_t crc32_total = 0 ; int crc32(fd, cval, clen) register int fd; - u_long *cval, *clen; + u_int32_t *cval, *clen; { - u_long crc = ~0; + u_int32_t crc = ~0; char buf[BUFSIZ], *p ; int len, nr ; |