hashmap.c icon indicating copy to clipboard operation
hashmap.c copied to clipboard

Support hashmap_get_by_hash, and hashmap_set_by_hash

Open okanaganrusty opened this issue 3 years ago • 2 comments

As part of a project we're working on, we are not creating a key based on the item stored in the hash map. We have a pointer to the item which we need to lookup within the hash map at periodic intervals.

okanaganrusty avatar Mar 28 '22 21:03 okanaganrusty

Maybe I'm missing something, but isn't this the same as defining a hash function such as

uint64_t my_hash_fn (
        const void *item, uint64_t seed0, uint64_t seed1)
{ return (uint64_t) item; }

for your hash map? (I am not grasping the use case, since if you are looking up something by pointer, you already know how to get it)

scossu avatar Mar 30 '22 02:03 scossu

Considering there is the function hashmap_set_with_hash now, this PR could be closed...

ghost avatar Sep 02 '23 16:09 ghost