Index: src/utils.cc |
=================================================================== |
--- src/utils.cc (revision 1984) |
+++ src/utils.cc (working copy) |
@@ -86,6 +86,20 @@ |
} |
+// Thomas Wang, Integer Hash Functions. |
+// http://www.concentric.net/~Ttwang/tech/inthash.htm |
+uint32_t ComputeIntegerHash(uint32_t key) { |
+ uint32_t hash = key; |
+ hash = ~hash + (hash << 15); // hash = (hash << 15) - hash - 1; |
+ hash = hash ^ (hash >> 12); |
+ hash = hash + (hash << 2); |
+ hash = hash ^ (hash >> 4); |
+ hash = hash * 2057; // hash = (hash + (hash << 3)) + (hash << 11); |
+ hash = hash ^ (hash >> 16); |
+ return hash; |
+} |
+ |
+ |
void PrintF(const char* format, ...) { |
va_list arguments; |
va_start(arguments, format); |