#ifndef HASHMAP_H #define HASHMAP_H #include "ccc.h" #define ADVANCE_HASH(hash, val, cap) (hash = ((hash << 5) - hash + val) % cap) typedef integral_t (*hm_hash_fn)(const void*, integral_t); typedef bool (*hm_eq_fn)(const void*, const void*); typedef void (*hm_destroy_fn)(void*); struct hash_map { void** entries; integral_t cap; hm_hash_fn hash_fn; hm_eq_fn eq_fn; hm_destroy_fn destroy_fn; }; void hm_init(struct hash_map*, hm_hash_fn, hm_eq_fn, hm_destroy_fn); void hm_destroy(struct hash_map*); void** hm_cell_r(const struct hash_map*, const void*); void** hm_cell_w(struct hash_map*, const void*); #endif