From 2d7d27722cf89525cef34d37dcb971c92aca0084 Mon Sep 17 00:00:00 2001 From: Stephen Seo Date: Mon, 4 Feb 2019 16:57:29 +0900 Subject: [PATCH] Add hash macro fn --- src/UDPC_Defines.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/UDPC_Defines.h b/src/UDPC_Defines.h index 77088e7..98dbe25 100644 --- a/src/UDPC_Defines.h +++ b/src/UDPC_Defines.h @@ -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 -- 2.49.0