diff --git a/include/CPUID.hpp b/include/CPUID.hpp index bbb2f374..e1f92471 100644 --- a/include/CPUID.hpp +++ b/include/CPUID.hpp @@ -85,7 +85,7 @@ bool run_CPUID_POPCNT() } /// Initialized at startup -const bool CPUID_POPCNT = run_CPUID_POPCNT(); +const bool HAS_CPUID_POPCNT = run_CPUID_POPCNT(); } // namespace diff --git a/include/popcnt.hpp b/include/popcnt.hpp index 6a1a65cc..d9dd50f5 100644 --- a/include/popcnt.hpp +++ b/include/popcnt.hpp @@ -62,7 +62,7 @@ inline uint64_t popcnt64(uint64_t x) // On my AMD EPYC 7642 CPU using GCC 12 this runtime // check incurs an overall overhead of about 1%. - if_likely(CPUID_POPCNT) + if_likely(HAS_CPUID_POPCNT) { __asm__("popcnt %1, %0" : "=r"(x) : "r"(x)); return x; @@ -77,7 +77,7 @@ inline uint64_t popcnt64(uint64_t x) } #elif defined(__i386__) - if_likely(CPUID_POPCNT) + if_likely(HAS_CPUID_POPCNT) { uint32_t x0 = uint32_t(x); uint32_t x1 = uint32_t(x >> 32); @@ -129,7 +129,7 @@ inline uint64_t popcnt64(uint64_t x) #if defined(HAS_POPCNT) return __popcnt64(x); #elif defined(ENABLE_CPUID_POPCNT) - if_likely(CPUID_POPCNT) + if_likely(HAS_CPUID_POPCNT) return __popcnt64(x); else return popcnt64_bitwise(x); @@ -154,7 +154,7 @@ inline uint64_t popcnt64(uint64_t x) return __popcnt(uint32_t(x)) + __popcnt(uint32_t(x >> 32)); #elif defined(ENABLE_CPUID_POPCNT) - if_likely(CPUID_POPCNT) + if_likely(HAS_CPUID_POPCNT) return __popcnt(uint32_t(x)) + __popcnt(uint32_t(x >> 32)); else diff --git a/test/CPUID.cpp b/test/CPUID.cpp index b12faa62..aa486891 100644 --- a/test/CPUID.cpp +++ b/test/CPUID.cpp @@ -44,7 +44,7 @@ int main() #endif #if defined(ENABLE_CPUID_POPCNT) - std::cout << "CPU supports POPCNT: " << (CPUID_POPCNT ? "yes" : "no") << std::endl; + std::cout << "CPU supports POPCNT: " << (HAS_CPUID_POPCNT ? "yes" : "no") << std::endl; #endif #endif