diff options
author | Marvin Borner | 2023-02-13 16:52:38 +0100 |
---|---|---|
committer | Marvin Borner | 2023-02-13 16:52:38 +0100 |
commit | 4e106e78a98f7a241fc2681fefc0996a34207045 (patch) | |
tree | 0f504c180ca6d8759d0ec48aa5f7ac214d016c06 /inc/hamt.h | |
parent | 373c4bdc9cc01e2986f518eccc54c9d3856b7d05 (diff) |
Switched to HAMT and BDWGC
Diffstat (limited to 'inc/hamt.h')
-rw-r--r-- | inc/hamt.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/inc/hamt.h b/inc/hamt.h new file mode 100644 index 0000000..da5f876 --- /dev/null +++ b/inc/hamt.h @@ -0,0 +1,30 @@ +#ifndef HAMT_H +#define HAMT_H + +#include <stdbool.h> +#include <stddef.h> +#include <stdint.h> + +typedef int (*hamt_cmp_fn)(const void *lhs, const void *rhs); +typedef uint32_t (*hamt_key_hash_fn)(const void *key, const size_t gen); + +typedef struct hamt_impl *HAMT; + +struct hamt_allocator { + void *(*malloc)(const size_t size); + void *(*realloc)(void *chunk, const size_t size); + void (*free)(void *chunk); +}; + +extern struct hamt_allocator hamt_allocator_default; + +HAMT hamt_create(hamt_key_hash_fn key_hash, hamt_cmp_fn key_cmp, + struct hamt_allocator *ator); +void hamt_delete(HAMT); + +void *hamt_get(const HAMT trie, void *key); +HAMT hamt_pset(const HAMT trie, void *key, void *value); + +typedef struct hamt_iterator_impl *hamt_iterator; + +#endif |