mirror of
https://codeberg.org/superseriousbusiness/gotosocial.git
synced 2024-12-22 17:10:20 +03:00
17 lines
391 B
Go
17 lines
391 B
Go
|
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))
|
||
|
}
|
||
|
}
|