Skip to content

Commit

Permalink
updated xxh3
Browse files Browse the repository at this point in the history
  • Loading branch information
Cyan4973 committed Mar 15, 2019
1 parent dedb30b commit f389d55
Show file tree
Hide file tree
Showing 3 changed files with 324 additions and 42 deletions.
15 changes: 15 additions & 0 deletions Hashes.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,21 @@ inline void xxh3high_test( const void * key, int len, uint32_t seed, void * out
*(uint32_t*)out = (uint32_t) (XXH3_64b(key, (size_t) len) >> 32);
}

inline void xxh128_test( const void * key, int len, uint32_t seed, void * out ) {
(void)seed;
*(XXH128_hash_t*)out = XXH128(key, (size_t) len, seed);
}

inline void xxh128low_test( const void * key, int len, uint32_t seed, void * out ) {
(void)seed;
*(uint64_t*)out = (uint64_t) (XXH128(key, (size_t) len, seed).ll1);
}

inline void xxh128high_test( const void * key, int len, uint32_t seed, void * out ) {
(void)seed;
*(uint64_t*)out = (uint64_t) (XXH128(key, (size_t) len, seed).ll2);
}


inline void metrohash64_1_test ( const void * key, int len, uint32_t seed, void * out ) {
metrohash64_1((const uint8_t *)key,(uint64_t)len,seed,(uint8_t *)out);
Expand Down
8 changes: 6 additions & 2 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,9 @@ HashInfo g_hashes[] =
{ xxh3_test, 64, 0xECA5AAE7, "xxh3", "xxHash v3, 64-bit" },
{ xxh3low_test, 32, 0xECA5AAE7, "xxh3low", "xxHash v3, 64-bit, low 32-bits part" },
{ xxh3high_test, 32, 0xECA5AAE7, "xxh3high", "xxHash v3, 64-bit, high 32-bits part" },
{ xxh128_test, 128, 0xECA5AAE7, "xxh128", "xxHash v3, 128-bit" },
{ xxh128low_test, 64, 0xECA5AAE7, "xxh128low", "xxHash v3, 128-bit, low 64-bits part" },
{ xxh128high_test, 64, 0xECA5AAE7, "xxh128high", "xxHash v3, 128-bit, high 64-bits part" },
#if 0
{ xxhash256_test, 64, 0x024B7CF4, "xxhash256", "xxhash256, 64-bit unportable" },
#endif
Expand Down Expand Up @@ -388,8 +391,9 @@ void test ( hashfunc<hashtype> hash, HashInfo* info )
bool result = true;
bool drawDiagram = false;

result &= SparseKeyTest< 24,hashtype>(hash,7,true,true,true,drawDiagram);
result &= SparseKeyTest< 32,hashtype>(hash,6,true,true,true,drawDiagram);
result &= SparseKeyTest< 16,hashtype>(hash,9,true,true,true,drawDiagram);
result &= SparseKeyTest< 24,hashtype>(hash,8,true,true,true,drawDiagram);
result &= SparseKeyTest< 32,hashtype>(hash,7,true,true,true,drawDiagram);
result &= SparseKeyTest< 40,hashtype>(hash,6,true,true,true,drawDiagram);
result &= SparseKeyTest< 48,hashtype>(hash,6,true,true,true,drawDiagram);
result &= SparseKeyTest< 56,hashtype>(hash,5,true,true,true,drawDiagram);
Expand Down
Loading

0 comments on commit f389d55

Please sign in to comment.