]> git.datanom.net - hashtable.git/blob - hashtable.h
f51018275ca3d83d877d42c9d0328c52f2f63a3f
[hashtable.git] / hashtable.h
1 #ifndef _HASHTABLE_H_
2 #define _HASHTABLE_H_
3
4 #include <stdint.h>
5 #include <stdbool.h>
6 #include <stddef.h>
7
8 #define TABLESIZE (1<<20)
9
10 typedef uint64_t (*HashFunc)(const void*);
11 typedef bool (*EqualFunc)(const void*, const void*);
12 typedef struct _Hashtable Hashtable;
13
14 uint64_t int_hash(const void*);
15 uint64_t str_hash(const void*);
16 uint64_t ptr_hash(const void*);
17 bool int_equal(const void*, const void*);
18 bool str_equal(const void*, const void*);
19 bool ptr_equal(const void*, const void*);
20
21 Hashtable* hash_table_create(HashFunc hf, EqualFunc ef);
22 Hashtable* hash_table_create_full(HashFunc hf, EqualFunc ef, uint32_t size);
23 void hash_table_destroy(Hashtable* ht);
24 void hash_table_print(Hashtable* ht);
25 bool hash_table_insert(Hashtable* ht, const void* key, void* obj);
26 void* hash_table_lookup(Hashtable* ht, const void* key);
27 void* hash_table_delete(Hashtable* ht, const void* key);
28
29 #endif
30
This page took 0.071141 seconds and 4 git commands to generate.