What integer hash function are good that accepts an integer hash key?

前端 未结 11 1776
孤街浪徒
孤街浪徒 2020-11-22 17:23

What integer hash function are good that accepts an integer hash key?

11条回答
  •  北荒
    北荒 (楼主)
    2020-11-22 17:57

    • 32-bits multiplicative method (very fast) see @rafal

      #define hash32(x) ((x)*2654435761)
      #define H_BITS 24 // Hashtable size
      #define H_SHIFT (32-H_BITS)
      unsigned hashtab[1<> H_SHIFT
      
    • 32-bits and 64-bits (good distribution) at : MurmurHash

    • Integer Hash Function

提交回复
热议问题