Skip to content

Commit

Permalink
polymur: add missing polymur_seed_init() call
Browse files Browse the repository at this point in the history
It fixes arm builds, including macos-14-arm64

polymur Verification value 0xA612032C means that polymur_seed_init()
was not called. Currently, polymur is compiled in unconditionally,
so it should be initialized unconditionally as well.

See rurban#294, rurban#296, rurban#297, rurban#298 and rurban#299.
  • Loading branch information
darkk committed Sep 27, 2024
1 parent 42622ed commit 9d52b78
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
5 changes: 3 additions & 2 deletions Hashes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1341,11 +1341,12 @@ void khashv32_test ( const void *key, int len, uint32_t seed, void *out) {
}
#endif // HAVE_KHASHV

PolymurHashParams g_polymurhashparams = {
#include "polymur-hash/polymur-hash.h"
static PolymurHashParams g_polymurhashparams = {
UINT64_C(2172266433527442278), UINT64_C(706663945032637854),
UINT64_C(754693428422558902), UINT64_C(9067629717964434866)
};
void polymur_seed_init (size_t &seed) {
void polymur_seed_init (size_t seed) {
polymur_init_params_from_seed(&g_polymurhashparams,
UINT64_C(0xfedbca9876543210) ^ seed);
}
Expand Down
5 changes: 1 addition & 4 deletions Hashes.h
Original file line number Diff line number Diff line change
Expand Up @@ -1396,12 +1396,9 @@ void khashv32_test ( const void *key, int len, uint32_t seed, void *out);
void khashv64_test ( const void *key, int len, uint32_t seed, void *out);
#endif

#include "polymur-hash/polymur-hash.h"
extern PolymurHashParams g_polymurhashparams;
void polymur_seed_init (size_t &seed);
void polymur_seed_init (size_t seed);
void polymur_test ( const void *key, int len, uint32_t seed, void *out);


/* This version of CRC64 can approach HW crc speeds without hardware support,
and can be applied to any polynomial. */
#include "crc64.h"
Expand Down
4 changes: 2 additions & 2 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -939,13 +939,13 @@ bool Hash_Seed_init (pfHash hash, size_t seed) {
else if(hash == hashx_test)
hashx_seed_init(info, seed);
*/
else if(hash == polymur_test)
polymur_seed_init(seed);
# ifdef HAVE_KHASHV
else if(hash == khashv64_test || hash == khashv32_test)
khashv_seed_init(seed);
# endif
#endif
else if(hash == polymur_test)
polymur_seed_init(seed);
else
return false;
return true;
Expand Down

0 comments on commit 9d52b78

Please sign in to comment.