1// Copyright (c) 2020 Klaus Post, released under MIT License. See LICENSE file.
2
3package cpuid
4
5import "runtime"
6
7func detectOS(c *CPUInfo) bool {
8	// There are no hw.optional sysctl values for the below features on Mac OS 11.0
9	// to detect their supported state dynamically. Assume the CPU features that
10	// Apple Silicon M1 supports to be available as a minimal set of features
11	// to all Go programs running on darwin/arm64.
12	// TODO: Add more if we know them.
13	c.featureSet.setIf(runtime.GOOS != "ios", AESARM, PMULL, SHA1, SHA2)
14	c.PhysicalCores = runtime.NumCPU()
15	// For now assuming 1 thread per core...
16	c.ThreadsPerCore = 1
17	c.LogicalCores = c.PhysicalCores
18	return true
19}
20