Hashing and equality functions for common data types.
u64(* hasher_t)(void *)
Function that hashes an object.
bool(* is_equal_t)(void *, void *)
Function that compares whether two objects are equal.
void * ps_hash_map_get(struct ps_hash_map *map, void *key)
Gets the value associated with the given key.
struct ps_hash_map * _ps_hash_map_new(is_equal_t is_equal, hasher_t hasher, free_fn_t free_fn, u64 capacity)
struct ps_hash_map * ps_hash_map_new(is_equal_t is_equal, hasher_t hasher, free_fn_t free_fn)
Creates a new hash map with the given comparison and memory functions.
void(* free_fn_t)(void *ptr)
Function that destroys an object and its owned resources.
u64 ps_hash_map_count(const struct ps_hash_map *map)
Gets the number of key-value pairs in the hash map.
void ps_hash_map_free(struct ps_hash_map *map)
Destroys all data owned by the hash map.
void ps_hash_map_insert(struct ps_hash_map **map_ptr, void *key, void *value)
Inserts a new key-value pair into the hash map.
bool ps_hash_map_contains(struct ps_hash_map *map, void *key)
Checks if the hash map contains the given key-value pair.
void ps_hash_map_remove(struct ps_hash_map *map, void *key)
Removes the key-value pair associated with the given key.
struct ps_hash_map_entry * next
u64 length
Number of first-node entries.
u64 count
Number of total entries: load factor = count / length.
struct ps_hash_map::ps_hash_map_entry entries[]