Workaround broken __builtin_clz in clang with MS codegen (#519)

This commit is contained in:
Victor Zverovich 2018-02-01 16:43:16 -08:00
parent 3dae25828f
commit 8fa9acb8e5

View File

@ -140,6 +140,9 @@
# endif # endif
#endif #endif
// __builtin_clz is broken in clang with Microsoft CodeGen:
// https://github.com/fmtlib/fmt/issues/519
#ifndef _MSC_VER
# if FMT_GCC_VERSION >= 400 || FMT_HAS_BUILTIN(__builtin_clz) # if FMT_GCC_VERSION >= 400 || FMT_HAS_BUILTIN(__builtin_clz)
# define FMT_BUILTIN_CLZ(n) __builtin_clz(n) # define FMT_BUILTIN_CLZ(n) __builtin_clz(n)
# endif # endif
@ -147,6 +150,7 @@
# if FMT_GCC_VERSION >= 400 || FMT_HAS_BUILTIN(__builtin_clzll) # if FMT_GCC_VERSION >= 400 || FMT_HAS_BUILTIN(__builtin_clzll)
# define FMT_BUILTIN_CLZLL(n) __builtin_clzll(n) # define FMT_BUILTIN_CLZLL(n) __builtin_clzll(n)
# endif # endif
#endif
// Some compilers masquerade as both MSVC and GCC-likes or otherwise support // Some compilers masquerade as both MSVC and GCC-likes or otherwise support
// __builtin_clz and __builtin_clzll, so only define FMT_BUILTIN_CLZ using the // __builtin_clz and __builtin_clzll, so only define FMT_BUILTIN_CLZ using the