1
2
3
4
5
6
7 package maps
8
9 import (
10 "simd/archsimd"
11 "unsafe"
12 )
13
14 const memHashUsesVAES = true
15
16 func memHash32AES(p unsafe.Pointer, seed uintptr) uintptr {
17 var state archsimd.Uint64x2
18 state = state.SetElem(0, uint64(seed)).SetElem(1, uint64(*(*uint32)(p)))
19
20 hash := state.
21 AsUint8x16().
22 AESEncryptOneRound(archsimd.LoadUint32x4((*[4]uint32)(unsafe.Pointer(&aeskeysched[0])))).
23 AESEncryptOneRound(archsimd.LoadUint32x4((*[4]uint32)(unsafe.Pointer(&aeskeysched[16])))).
24 AESEncryptOneRound(archsimd.LoadUint32x4((*[4]uint32)(unsafe.Pointer(&aeskeysched[32])))).
25 AsUint64x2().
26 GetElem(0)
27 return uintptr(hash)
28 }
29
30 func memHash64AES(p unsafe.Pointer, seed uintptr) uintptr {
31 var state archsimd.Uint64x2
32 state = state.SetElem(0, uint64(seed)).SetElem(1, *(*uint64)(p))
33
34 hash := state.
35 AsUint8x16().
36 AESEncryptOneRound(archsimd.LoadUint32x4((*[4]uint32)(unsafe.Pointer(&aeskeysched[0])))).
37 AESEncryptOneRound(archsimd.LoadUint32x4((*[4]uint32)(unsafe.Pointer(&aeskeysched[16])))).
38 AESEncryptOneRound(archsimd.LoadUint32x4((*[4]uint32)(unsafe.Pointer(&aeskeysched[32])))).
39 AsUint64x2().
40 GetElem(0)
41 return uintptr(hash)
42 }
43
44
45
46
47
48
49 func memHashAES(p unsafe.Pointer, h, s uintptr) uintptr
50
51
52 func strHashAES(p unsafe.Pointer, h uintptr) uintptr
53
View as plain text