From 2ecdbb986dbecc350f9c09f4e7ac635494bfa835 Mon Sep 17 00:00:00 2001 From: Junekey Jeon Date: Fri, 18 Sep 2020 11:25:14 -0700 Subject: [PATCH] Fix a bug in ctzll --- include/fmt/format.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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