summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortanjent@gmail.com <tanjent@gmail.com@77a7d1d3-4c08-bdc2-d393-d5859734b01a>2012-05-11 06:19:58 +0000
committertanjent@gmail.com <tanjent@gmail.com@77a7d1d3-4c08-bdc2-d393-d5859734b01a>2012-05-11 06:19:58 +0000
commite813f9b95be7adad5a2e441f4484278c453e5261 (patch)
tree7cf7ea90234e4bf62e29ebdc65c6c9db19579c2b
parent6895dced6534c9a041ceba5cabed231d3b2d8518 (diff)
downloadsrc-e813f9b95be7adad5a2e441f4484278c453e5261.tar.gz
Minor fixes & tweaks.
git-svn-id: http://smhasher.googlecode.com/svn/trunk@147 77a7d1d3-4c08-bdc2-d393-d5859734b01a
-rw-r--r--KeysetTest.cpp3
-rw-r--r--MurmurHash3.cpp16
-rw-r--r--Platform.h8
3 files changed, 15 insertions, 12 deletions
diff --git a/KeysetTest.cpp b/KeysetTest.cpp
index 148b065..7077277 100644
--- a/KeysetTest.cpp
+++ b/KeysetTest.cpp
@@ -146,6 +146,9 @@ bool SanityTest ( pfHash hash, const int hashbits )
printf("PASS\n");
}
+ delete [] buffer1;
+ delete [] buffer2;
+
delete [] hash1;
delete [] hash2;
diff --git a/MurmurHash3.cpp b/MurmurHash3.cpp
index 09ffb26..302e974 100644
--- a/MurmurHash3.cpp
+++ b/MurmurHash3.cpp
@@ -99,8 +99,8 @@ void MurmurHash3_x86_32 ( const void * key, int len,
uint32_t h1 = seed;
- uint32_t c1 = 0xcc9e2d51;
- uint32_t c2 = 0x1b873593;
+ const uint32_t c1 = 0xcc9e2d51;
+ const uint32_t c2 = 0x1b873593;
//----------
// body
@@ -158,10 +158,10 @@ void MurmurHash3_x86_128 ( const void * key, const int len,
uint32_t h3 = seed;
uint32_t h4 = seed;
- uint32_t c1 = 0x239b961b;
- uint32_t c2 = 0xab0e9789;
- uint32_t c3 = 0x38b34ae5;
- uint32_t c4 = 0xa1e38b93;
+ const uint32_t c1 = 0x239b961b;
+ const uint32_t c2 = 0xab0e9789;
+ const uint32_t c3 = 0x38b34ae5;
+ const uint32_t c4 = 0xa1e38b93;
//----------
// body
@@ -261,8 +261,8 @@ void MurmurHash3_x64_128 ( const void * key, const int len,
uint64_t h1 = seed;
uint64_t h2 = seed;
- uint64_t c1 = BIG_CONSTANT(0x87c37b91114253d5);
- uint64_t c2 = BIG_CONSTANT(0x4cf5ad432745937f);
+ const uint64_t c1 = BIG_CONSTANT(0x87c37b91114253d5);
+ const uint64_t c2 = BIG_CONSTANT(0x4cf5ad432745937f);
//----------
// body
diff --git a/Platform.h b/Platform.h
index fcb68e8..8de26be 100644
--- a/Platform.h
+++ b/Platform.h
@@ -76,13 +76,13 @@ __inline__ unsigned long long int rdtsc()
unsigned int a, d;
__asm__ volatile ("rdtsc" : "=a" (a), "=d" (d));
return (unsigned long)a | ((unsigned long)d << 32);
-#else
-#ifndef __i386__
-#error Must be x86 either 32-bit or 64-bit.
-#endif
+#elif defined(__i386__)
unsigned long long int x;
__asm__ volatile ("rdtsc" : "=A" (x));
return x;
+#else
+#define NO_CYCLE_COUNTER
+ return 0;
#endif
}