From 7e82d498da8a9da71f02a9d110c33c419cdc9b10 Mon Sep 17 00:00:00 2001 From: Jack Lloyd Date: Sat, 17 Mar 2018 12:28:32 -0400 Subject: 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. --- src/lib/utils/cpuid/cpuid.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/lib') 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(elem)) != 0); + + const uint64_t elem64 = static_cast(elem); + return ((g_processor_features & elem64) == elem64); } static std::vector bit_from_string(const std::string& tok); -- cgit v1.2.3