Skip to content

Commit

Permalink
Fix pearsonbhash64 verification on 32-bit big-endian machine
Browse files Browse the repository at this point in the history
  • Loading branch information
darkk authored and rurban committed Aug 29, 2024
1 parent de06b48 commit 26fed3d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Hashes.h
Original file line number Diff line number Diff line change
Expand Up @@ -1321,7 +1321,8 @@ extern "C" {
#include "pearson_hash/pearsonb.h"
// objsize: 417b50-417dfb = 683
inline void pearsonb64_test ( const void * key, int len, uint32_t seed, void * out ) {
*(uint64_t*)out = pearsonb_hash_64 ((const uint8_t*)key, (size_t) len, (uint64_t) seed);
// pearsonb_hash_64(): caller is responsible for storing it the big endian way to memory
*(uint64_t*)out = htobe64(pearsonb_hash_64 ((const uint8_t*)key, (size_t) len, (uint64_t) seed));
}
// objsize: 41a1f0-41a65e: 1134
inline void pearsonb128_test ( const void * key, int len, uint32_t seed, void * out ) {
Expand Down
2 changes: 1 addition & 1 deletion main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ HashInfo g_hashes[] =
{ pearson256_test, 256, 0x7F8BEB21, "pearsonhash256", "Pearson hash, 256-bit SSSE3, low 64-bit", POOR, {}},
#endif
#ifdef HAVE_INT64
{ pearsonb64_test, 64, 0xB6FF2DFC, "pearsonbhash64", "Pearson block hash, 64-bit", GOOD, {}},
{ pearsonb64_test, 64, 0x14C3D184, "pearsonbhash64", "Pearson block hash, 64-bit", GOOD, {}},
{ pearsonb128_test, 128, 0x6BEFE6EA, "pearsonbhash128", "Pearson block hash, 128-bit, low 64-bit", GOOD, {}},
{ pearsonb256_test, 256, 0x999B3C19, "pearsonbhash256", "Pearson block hash, 256-bit, low 64-bit", GOOD, {}},
#endif
Expand Down

0 comments on commit 26fed3d

Please sign in to comment.