File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change 3
3
// Thomas Wang's integer hash functions and inverse
4
4
// See https://naml.us/post/inverse-of-a-hash-function/
5
5
6
- static uint64_t wanghash64 (uint64_t key ) {
6
+ /* MSVC version 2022 makes some critical inline errors for the inverse hash
7
+ function */
8
+ #ifdef _MSC_VER
9
+ #define noinline __declspec(noinline)
10
+ #else
11
+ #define noinline
12
+ #endif
13
+
14
+ static noinline uint64_t wanghash64 (uint64_t key ) {
7
15
key = (~key ) + (key << 21 ); // key = (key << 21) - key - 1;
8
16
key = key ^ (key >> 24 );
9
17
key = (key + (key << 3 )) + (key << 8 ); // key * 265
@@ -15,7 +23,7 @@ static uint64_t wanghash64(uint64_t key) {
15
23
}
16
24
17
25
18
- static uint64_t wanghash64_inverse (uint64_t key ) {
26
+ static noinline uint64_t wanghash64_inverse (uint64_t key ) {
19
27
uint64_t tmp ;
20
28
21
29
// Invert key = key + (key << 31)
You can’t perform that action at this time.
0 commit comments