MurmurHash3_x86_128 was missing a rotate instruction
git-svn-id: http://smhasher.googlecode.com/svn/trunk@58 77a7d1d3-4c08-bdc2-d393-d5859734b01a
diff --git a/MurmurHash3.cpp b/MurmurHash3.cpp
index 2942f10..c66bd87 100644
--- a/MurmurHash3.cpp
+++ b/MurmurHash3.cpp
@@ -196,6 +196,8 @@
h1 += h3;
h1 += h4;
+ h1 = _rotl(h1,17);
+
k2 *= c2;
k2 = _rotl(k2,11);
k2 *= c1;
diff --git a/main.cpp b/main.cpp
index 25d3c89..f5fcf04 100644
--- a/main.cpp
+++ b/main.cpp
@@ -42,6 +42,19 @@
bool g_testSeed = false;
//*/
+
+int64_t g_hashcount = 0;
+int64_t g_bytecount = 0;
+
+void counterhash ( const void * , const int len, const uint32_t , void * out )
+{
+ g_hashcount++;
+ g_bytecount += len;
+
+ *(uint32_t*)out = rand_u32();
+}
+
+
//-----------------------------------------------------------------------------
struct HashInfo
@@ -54,6 +67,7 @@
HashInfo g_hashes[] =
{
+ { counterhash, 32, "count", "Counts how many times the hash function is called" },
{ randhash_32, 32, "rand32", "Random number generator, 32-bit" },
{ randhash_64, 64, "rand64", "Random number generator, 64-bit" },
{ randhash_128, 128, "rand128", "Random number generator, 128-bit" },
@@ -387,6 +401,14 @@
//testHash("rand64");
//testHash("rand128");
+ //testHash("donothing");
+
+ //testHash("count");
+
+ //printf("Called the hash function %I64d times, %I64d bytes hashed\n",g_hashcount,g_bytecount);
+
+ //testHash("crc32");
+
//testHash("fnv");
//testHash("superfast");
//testHash("lookup3");