From d030a0729fe67fd196b29f801219548134d23f97 Mon Sep 17 00:00:00 2001 From: "Andrey A. Chernov" Date: Sun, 26 Mar 1995 19:32:24 +0000 Subject: [PATCH] Hash 8bit chars without sign extension --- lib/libc/stdlib/strhash.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/libc/stdlib/strhash.c b/lib/libc/stdlib/strhash.c index 04a97d670416..77d8ac944477 100644 --- a/lib/libc/stdlib/strhash.c +++ b/lib/libc/stdlib/strhash.c @@ -1,5 +1,5 @@ #ifndef lint -static char *rcsid = "$Header: /home/ncvs/src/usr.bin/dmenu/hash.c,v 1.1 1995/02/25 02:16:34 jkh Exp $"; +static char *rcsid = "$Header: /home/ncvs/src/lib/libc/stdlib/strhash.c,v 1.1 1995/03/26 10:21:55 jkh Exp $"; #endif /* @@ -36,7 +36,12 @@ static char *rcsid = "$Header: /home/ncvs/src/usr.bin/dmenu/hash.c,v 1.1 1995/02 */ /* - * $Log: hash.c,v $ + * $Log: strhash.c,v $ + * Revision 1.1 1995/03/26 10:21:55 jkh + * Add the strhash family of routines. They provide a number of features + * that the db/hash functions don't, and they're much simpler to use for + * low-overhead string hashing. + * * Revision 1.1 1995/02/25 02:16:34 jkh * Second version of this - now support the essentials of a basic * attributed file system for storing menu information and command @@ -156,7 +161,7 @@ _hash(int size, char *key) unsigned int h = 0x0; while (*key){ - h = (h << 1) ^ (h ^ *key++); + h = (h << 1) ^ (h ^ (unsigned char) *key++); } h %= size;