Commit 14c99ce6 authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Facebook GitHub Bot

fix to_ascii under 32-bit msvc builds

Summary:
Under gcc and clang, we use the intrinsic `__builtin_clzll`. This builtin is available regardless of whether the `clz` instruction is available on the target platform - when it is, the backend chooses it; when it is not, the backend emits emulation code.

Under msvc, the builtin is `__lzcnt64`. However, this builtin is available only in x64 builds; there is no fallback to emulation code, and 32-bit builds fail to compile.

Differential Revision: D26918251

fbshipit-source-id: a4d9c199f632c5a210bd6fd8782d327f7aac774e
parent 749f7a4b
......@@ -58,7 +58,11 @@ namespace detail {
FOLLY_ERASE int to_ascii_port_clzll(uint64_t v) {
#if _MSC_VER
#if FOLLY_X64
return __lzcnt64(v);
#else
__assume(0);
#endif
#else
return __builtin_clzll(v);
#endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment