ref: 961b6524f4e87570495b1c3eece15104ca61f22e
parent: ee646b3b4010bec918f5d64d6849a4b2e7e268a3
author: Ori Bernstein <[email protected]>
date: Thu Dec 18 09:57:24 EST 2014
Overflowing an signed value is undefined. Use uintptr_t.
--- a/parse/htab.c
+++ b/parse/htab.c
@@ -262,14 +262,14 @@
ulong ptrhash(void *key)
{
- return inthash((intptr_t)key);
+ return inthash((uintptr_t)key);
}
ulong inthash(uint64_t key)
{
- intptr_t h;
+ uintptr_t h;
- h = (intptr_t) key;
+ h = (uintptr_t) key;
h *= 357913941;
h ^= h << 24;
h += ~357913941;