From 1dd53ce54c2008e3a11a636a496853cf6f9a5d65 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Fri, 24 Jan 2020 09:11:53 +0100 Subject: Convert hash map to gc, implement more instructions and call command --- include/std/hash_map.h | 25 ------------------------- 1 file changed, 25 deletions(-) delete mode 100644 include/std/hash_map.h (limited to 'include/std/hash_map.h') diff --git a/include/std/hash_map.h b/include/std/hash_map.h deleted file mode 100644 index b430d22..0000000 --- a/include/std/hash_map.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef TSL_HASH_MAP_H -#define TSL_HASH_MAP_H - -#include "string_view.h" -#include - -typedef uint64_t (*TslHashFunc)(const void *data, size_t size); - -/* TODO: Optimize small hash map by using the members of the struct instead of allocating on heap */ -typedef struct { - void *buckets_data; /* value=TslHashMapNode, data=|hash(uint64_t) + key_size(size_t) + key_data(...) data_size(size_t) + data_data(...)| */ - size_t buckets_size; - size_t buckets_capacity; -} TslHashMap; - -void tsl_hash_map_init(TslHashMap *self); -void tsl_hash_map_deinit(TslHashMap *self); - -int tsl_hash_map_insert(TslHashMap *self, const TslStringView *key, const void *data, size_t size, TslHashFunc hash_func); -/* Get a reference to the value by key @key, or NULL if it doesn't exist */ -void* tsl_hash_map_get(TslHashMap *self, const TslStringView *key, TslHashFunc hash_func); -/* Get a reference to the value by key @key, or insert a new value for the key with a size of @size */ -int tsl_hash_map_get_or_create(TslHashMap *self, const TslStringView *key, size_t size, TslHashFunc hash_func, void **output); - -#endif /* TSL_HASH_MAP_H */ -- cgit v1.2.3