From 05ae1fc2fef778138bb3a136340dd923ca9687a0 Mon Sep 17 00:00:00 2001 From: ame Date: Fri, 8 Mar 2024 14:14:39 -0600 Subject: fixed hashes and net stuff --- src/types/map.h | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/types/map.h (limited to 'src/types/map.h') diff --git a/src/types/map.h b/src/types/map.h new file mode 100644 index 0000000..cb8fed2 --- /dev/null +++ b/src/types/map.h @@ -0,0 +1,29 @@ + +#ifndef _MAP_H +#define _MAP_H + +#include +#include "str.h" +#include "parray.h" + +typedef struct { + void* value; + str* key; + uint64_t hash; +} melem_t; + +typedef struct { + melem_t* M; + int len; + int mod; +} map_t; + +map_t* map_init(); +void map_set(map_t*, char*, void*); +void* map_get(map_t* , char*); +int map_geti(map_t* , char*); +void map_remove(map_t* p, char* key, enum free_type free); +void map_clear(map_t*, enum free_type); +void map_lclear(map_t*); + +#endif //_MAP_H \ No newline at end of file -- cgit v1.2.3