Debian Codegraph @

basics.go

raw symbols SCIP
1 package farm
2
3 import "math/bits"
4
5 // Some primes between 2^63 and 2^64 for various uses.
6 const k0 uint64 = 0xc3a5c85c97cb3127
7 const k1 uint64 = 0xb492b66fbe98f273
8 const k2 uint64 = 0x9ae16a3b2f90404f
9
10 // Magic numbers for 32-bit hashing. Copied from Murmur3.
11 const c1 uint32 = 0xcc9e2d51
12 const c2 uint32 = 0x1b873593
13
14 // A 32-bit to 32-bit integer hash copied from Murmur3.
15 func fmix(h uint32) uint32 {
16 h ^= h >> 16
17 h *= 0x85ebca6b
18 h ^= h >> 13
19 h *= 0xc2b2ae35
20 h ^= h >> 16
21 return h
22 }
23
24 func mur(a, h uint32) uint32 {
25 // Helper from Murmur3 for combining two 32-bit values.
26 a *= c1
27 a = bits.RotateLeft32(a, -17)
28 a *= c2
29 h ^= a
30 h = bits.RotateLeft32(h, -19)
31 return h*5 + 0xe6546b64
32 }