X-Git-Url: https://git.llucax.com/software/mutt-debian.git/blobdiff_plain/14c29200cb58d3c4a0830265f2433849781858d0..76a54b65b4d405cea98a5d5b18d2030b4ed9b556:/hash.c diff --git a/hash.c b/hash.c index 2c7e6dd..7e4e19f 100644 --- a/hash.c +++ b/hash.c @@ -28,21 +28,15 @@ #define SOMEPRIME 149711 -int hash_string (const unsigned char *s, int n) +unsigned int hash_string (const unsigned char *s, unsigned int n) { - int h = 0; + unsigned int h = 0; -#if 0 - while (*s) - h += *s++; -#else while (*s) h += (h << 7) + *s++; h = (h * SOMEPRIME) % n; - h = (h >= 0) ? h : h + n; -#endif - return (h % n); + return h; } HASH *hash_create (int nelem)