summaryrefslogtreecommitdiffstats
path: root/src/hash_map.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/hash_map.h')
-rw-r--r--src/hash_map.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/hash_map.h b/src/hash_map.h
index 0aac7d6..7cbd052 100644
--- a/src/hash_map.h
+++ b/src/hash_map.h
@@ -52,6 +52,15 @@ unsigned int MurmurHash2(const void* key, int len, unsigned int seed) {
return h;
}
+static size_t StlHash(StringPiece str) {
+ const char* p = str.str_;
+ int len = str.len_;
+ size_t hash = 0;
+ while (len--)
+ hash = 5 * hash + *p++;
+ return hash;
+}
+
#ifdef _MSC_VER
#include <hash_map>
@@ -83,7 +92,7 @@ struct hash<std::string> {
/// Hash functor for StringPiece.
struct ExternalStringHash {
size_t operator()(StringPiece key) const {
- return MurmurHash2(key.str_, key.len_, kSeed);
+ return StlHash(key);
}
};
#endif