forked from fmtlib/fmt
Fix a bug in ctzll
This commit is contained in:
committed by
Victor Zverovich
parent
6f81ea151a
commit
2ecdbb986d
@ -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
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user