Skip to content

Commit

Permalink
fix aesni-hash-peterrk for MSVC
Browse files Browse the repository at this point in the history
  • Loading branch information
rurban committed Dec 15, 2024
1 parent dcb04a4 commit f1afb51
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Hashes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1366,6 +1366,6 @@ void polymur_test ( const void *key, int len, uint32_t seed, void *out) {
(uint64_t)seed);
}

#if defined(HAVE_SSE2) && defined(HAVE_AESNI) && !defined(_MSC_VER)
#if defined(HAVE_SSE2) && defined(HAVE_AESNI)
#include "aesnihash-peterrk.hpp"
#endif
4 changes: 3 additions & 1 deletion Hashes.h
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,6 @@ inline void t1ha0_ia32aes_noavx_test(const void * key, int len, uint32_t seed, v
// objsize 0-39d: 925
*(uint64_t*)out = t1ha0_ia32aes_noavx(key, len, seed);
}
void aesnihash_peterrk(const void * in, int len0, uint32_t seed, void * out);
#endif
#if defined(__AVX__)
inline void t1ha0_ia32aes_avx1_test(const void * key, int len, uint32_t seed, void * out)
Expand Down Expand Up @@ -1425,3 +1424,6 @@ extern "C" void crc64_jones_test2(const void *input, int len, uint32_t seed, voi
extern "C" void crc64_jones_test3(const void *input, int len, uint32_t seed, void *out);
extern "C" void crc64_jones_default(const void *input, int len, uint32_t seed, void *out);

#if defined(HAVE_SSE2) && defined(HAVE_AESNI)
void aesnihash_peterrk(const void * in, int len0, uint32_t seed, void * out);
#endif
10 changes: 10 additions & 0 deletions aesnihash-peterrk.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,21 @@ void aesnihash_peterrk(const void * in, int len0, uint32_t seed, void * out) {
case 11: mix(GREEDILY_READ(11, msg)); break;
case 10: mix(GREEDILY_READ(10, msg)); break;
case 9: mix(GREEDILY_READ(9, msg)); break;
#ifndef _MSC_VER
case 8: mix((__m128i)_mm_load_sd((const double *)msg)); break;
#else
// MSVC cannot copy __m128d -> __m128i
case 8: mix(GREEDILY_READ(7, msg)); break;
#endif
case 7: mix(GREEDILY_READ(7, msg)); break;
case 6: mix(GREEDILY_READ(6, msg)); break;
case 5: mix(GREEDILY_READ(5, msg)); break;
#ifndef _MSC_VER
case 4: mix((__m128i)_mm_load_ss((const float *)msg)); break;
#else
// MSVC cannot copy __m128 -> __m128i
case 4: mix(GREEDILY_READ(4, msg)); break;
#endif
case 3: mix(GREEDILY_READ(3, msg)); break;
case 2: mix(GREEDILY_READ(2, msg)); break;
case 1: mix(GREEDILY_READ(1, msg)); break;
Expand Down
4 changes: 3 additions & 1 deletion main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -385,10 +385,12 @@ HashInfo g_hashes[] =
#if defined(HAVE_SSE2) && defined(HAVE_AESNI) && !defined(_MSC_VER)
{ aesnihash_test, 64, 0xA68E0D42, "aesnihash", "majek's seeded aesnihash with aesenc, 64-bit for x64", POOR,
{0x70736575} },
{ aesnihash_peterrk, 128, 0xF06DA1B1, "aesni-hash-peterrk", "PeterRK's seeded aesnihash with aesenc, 128-bit for x64", GOOD, {} },
{ aesni128_test, 128, 0xF06DA1B1, "aesni", "aesni 128bit", GOOD,{} },
{ aesni64_test, 64, 0x3AA1A480, "aesni-low","aesni 64bit", GOOD,{} },
#endif
#if defined(HAVE_SSE2) && defined(HAVE_AESNI)
{ aesnihash_peterrk, 128, 0xF06DA1B1, "aesni-hash-peterrk", "PeterRK's seeded aesnihash with aesenc, 128-bit for x64", GOOD, {} },
#endif
#if defined(HAVE_SSE2) && defined(__x86_64__) && !defined(_WIN32) && !defined(_MSC_VER)
{ falkhash_test_cxx, 64, 0x2F99B071, "falkhash", "falkhash.asm with aesenc, 64-bit for x64", POOR, {} },
#endif
Expand Down

0 comments on commit f1afb51

Please sign in to comment.