#ifndef MAP_H #define MAP_H #include #include typedef struct EntryStruct { uint32_t key; void* value; } Entry; typedef struct MaybeValueStruct { bool has_value; void* value; } MaybeValue; typedef struct MapIteratorStruct { uint32_t count; uint32_t* keys; void** vals; } MapIterator; typedef struct MapStruct { uint32_t buckets_count; Entry** buckets; uint32_t* bucket_sizes; uint32_t* bucket_usage; } Map; Map map_create(uint32_t buckets_count, uint32_t initial_bucket_size); MaybeValue map_lookup(Map map, uint32_t key); bool map_add(Map* map, uint32_t key, void* value); MaybeValue map_del(Map* map, uint32_t key); void map_destroy(Map map); MapIterator map_iterator_create(Map map); void map_iterator_free(MapIterator iterator); #endif