...
Source file
src/internal/cpu/cpu_arm64_darwin.go
1
2
3
4
5
6
7 package cpu
8
9 func osInit() {
10 ARM64.HasATOMICS = sysctlEnabled([]byte("hw.optional.armv8_1_atomics\x00"))
11 ARM64.HasCRC32 = sysctlEnabled([]byte("hw.optional.armv8_crc32\x00"))
12 ARM64.HasSHA512 = sysctlEnabled([]byte("hw.optional.armv8_2_sha512\x00"))
13
14
15
16
17
18 ARM64.HasAES = true
19 ARM64.HasPMULL = true
20 ARM64.HasSHA1 = true
21 ARM64.HasSHA2 = true
22 }
23
24
25 func getsysctlbyname(name []byte) (int32, int32)
26
27 func sysctlEnabled(name []byte) bool {
28 ret, value := getsysctlbyname(name)
29 if ret < 0 {
30 return false
31 }
32 return value > 0
33 }
34
View as plain text