|
|
|
@ -238,6 +238,19 @@ void *hashmap_get(struct hashmap *map, void *key) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// hashmap_probe returns the item in the bucket at position or NULL if an item
|
|
|
|
|
// is not set for that bucket. The position is 'moduloed' by the number of
|
|
|
|
|
// buckets in the hashmap.
|
|
|
|
|
void *hashmap_probe(struct hashmap *map, uint64_t position) {
|
|
|
|
|
size_t i = position & map->mask;
|
|
|
|
|
struct bucket *bucket = bucket_at(map, i);
|
|
|
|
|
if (!bucket->dib) {
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
return bucket_item(bucket);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// hashmap_delete removes an item from the hash map and returns it. If the
|
|
|
|
|
// item is not found then NULL is returned.
|
|
|
|
|
void *hashmap_delete(struct hashmap *map, void *key) {
|
|
|
|
|