gotosocial/vendor/github.com/chenzhuoyu/base64x/cpuid.go
dependabot[bot] 66b77acb1c
[chore]: Bump github.com/gin-contrib/cors from 1.4.0 to 1.5.0 (#2388)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-27 13:15:03 +00:00

18 lines
392 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))
}
}