|
4 | 4 |
|
5 | 5 | #include "textflag.h" |
6 | 6 |
|
7 | | -// func MemHash32(p unsafe.Pointer, h uintptr) uintptr |
8 | | -// ABIInternal for performance. |
9 | | -TEXT ·MemHash32<ABIInternal>(SB),NOSPLIT,$0-24 |
10 | | - // AX = ptr to data |
11 | | - // BX = seed |
12 | | - CMPB ·UseAeshash(SB), $0 |
13 | | - JEQ noaes |
14 | | - MOVQ BX, X0 // X0 = seed |
15 | | - PINSRD $2, (AX), X0 // data |
16 | | - AESENC ·aeskeysched+0(SB), X0 |
17 | | - AESENC ·aeskeysched+16(SB), X0 |
18 | | - AESENC ·aeskeysched+32(SB), X0 |
19 | | - MOVQ X0, AX // return X0 |
20 | | - RET |
21 | | -noaes: |
22 | | - JMP ·memHash32Fallback<ABIInternal>(SB) |
23 | | - |
24 | | -// func MemHash64(p unsafe.Pointer, h uintptr) uintptr |
25 | | -// ABIInternal for performance. |
26 | | -TEXT ·MemHash64<ABIInternal>(SB),NOSPLIT,$0-24 |
27 | | - // AX = ptr to data |
28 | | - // BX = seed |
29 | | - CMPB ·UseAeshash(SB), $0 |
30 | | - JEQ noaes |
31 | | - MOVQ BX, X0 // X0 = seed |
32 | | - PINSRQ $1, (AX), X0 // data |
33 | | - AESENC ·aeskeysched+0(SB), X0 |
34 | | - AESENC ·aeskeysched+16(SB), X0 |
35 | | - AESENC ·aeskeysched+32(SB), X0 |
36 | | - MOVQ X0, AX // return X0 |
37 | | - RET |
38 | | -noaes: |
39 | | - JMP ·memHash64Fallback<ABIInternal>(SB) |
40 | | - |
41 | | -// func MemHash(p unsafe.Pointer, h, s uintptr) uintptr |
| 7 | +// func memHashAES(p unsafe.Pointer, h, s uintptr) uintptr |
42 | 8 | // hash function using AES hardware instructions |
43 | | -TEXT ·MemHash<ABIInternal>(SB),NOSPLIT,$0-32 |
| 9 | +TEXT ·memHashAES<ABIInternal>(SB),NOSPLIT,$0-32 |
44 | 10 | // AX = ptr to data |
45 | 11 | // BX = seed |
46 | 12 | // CX = size |
47 | | - CMPB ·UseAeshash(SB), $0 |
48 | | - JEQ noaes |
49 | 13 | JMP ·aeshashbody<>(SB) |
50 | | -noaes: |
51 | | - JMP ·memHashFallback<ABIInternal>(SB) |
52 | 14 |
|
53 | | -// func strhash(p unsafe.Pointer, h uintptr) uintptr |
54 | | -TEXT ·StrHash<ABIInternal>(SB),NOSPLIT,$0-24 |
| 15 | +// func strhashAES(p unsafe.Pointer, h uintptr) uintptr |
| 16 | +TEXT ·strHashAES<ABIInternal>(SB),NOSPLIT,$0-24 |
55 | 17 | // AX = ptr to string struct |
56 | 18 | // BX = seed |
57 | | - CMPB ·UseAeshash(SB), $0 |
58 | | - JEQ noaes |
59 | 19 | MOVQ 8(AX), CX // length of string |
60 | 20 | MOVQ (AX), AX // string data |
61 | 21 | JMP ·aeshashbody<>(SB) |
62 | | -noaes: |
63 | | - JMP ·strHashFallback<ABIInternal>(SB) |
64 | 22 |
|
65 | 23 | // AX: data |
66 | 24 | // BX: hash seed |
|
0 commit comments