summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTorne (Richard Coles) <torne@google.com>2012-11-16 11:52:43 +0000
committerTorne (Richard Coles) <torne@google.com>2012-11-16 11:52:43 +0000
commit37edc2709a1b38fe23da686ebad6266a6df23d40 (patch)
tree7cf7ea90234e4bf62e29ebdc65c6c9db19579c2b
parent7a0a5c88cda566cbe1c01aeea5cc256d7874e572 (diff)
parente813f9b95be7adad5a2e441f4484278c453e5261 (diff)
downloadsrc-37edc2709a1b38fe23da686ebad6266a6df23d40.tar.gz
Merge third_party/smhasher/src from http://git.chromium.org/external/smhasher.git at e813f9b95be7adad5a2e441f4484278c453e5261
This commit was generated by merge_from_chromium.py. Change-Id: I8e7730921277cfe612e33ed76d46df6669469078
-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
}