5.4. Cuckoo hash table

The CUCKOO_HASH_TABLE module implements a cuckoo hash table data structure. Cuckoo hashing provides worst-case O(1) lookup time by using multiple hash functions and displacing existing entries on collision.

All functions and symbols are in “cuckoo_hash_table” module, use require to get access to it.

require daslib/cuckoo_hash_table

5.4.1. Type macros

cuckoo_hash_table.type macro TCuckooHashTable
Arguments:
  • ValueType (Type)

  • hashFunction0Name (String = “hash0”)

  • hashFunction1Name (String = “hash_extra”)

5.4.2. Hash functions

cuckoo_hash_table.hash0(data: auto): auto

this hash function converts and workhorse key to a 64 bit hash

Arguments:
  • data : auto

cuckoo_hash_table.hash_extra(data: auto): auto

Returns a secondary hash derived from the upper 32 bits of the primary hash, used for cuckoo hashing.

Arguments:
  • data : auto