]> git.seodisparate.com - UDPConnection/commitdiff
Add hash macro fn
authorStephen Seo <seo.disparate@gmail.com>
Mon, 4 Feb 2019 07:57:29 +0000 (16:57 +0900)
committerStephen Seo <seo.disparate@gmail.com>
Mon, 4 Feb 2019 07:57:29 +0000 (16:57 +0900)
src/UDPC_Defines.h

index 77088e7d7381fcd4e0407e3e82349b6b766faf7a..98dbe25dded389e2e24a2e477e5d4269916aaffe 100644 (file)
@@ -49,4 +49,18 @@ static const char *UDPC_ERR_THREADFAIL_STR = "Failed to create thread";
 
 #define UDPC_PACKET_MAX_SIZE 8192
 
+// 5 8 2 7 3 6 1
+// 3 2 5 1 8 7 6
+#define UDPC_HASH32(x) ( \
+    ( \
+      ((x & 0xF8000000) >> 5) \
+      ((x & 0x07F80000) >> 6) \
+      ((x & 0x00060000) << 10) \
+      ((x & 0x0001FC00) >> 4) \
+      ((x & 0x00000380) << 22) \
+      ((x & 0x0000007E) >> 1) \
+      ((x & 0x00000001) << 21) \
+    ) ^ 0x96969696 \
+)
+
 #endif