diff options
author | Daniel J Walsh <dwalsh@redhat.com> | 2022-05-02 17:16:10 -0400 |
---|---|---|
committer | Daniel J Walsh <dwalsh@redhat.com> | 2022-05-02 17:16:10 -0400 |
commit | e247f02a4fbf3997e4ff01eecf30ac1002e993af (patch) | |
tree | 2d287c16b9a80f888074af6b6118625d74da6a16 /vendor/github.com/klauspost/compress/internal/cpuinfo/cpuinfo.go | |
parent | 3ac5cec086e1ee1f11fabfd8a8f0aa8cf9f371f5 (diff) | |
download | podman-e247f02a4fbf3997e4ff01eecf30ac1002e993af.tar.gz podman-e247f02a4fbf3997e4ff01eecf30ac1002e993af.tar.bz2 podman-e247f02a4fbf3997e4ff01eecf30ac1002e993af.zip |
Vendor in containers/(common, storage, image)
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'vendor/github.com/klauspost/compress/internal/cpuinfo/cpuinfo.go')
-rw-r--r-- | vendor/github.com/klauspost/compress/internal/cpuinfo/cpuinfo.go | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/vendor/github.com/klauspost/compress/internal/cpuinfo/cpuinfo.go b/vendor/github.com/klauspost/compress/internal/cpuinfo/cpuinfo.go new file mode 100644 index 000000000..3954c5121 --- /dev/null +++ b/vendor/github.com/klauspost/compress/internal/cpuinfo/cpuinfo.go @@ -0,0 +1,34 @@ +// Package cpuinfo gives runtime info about the current CPU. +// +// This is a very limited module meant for use internally +// in this project. For more versatile solution check +// https://github.com/klauspost/cpuid. +package cpuinfo + +// HasBMI1 checks whether an x86 CPU supports the BMI1 extension. +func HasBMI1() bool { + return hasBMI1 +} + +// HasBMI2 checks whether an x86 CPU supports the BMI2 extension. +func HasBMI2() bool { + return hasBMI2 +} + +// DisableBMI2 will disable BMI2, for testing purposes. +// Call returned function to restore previous state. +func DisableBMI2() func() { + old := hasBMI2 + hasBMI2 = false + return func() { + hasBMI2 = old + } +} + +// HasBMI checks whether an x86 CPU supports both BMI1 and BMI2 extensions. +func HasBMI() bool { + return HasBMI1() && HasBMI2() +} + +var hasBMI1 bool +var hasBMI2 bool |