diff --git a/libcxx/include/bit b/libcxx/include/bit --- a/libcxx/include/bit +++ b/libcxx/include/bit @@ -116,14 +116,13 @@ else { int __ret = 0; - int __iter = 0; const unsigned int __ulldigits = numeric_limits::digits; - while ((__iter = __libcpp_ctz(static_cast(__t))) == __ulldigits) + while (static_cast(__t) == 0uLL) { - __ret += __iter; + __ret += __ulldigits; __t >>= __ulldigits; } - return __ret + __iter; + return __ret + __libcpp_ctz(static_cast(__t)); } }