urcu-ht: add correct hash, implement delete_all
[urcu.git] / urcu-ht.h
index 0cbd1e648799171be694865895e0d712fa29721d..58a2cedc8e887337f173cc17b607236bc457a05f 100644 (file)
--- a/urcu-ht.h
+++ b/urcu-ht.h
@@ -1,10 +1,15 @@
 #ifndef _URCU_HT_H
 #define _URCU_HT_H
 
-#define HASH_SIZE      4096
-typedef unsigned long (*ht_hash_fct)(void *key);
+#include <stdint.h>
 
-struct rcu_ht *ht_new(ht_hash_fct hash_fct, void (*free_fct)(void *data));
+typedef uint32_t (*ht_hash_fct)(void *key);
+
+/*
+ * init_size must be power of two.
+ */
+struct rcu_ht *ht_new(ht_hash_fct hash_fct, void (*free_fct)(void *data),
+                     unsigned long init_size);
 
 void ht_delete_all(struct rcu_ht *ht);
 
@@ -18,6 +23,6 @@ int ht_delete(struct rcu_ht *ht, void *key);
 
 void *ht_steal(struct rcu_ht *ht, void *key);
 
-unsigned long stupid_hash(void *key);
+uint32_t ht_jhash(void *key, u32 length, u32 initval);
 
 #endif /* _URCU_HT_H */
This page took 0.031082 seconds and 4 git commands to generate.