Instantiated hash table module

Contents



This is an attempt to implement a templated hash table
NOTE: The key is always a u64 for simplicity and you will probably never need anything bigger.

Hash table type and function declaration, call: ZPL_TABLE_DECLARE(PREFIX, NAME, N, VALUE)
Hash table function definitions, call: ZPL_TABLE_DEFINE(NAME, N, VALUE)

PREFIX - a prefix for function prototypes e.g. extern, static, etc.
NAME - Name of the Hash Table
FUNC - the name will prefix function names
VALUE - the type of the value to be stored

tablename_init(NAME * h, zpl_allocator a);
tablename_destroy(NAME * h);
tablename_get(NAME * h, u64 key);
tablename_set(NAME * h, u64 key, VALUE value);
tablename_grow(NAME * h);
tablename_rehash(NAME * h, isize new_count);
tablename_remove(NAME * h, u64 key);

Classes

struct zpl_hash_table_find_result

Typedefs

using zpl_hash_table_find_result = struct zpl_hash_table_find_result

Defines

#define ZPL_TABLE(PREFIX, NAME, FUNC, VALUE)
#define ZPL_TABLE_DECLARE(PREFIX, NAME, FUNC, VALUE)
#define ZPL_TABLE_DEFINE(NAME, FUNC, VALUE)