diff options
author | Jack Lloyd <[email protected]> | 2018-03-17 12:28:32 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2018-03-17 12:28:32 -0400 |
commit | 7e82d498da8a9da71f02a9d110c33c419cdc9b10 (patch) | |
tree | a6741b9ac04d6339813a9d713b7c57d8d1d8b07d /src/lib | |
parent | 004fd08a07452c6cf45fa96071a246ec2e30fcf4 (diff) |
Fix CPUID::has_cpuid_bit
It would return true if any bits were set instead of if all the bits
were set. It is only currently called with a single bit but that might
change in the future.
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/utils/cpuid/cpuid.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/lib/utils/cpuid/cpuid.h b/src/lib/utils/cpuid/cpuid.h index f37063a99..4c0f1668b 100644 --- a/src/lib/utils/cpuid/cpuid.h +++ b/src/lib/utils/cpuid/cpuid.h @@ -278,7 +278,9 @@ class BOTAN_PUBLIC_API(2,1) CPUID final { if(g_processor_features == 0) initialize(); - return ((g_processor_features & static_cast<uint64_t>(elem)) != 0); + + const uint64_t elem64 = static_cast<uint64_t>(elem); + return ((g_processor_features & elem64) == elem64); } static std::vector<CPUID::CPUID_bits> bit_from_string(const std::string& tok); |