You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
391 B
17 lines
391 B
1 year ago
|
package base64x
|
||
|
|
||
|
import (
|
||
|
`fmt`
|
||
|
`os`
|
||
|
|
||
|
`github.com/klauspost/cpuid/v2`
|
||
|
)
|
||
|
|
||
|
func hasAVX2() bool {
|
||
|
switch v := os.Getenv("B64X_MODE"); v {
|
||
|
case "" : fallthrough
|
||
|
case "auto" : return cpuid.CPU.Has(cpuid.AVX2)
|
||
|
case "noavx2" : return false
|
||
|
default : panic(fmt.Sprintf("invalid mode: '%s', should be one of 'auto', 'noavx2'", v))
|
||
|
}
|
||
|
}
|