From 07360899e64ded32e9a5e304bd6a3b6a0ff266bc Mon Sep 17 00:00:00 2001 From: Abseil Team Date: Thu, 4 Aug 2022 05:04:38 -0700 Subject: Fix "unsafe narrowing" warnings in absl, 4/n. Addresses failures with the following, in some files: -Wshorten-64-to-32 -Wimplicit-int-conversion -Wsign-compare -Wsign-conversion -Wtautological-unsigned-zero-compare (This specific CL focuses on .cc files in strings/, except /internal/.) Bug: chromium:1292951 PiperOrigin-RevId: 465285043 Change-Id: I37e9d1b4c4e9aa655b720da1467927af2aba995e --- absl/numeric/bits.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'absl/numeric') diff --git a/absl/numeric/bits.h b/absl/numeric/bits.h index 628cdf50..df81b9a9 100644 --- a/absl/numeric/bits.h +++ b/absl/numeric/bits.h @@ -131,10 +131,9 @@ has_single_bit(T x) noexcept { // fractional part discarded. template ABSL_INTERNAL_CONSTEXPR_CLZ inline - typename std::enable_if::value, T>::type + typename std::enable_if::value, int>::type bit_width(T x) noexcept { - return std::numeric_limits::digits - - static_cast(countl_zero(x)); + return std::numeric_limits::digits - countl_zero(x); } // Returns: If x == 0, 0; otherwise the maximal value y such that -- cgit v1.2.3