Module zerovec::hashmap::algorithms

source ·

Functions

  • Compute displacements for the given key_hashes, which split the keys into distinct slots by a two-level hashing schema. Returns a tuple of where the first item is the displacement array and the second item is the reverse mapping used to permute keys, values into their slots.
  • Compute hash using T1haHasher.
  • Calculate the index using (f0, f1), (d0, d1) in modulo m. Returns None if d is (0, 0) or modulo is 0 else returns the index computed using (f0 + f1 * d0 + d1) mod m.
  • Split the 64bit hash into (g, f0, f1). g denotes the highest 16bits of the hash modulo m, and is referred to as first level hash. (f0, f1) denotes the middle, and lower 24bits of the hash respectively. (f0, f1) are used to distribute the keys with same g, into distinct slots.