>From 82b53fda2a73bbdbd7483fb0a74dc00ada7a0b64 Mon Sep 17 00:00:00 2001 From: Nikos Mavrogiannopoulos Date: Thu, 27 Sep 2012 08:42:55 +0200 Subject: [PATCH 2/2] If tablesize is zero then return the full h. --- lib/hash-pjw.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/hash-pjw.c b/lib/hash-pjw.c index 0966598..927271d 100644 --- a/lib/hash-pjw.c +++ b/lib/hash-pjw.c @@ -36,5 +36,8 @@ hash_pjw (const void *x, size_t tablesize) for (s = x; *s; s++) h = *s + ((h << 9) | (h >> (SIZE_BITS - 9))); - return h % tablesize; + if (tablesize) + return h % tablesize; + else + return h; } -- 1.7.10.4