...
Source file
src/hash/crc32/crc32_arm64.go
1
2
3
4
5
6
7
8
9 package crc32
10
11 import "internal/cpu"
12
13 func castagnoliUpdate(crc uint32, p []byte) uint32
14 func ieeeUpdate(crc uint32, p []byte) uint32
15
16 func archAvailableCastagnoli() bool {
17 return cpu.ARM64.HasCRC32
18 }
19
20 func archInitCastagnoli() {
21 if !cpu.ARM64.HasCRC32 {
22 panic("arch-specific crc32 instruction for Castagnoli not available")
23 }
24 }
25
26 func archUpdateCastagnoli(crc uint32, p []byte) uint32 {
27 if !cpu.ARM64.HasCRC32 {
28 panic("arch-specific crc32 instruction for Castagnoli not available")
29 }
30
31 return ^castagnoliUpdate(^crc, p)
32 }
33
34 func archAvailableIEEE() bool {
35 return cpu.ARM64.HasCRC32
36 }
37
38 func archInitIEEE() {
39 if !cpu.ARM64.HasCRC32 {
40 panic("arch-specific crc32 instruction for IEEE not available")
41 }
42 }
43
44 func archUpdateIEEE(crc uint32, p []byte) uint32 {
45 if !cpu.ARM64.HasCRC32 {
46 panic("arch-specific crc32 instruction for IEEE not available")
47 }
48
49 return ^ieeeUpdate(^crc, p)
50 }
51
View as plain text