From 4e106e78a98f7a241fc2681fefc0996a34207045 Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Mon, 13 Feb 2023 16:52:38 +0100 Subject: Switched to HAMT and BDWGC --- inc/hamt.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 inc/hamt.h (limited to 'inc/hamt.h') 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 +#include +#include + +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 -- cgit v1.2.3