diff --git a/include/fmt/format.h b/include/fmt/format.h index 5cb71b99..1c40140b 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -281,10 +281,11 @@ inline int ctzll(uint64_t x) { _BitScanForward64(&r, x); # else // Scan the low 32 bits. - if (_BitScanForward(&r, static_cast(x))) return r; + if (_BitScanForward(&r, static_cast(x))) + return static_cast(r); // Scan the high 32 bits. - _BitScanReverse(&r, static_cast(x >> 32)); + _BitScanForward(&r, static_cast(x >> 32)); r += 32; # endif