A 32-bit hash of a string. This is the hash Table uses for string keys.
get_hash :: (s: string, h := HASH_INIT) -> u32
Parameters
- s: string
- h := HASH_INIT
Returns
- u32
assert(get_hash("key") == get_hash("key"));
assert(get_hash("key") != get_hash("other"));get_hash :: (array: [] $T, h := HASH_INIT) -> u32
A 32-bit hash of the bytes of an array.
Parameters
- array: [] $T
- h := HASH_INIT
Returns
- u32
values := int.[1, 2, 3];
assert(get_hash(values) == get_hash(int.[1, 2, 3]));get_hash :: (x: $T, h := HASH_INIT) -> u32
A 32-bit hash of an integer, boolean, enum, pointer or float. Pass a previous result as h to combine several values.
Parameters
- x: $T
- h := HASH_INIT
Returns
- u32
combined := get_hash(7, get_hash(42));
assert(combined == get_hash(7, get_hash(42)));