Add Linux's math64.h
[akaros.git] / kern / src / hashtable.c
index 9d150ab..1465f2a 100644 (file)
@@ -14,6 +14,8 @@
 #include <string.h>
 #include <slab.h>
 #include <kmalloc.h>
+#include <hash.h>
+#include <arch/types.h>
 
 /*
 Credit for primes table: Aaron Krowne
@@ -42,16 +44,13 @@ void hashtable_init(void)
        hentry_cache = kmem_cache_create("hash_entry",
                                         sizeof(struct hash_entry),
                                         __alignof__(struct hash_entry), 0,
-                                        NULL, 0, 0);
+                                        NULL, 0, 0, NULL);
 }
 
 /* Common hash/equals functions.  Don't call these directly. */
 size_t __generic_hash(void *k)
 {
-       /* 0x9e370001UL used by Linux (32 bit)
-        * (prime approx to the golden ratio to the max integer, IAW Knuth)
-        */
-       return (size_t)k * 0x9e370001UL;
+       return hash_long((unsigned long)k, BITS_PER_LONG);
 }
 
 ssize_t __generic_eq(void *k1, void *k2)