Permalink
Browse files

Fixed potential segfault for 32bit systems in JyHash.c. Todo: check t…

…he whole project for similar issues, i.e. jlong vs ssize_t.
  • Loading branch information...
Stewori committed Jun 10, 2017
1 parent ec9e4fe commit da5fc5c5af8786c953530a5db20c53442b8e1939
Showing with 4 additions and 4 deletions.
  1. +4 −4 JyNI-C/src/JyHash.c
View
@@ -111,13 +111,13 @@ TableEntry* ptrTable;
* It appears for memory pointers the identity modulo capacity
* is actually a rather good hash function.
*/
//#define hash_func(i) ((jlong) i)*2654435761 % tableCapacity
#define hash_func(i) ((jlong) i) % tableCapacity
//#define hash_func(i) ((ssize_t) i)*2654435761 % tableCapacity
#define hash_func(i) ((uintptr_t) i) % tableCapacity
//#define rehash_func(i, k, prev) hash_func(prev)
#define rehash_func(i, k, prev) hash_func((((jlong) i) << k))
//#define rehash_func(i, k, prev) hash_func((((jlong) i) << k)*((jlong) prev))
#define rehash_func(i, k, prev) hash_func((((uintptr_t) i) << k))
//#define rehash_func(i, k, prev) hash_func((((ssize_t) i) << k)*((ssize_t) prev))
//#define rehash_func(i, k, prev) hash_func(i >> k)
inline void JyHash_init()

0 comments on commit da5fc5c

Please sign in to comment.