From d06ff7a7e83b5df41a4679556724a867c9c16dc3 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Sun, 22 Feb 2015 06:31:55 -0800 Subject: [PATCH] Fix internal::clzll on Win64 --- format.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/format.h b/format.h index 47f77da2..03ed6853 100644 --- a/format.h +++ b/format.h @@ -56,18 +56,18 @@ inline uint32_t clz(uint32_t x) { return 31 - r; } # define FMT_BUILTIN_CLZ(n) fmt::internal::clz(n) -inline uint32_t clzll(uint64_t n) { +inline uint32_t clzll(uint64_t x) { unsigned long r = 0; # ifdef _WIN64 # pragma intrinsic(_BitScanReverse64) _BitScanReverse64(&r, x); # else // Scan the high 32 bits. - if (_BitScanReverse(&r, static_cast(n >> 32))) + if (_BitScanReverse(&r, static_cast(x >> 32))) return 63 - (r + 32); // Scan the low 32 bits. - _BitScanReverse(&r, static_cast(n)); + _BitScanReverse(&r, static_cast(x)); # endif return 63 - r; }