diff options
author | Rocco Rutte <pdmef@gmx.net> | 2008-07-02 10:06:10 +0200 |
---|---|---|
committer | Rocco Rutte <pdmef@gmx.net> | 2008-07-02 10:06:10 +0200 |
commit | 80643307a082b5a3b7408040ce7d58d9f483a7bb (patch) | |
tree | 22dd2819f17120fba465ed8ff9f78dfcc2bcd2dc /hash.c | |
parent | 730fbc5c71c91b8ee9bd8601cf75888946a0ee7b (diff) |
Use casts to avoid triggering integer overflow detection in hash function
Diffstat (limited to 'hash.c')
-rw-r--r-- | hash.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -30,7 +30,7 @@ int hash_string (const unsigned char *s, int n) { - int h = 0; + unsigned int h = 0; #if 0 while (*s) @@ -42,7 +42,7 @@ int hash_string (const unsigned char *s, int n) h = (h >= 0) ? h : h + n; #endif - return (h % n); + return (signed) (h % n); } HASH *hash_create (int nelem) |