Skip to content

Commit

Permalink
clang fixups, halftime-hash regression
Browse files Browse the repository at this point in the history
  • Loading branch information
rurban committed Aug 19, 2022
1 parent 9a5e665 commit 032faca
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 10 deletions.
6 changes: 3 additions & 3 deletions KeysetTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -885,10 +885,10 @@ bool ZeroKeyTest ( pfHash hash, bool drawDiagram )
// Keyset 'Seed' - hash "the quick brown fox..." using different seeds

template < typename hashtype >
bool SeedTest ( pfHash hash, int keycount, bool drawDiagram )
bool SeedTest ( pfHash hash, size_t keycount, bool drawDiagram )
{
printf("Keyset 'Seed' - %d keys\n",keycount);
assert(keycount < (1<<31));
printf("Keyset 'Seed' - %d keys\n", keycount);
assert(keycount < 2147483648U /*(1U<<31)*/);

const char text[64] = "The quick brown fox jumps over the lazy dog";
const int len = (int)strlen(text);
Expand Down
4 changes: 2 additions & 2 deletions halftime-hash.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,7 @@ struct RepeatWrapper {
using Block = Repeat<InnerBlock, count>;

static Block LoadOne(uint64_t entropy) {
alignas(16) Block result;
alignas(64) Block result;
for (unsigned i = 0; i < count; ++i) {
result.it[i] = InnerBlockWrapper::LoadOne(entropy);
}
Expand All @@ -798,7 +798,7 @@ struct RepeatWrapper {

static Block LoadBlock(const void* x) {
auto y = reinterpret_cast<const char*>(x);
alignas(16) Block result;
alignas(64) Block result;
for (unsigned i = 0; i < count; ++i) {
result.it[i] = InnerBlockWrapper::LoadBlock(y + i * sizeof(InnerBlock));
}
Expand Down
15 changes: 11 additions & 4 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,7 @@ HashInfo g_hashes[] =
{ CityHashCrc128_test, 128, 0xD4389C97, "CityCrc128", "Google CityHashCrc128WithSeed SSE4.2 (old)", GOOD, {} },
#endif

#if defined(__FreeBSD__)
#if defined(__FreeBSD__) || defined(HAVE_ASAN)
# define FARM64_VERIF 0x0
# define FARM128_VERIF 0x0
#else
Expand Down Expand Up @@ -736,8 +736,15 @@ HashInfo g_hashes[] =
{ nmhash32_test, 32, 0x12A30553, "nmhash32", "nmhash32", GOOD, {}},
{ nmhash32x_test, 32, 0xA8580227, "nmhash32x", "nmhash32x", GOOD, {}},
#ifndef HAVE_BIT32
{ khashv32_test, 32, 0x9A8F7952, "k-hashv32", "Vectorized K-HashV, 32-bit", GOOD, {}},
{ khashv64_test, 64, 0x90A2A4F9, "k-hashv64", "Vectorized K-HashV, 64-bit", GOOD, {}},
#ifdef __clang__ // also gcc 9.4
#define KHASHV32_VERIF 0xB69DF8EB
#define KHASHV64_VERIF 0xA6B7E55B
#else // new gcc-11
#define KHASHV32_VERIF 0 /* 0x9A8F7952 */
#define KHASHV64_VERIF 0 /* 0X90A2A4F9 */
#endif
{ khashv32_test, 32, KHASHV32_VERIF, "k-hashv32", "Vectorized K-HashV, 32-bit", GOOD, {}},
{ khashv64_test, 64, KHASHV64_VERIF, "k-hashv64", "Vectorized K-HashV, 64-bit", GOOD, {}},
#endif
};

Expand Down Expand Up @@ -1653,7 +1660,7 @@ void test ( hashfunc<hashtype> hash, HashInfo* info )

bool result = true;

result &= SeedTest<hashtype>( hash, 5000000, g_drawDiagram );
result &= SeedTest<hashtype>( hash, 5000000U, g_drawDiagram );

if(!result) printf("*********FAIL*********\n");
printf("\n");
Expand Down
2 changes: 1 addition & 1 deletion pearson_hash/pearson.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ void pearson_hash_256 (uint8_t *out, const uint8_t *in, size_t len) {
__m128i hash_mask = _mm_set_epi64 ((__m64)lower_hash_mask, (__m64)upper_hash_mask);
__m128i high_hash_mask = _mm_xor_si128 (tmp, hash_mask);
__m128i hash= _mm_setzero_si128();
__m128i high_hash= _mm_setzero_si128(); hash;
__m128i high_hash= _mm_setzero_si128();

// table lookup preparation
#if defined (__AES__) // AES-NI -------------
Expand Down

0 comments on commit 032faca

Please sign in to comment.