fix mutex_trylock bug
[c11tester.git] / hashfunction.cc
index eca9cafa56ccd62826608a9f58c8870a63ce6e62..8cb1b6c95004862f056f705081c98733d5679f34 100644 (file)
@@ -1,10 +1,13 @@
 #include "hashfunction.h"
 
-/* Hash function for 64-bit integers */
+/**
+ * Hash function for 64-bit integers
+ * https://gist.github.com/badboy/6267743#64-bit-to-32-bit-hash-functions
+ */
 unsigned int int64_hash(uint64_t key) {
-       key = (~key) + (key << 18); // key = (key << 18) - key - 1;
+       key = (~key) + (key << 18);     // key = (key << 18) - key - 1;
        key = key ^ (key >> 31);
-       key = key * 21; // key = (key + (key << 2)) + (key << 4);
+       key = key * 21; // key = (key + (key << 2)) + (key << 4);
        key = key ^ (key >> 11);
        key = key + (key << 6);
        key = key ^ (key >> 22);