xxhash

xxHash: 快速的哈希函数

安装

meson 的 wrapDB 中有,所以只需要 meson wrap install xxhash

编译时使用 XXH_INLINE_ALL 选项提高性能,对于 meson 来说需要写 xxhash_dep = dependency('libxxhash', default_options: ['inline-all=true'])

基本使用

最快的哈希函数是 XXH3_64bits

   #include "xxhash.h"

   static inline
   XXH64_hash_t
   hash_func(int* key) {
       return XXH3_64bits(key, 2*sizeof(int));	
   }

评论

Comments powered by Disqus