Source file
src/crypto/sha1/sha1block_amd64.go
1
2
3
4
5
6
7 package sha1
8
9 import "internal/cpu"
10
11
12 func blockAVX2(dig *digest, p []byte)
13
14
15 func blockAMD64(dig *digest, p []byte)
16
17 var useAVX2 = cpu.X86.HasAVX2 && cpu.X86.HasBMI1 && cpu.X86.HasBMI2
18
19 func block(dig *digest, p []byte) {
20 if useAVX2 && len(p) >= 256 {
21
22
23
24
25
26
27 safeLen := len(p) - 128
28 if safeLen%128 != 0 {
29 safeLen -= 64
30 }
31 blockAVX2(dig, p[:safeLen])
32 blockAMD64(dig, p[safeLen:])
33 } else {
34 blockAMD64(dig, p)
35 }
36 }
37
View as plain text