From e5a320697235ae98ea7fdf4af10cb713d01e82ae Mon Sep 17 00:00:00 2001 From: Cleroth Date: Fri, 16 Jun 2017 21:39:01 +0200 Subject: [PATCH] Fixed builtin CLZ being used incorrectly --- fmt/format.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fmt/format.h b/fmt/format.h index b56b8589b069..9aeb2c7ea36c 100644 --- a/fmt/format.h +++ b/fmt/format.h @@ -288,11 +288,11 @@ typedef __int64 intmax_t; #endif #if FMT_GCC_VERSION >= 400 || FMT_HAS_BUILTIN(__builtin_clz) -# define FMT_BUILTIN_CLZ(n) __builtin_clz(n) +# define FMT_BUILTIN_CLZ(n) (31 - __builtin_clz(n)) #endif #if FMT_GCC_VERSION >= 400 || FMT_HAS_BUILTIN(__builtin_clzll) -# define FMT_BUILTIN_CLZLL(n) __builtin_clzll(n) +# define FMT_BUILTIN_CLZLL(n) (63 - __builtin_clzll(n)) #endif // Some compilers masquerade as both MSVC and GCC-likes or