aoc_omni/c/lib/hashmap.h

25 lines
519 B
C
Raw Permalink Normal View History

2024-12-27 05:30:39 -05:00
#ifndef AOC_HASHMAP
#define AOC_HASHMAP
2024-12-25 11:16:39 -05:00
2024-12-27 05:30:39 -05:00
#define AOC_HASHMAP_RADIX 1024
2024-12-25 11:16:39 -05:00
2024-12-27 05:30:39 -05:00
int aoc_hash(const char *string);
2024-12-25 11:16:39 -05:00
typedef struct AocHashmapNode AocHashmapNode;
typedef struct AocHashmapNode {
char *key;
2024-12-25 11:58:51 -05:00
void *value;
2024-12-25 11:16:39 -05:00
AocHashmapNode *next;
} AocHashmapNode;
typedef struct AocHashmap {
AocHashmapNode* buckets[AOC_HASHMAP_RADIX];
} AocHashmap;
2024-12-27 05:30:39 -05:00
AocHashmapNode *aoc_hashmap_get(AocHashmap *map, char *key);
void aoc_hashmap_put(AocHashmap *map, char *key, void *value);
void aoc_hashmap_free(AocHashmap *map);
2024-12-25 12:45:28 -05:00
2024-12-27 05:30:39 -05:00
#endif