diff options
author | Erik Hovland <erik@hovland.org> | 2008-12-16 12:53:19 -0800 |
---|---|---|
committer | Erik Hovland <erik@hovland.org> | 2008-12-16 12:53:19 -0800 |
commit | d2d40793765c6e115bea995701d40dcf9b65da2d (patch) | |
tree | 9557cebc4edc7f92ecf7572ff98ca535126c5684 /hash.c | |
parent | 170e6907b9761afcfebad30d9876fa43804bd5fd (diff) |
Remove redundant int clamping
Diffstat (limited to 'hash.c')
-rw-r--r-- | hash.c | 8 |
1 files changed, 1 insertions, 7 deletions
@@ -32,17 +32,11 @@ int hash_string (const unsigned char *s, int n) { 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 (signed) (h % n); + return (signed) h; } HASH *hash_create (int nelem) |