summaryrefslogtreecommitdiffstats
path: root/hash.c
diff options
context:
space:
mode:
authorBrendan Cully <brendan@kublai.com>2009-01-03 14:00:25 -0800
committerBrendan Cully <brendan@kublai.com>2009-01-03 14:00:25 -0800
commit8a6df300ce98f15253723fe44584fdefbfc42902 (patch)
tree21ecadef67d93d8d905522a14f80353d6ec8444c /hash.c
parent2350076e5e2b453415482ab53bed55ce2809410a (diff)
Make hash_string work in unsigned domain
Diffstat (limited to 'hash.c')
-rw-r--r--hash.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/hash.c b/hash.c
index 97a9eb4f..7e4e19fd 100644
--- a/hash.c
+++ b/hash.c
@@ -28,7 +28,7 @@
#define SOMEPRIME 149711
-int hash_string (const unsigned char *s, int n)
+unsigned int hash_string (const unsigned char *s, unsigned int n)
{
unsigned int h = 0;
@@ -36,7 +36,7 @@ int hash_string (const unsigned char *s, int n)
h += (h << 7) + *s++;
h = (h * SOMEPRIME) % n;
- return (signed) h;
+ return h;
}
HASH *hash_create (int nelem)