LP64 fix; ok jose@, pvalchev@

This commit is contained in:
naddy 2004-03-10 17:32:46 +00:00
parent 887fc3e5a9
commit 5c86c28ea6
2 changed files with 32 additions and 4 deletions

View File

@ -1,7 +1,4 @@
# $OpenBSD: Makefile,v 1.4 2004/01/13 15:54:21 jose Exp $
# dumps core
NOT_FOR_ARCHS= sparc64
# $OpenBSD: Makefile,v 1.5 2004/03/10 17:32:46 naddy Exp $
COMMENT= "Z-code interpreter for X11"

View File

@ -0,0 +1,31 @@
$OpenBSD: patch-src_hash_c,v 1.1 2004/03/10 17:32:46 naddy Exp $
--- src/hash.c.orig 2000-11-01 00:01:57.000000000 +0100
+++ src/hash.c 2004-03-10 15:36:23.000000000 +0100
@@ -23,6 +23,7 @@
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include "hash.h"
@@ -80,7 +81,7 @@ static void init_crc32()
for (i = 0; i < 256; ++i) {
for (c = i << 24, j = 8; j > 0; --j)
c = c & 0x80000000 ? (c << 1) ^ CRC32_POLY : (c << 1);
- crc32_table[i] = c;
+ crc32_table[i] = c & 0xffffffff;
}
}
@@ -94,8 +95,8 @@ unsigned long hash_hash(unsigned char *b
init_crc32(); /* build table */
crc = 0xffffffff; /* preload shift register, per CRC-32 spec */
for (p = buf; len > 0; ++p, --len)
- crc = (crc << 8) ^ crc32_table[(crc >> 24) ^ *p];
- return ~crc; /* transmit complement, per CRC-32 spec */
+ crc = ((crc << 8) ^ crc32_table[(crc >> 24) ^ *p]) & 0xffffffff;
+ return ~crc & 0xffffffff; /* transmit complement, per CRC-32 spec */
}
static struct bucket *hash_lookup(hash hash,