22#define HASH_OF(key) (size_t)key
25#define HASHMAP(token) hashmap##_##token
34typedef struct HASHMAP(entry_t) {
39typedef struct HASHMAP(t) {
85 HASHMAP(entry_t)* upper_limit = hashmap->entries + hashmap->capacity;
122 free(hashmap->entries);
130 write_to->value = value;
136 return read_from->value;
ret capacity
Definition hashmap.h:113
ret entries
Definition hashmap.h:112
return ret
Definition hashmap.h:118
void HASHMAP free(HASHMAP(t) *hashmap)
Free all memory used by the given hashmap.
Definition hashmap.h:121
void HASHMAP put(HASHMAP(t) *hashmap, K key, V value)
Associate a value with the given key.
Definition hashmap.h:126
V HASHMAP get(HASHMAP(t) *hashmap, K key)
Get the value associated with the given key. Precondition: The key must be present in the map.
Definition hashmap.h:133
#define HASH_OF(key)
Definition hashmap.h:22
#define K
Defines a generic, non-resizing hashmap data type.
Definition hashmap.h:16
assert(address >=hashmap->entries)
static K key
Definition hashmap.h:70
K nothing
Definition hashmap.h:54
ret num_entries
Definition hashmap.h:114
#define HASHMAP(token)
Definition hashmap.h:25
return address
Definition hashmap.h:74
#define V
Definition hashmap.h:19