diff options
author | Jack Lloyd <[email protected]> | 2017-09-16 12:17:54 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2017-09-16 12:17:54 -0400 |
commit | e3f2528713840b128ab7645ef826f331ad7cbb29 (patch) | |
tree | d49fed2fdfad126d333188fb5f821e1ff8e93fd3 /src/cli/speed.cpp | |
parent | 5ca7d7d15d410ddd07acedcafa53cb7c6f40d45b (diff) |
Merge duplicated logic for clearing CPUID bits
Diffstat (limited to 'src/cli/speed.cpp')
-rw-r--r-- | src/cli/speed.cpp | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/src/cli/speed.cpp b/src/cli/speed.cpp index 99e4c157f..e53c3e785 100644 --- a/src/cli/speed.cpp +++ b/src/cli/speed.cpp @@ -1,5 +1,5 @@ /* -* (C) 2009,2010,2014,2015 Jack Lloyd +* (C) 2009,2010,2014,2015,2017 Jack Lloyd * (C) 2015 Simon Warta (Kullo GmbH) * * Botan is released under the Simplified BSD License (see license.txt) @@ -677,14 +677,10 @@ class Speed final : public Command for(std::string cpuid_to_clear : Botan::split_on(get_arg("clear-cpuid"), ',')) { -#if defined(BOTAN_TARGET_CPU_IS_X86_FAMILY) - if(cpuid_to_clear == "avx2") - Botan::CPUID::clear_cpuid_bit(Botan::CPUID::CPUID_AVX2_BIT); - else if(cpuid_to_clear == "sse2") - Botan::CPUID::clear_cpuid_bit(Botan::CPUID::CPUID_SSE2_BIT); - else if(cpuid_to_clear == "sha") - Botan::CPUID::clear_cpuid_bit(Botan::CPUID::CPUID_SHA_BIT); -#endif + for(auto bit : Botan::CPUID::bit_from_string(cpuid_to_clear)) + { + Botan::CPUID::clear_cpuid_bit(bit); + } } const bool using_defaults = (algos.empty()); |