#ifndef _HASHTABLE_H_ #define _HASHTABLE_H_ #include #include #include #define TABLESIZE (1<<20) typedef uint64_t (*HashFunc)(const void*); typedef bool (*EqualFunc)(const void*, const void*); typedef struct _Hashtable Hashtable; uint64_t int_hash(const void*); uint64_t str_hash(const void*); uint64_t ptr_hash(const void*); bool int_equal(const void*, const void*); bool str_equal(const void*, const void*); bool ptr_equal(const void*, const void*); Hashtable* hash_table_create(HashFunc hf, EqualFunc ef); Hashtable* hash_table_create_full(HashFunc hf, EqualFunc ef, uint32_t size); void hash_table_destroy(Hashtable* ht); void hash_table_print(Hashtable* ht); bool hash_table_insert(Hashtable* ht, const void* key, void* obj); void* hash_table_lookup(Hashtable* ht, const void* key); void* hash_table_delete(Hashtable* ht, const void* key); #endif