Commit 2ecdbb98 authored by Junekey Jeon's avatar Junekey Jeon Committed by Victor Zverovich

Fix a bug in ctzll

parent 6f81ea15
...@@ -281,10 +281,11 @@ inline int ctzll(uint64_t x) { ...@@ -281,10 +281,11 @@ inline int ctzll(uint64_t x) {
_BitScanForward64(&r, x); _BitScanForward64(&r, x);
# else # else
// Scan the low 32 bits. // Scan the low 32 bits.
if (_BitScanForward(&r, static_cast<uint32_t>(x))) return r; if (_BitScanForward(&r, static_cast<uint32_t>(x)))
return static_cast<int>(r);
// Scan the high 32 bits. // Scan the high 32 bits.
_BitScanReverse(&r, static_cast<uint32_t>(x >> 32)); _BitScanForward(&r, static_cast<uint32_t>(x >> 32));
r += 32; r += 32;
# endif # 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