]> git.datanom.net - hashtable.git/blame - hashtable.h
Solution without chaining
[hashtable.git] / hashtable.h
CommitLineData
1d8fe1f7
MR
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
10typedef uint64_t (*HashFunc)(const void*);
11typedef bool (*EqualFunc)(const void*, const void*);
12typedef struct _Hashtable Hashtable;
13
14uint64_t int_hash(const void*);
15uint64_t str_hash(const void*);
16uint64_t ptr_hash(const void*);
17bool int_equal(const void*, const void*);
18bool str_equal(const void*, const void*);
19bool ptr_equal(const void*, const void*);
20
21Hashtable* hash_table_create(HashFunc hf, EqualFunc ef);
22Hashtable* hash_table_create_full(HashFunc hf, EqualFunc ef, uint32_t size);
23void hash_table_destroy(Hashtable* ht);
24void hash_table_print(Hashtable* ht);
25bool hash_table_insert(Hashtable* ht, const void* key, void* obj);
26void* hash_table_lookup(Hashtable* ht, const void* key);
27void* hash_table_delete(Hashtable* ht, const void* key);
28
29#endif
30
This page took 0.040191 seconds and 5 git commands to generate.