4 ms·
> don't tell yourself it's only good for hashing. The hash function[1] takes an arbitrary input and generate (in this case) a 32bit integer. This is nessecary
by Genbox 3y ago
> don't tell yourself it's only good for hashing.
The hash function[1] takes an arbitrary input and generate (in this case) a 32bit integer. This is nessecary to index values that are not integers (such as byte arrays or strings). It also doubles as a way to deterministically randomize values across the keyspace for better distribution of keys.
[1] https://github.com/mkirchner/hamt/blob/main/src/hamt.c#L377 https://github.com/mkirchner/hamt/blob/main/src/hamt.c#L377