fixbug: Apple Silicon build fail.

This commit is contained in:
甲鲲 2024-03-06 21:21:25 +08:00
parent 7fee50dfe9
commit 8fc2696d46
2 changed files with 17 additions and 13 deletions

View File

@ -1,6 +1,20 @@
package cpuid package cpuid
import "golang.org/x/sys/cpu" import (
"runtime"
var HasAES = cpu.ARM64.HasAES "golang.org/x/sys/cpu"
var HasGFMUL = cpu.ARM64.HasPMULL )
var HasAES = false
var HasGFMUL = false
func init() {
if runtime.GOOS == "darwin/arm64" {
HasAES = true
HasGFMUL = true
} else {
HasAES = cpu.ARM64.HasAES
HasGFMUL = cpu.ARM64.HasPMULL
}
}

View File

@ -1,10 +0,0 @@
//go:build arm64 && darwin && !ios
package cpuid
// There are no hw.optional sysctl values for the below features on Mac OS 11.0
// to detect their supported state dynamically. Assume the CPU features that
// Apple Silicon M1 supports to be available as a minimal set of features
// to all Go programs running on darwin/arm64.
var HasAES = true
var HasGFMUL = true