[libc-commits] [libc] [libc][NFC] Clean up conversion warnings in math function implementations. (PR #74697)

Nick Desaulniers via libc-commits libc-commits at lists.llvm.org
Thu Dec 7 08:34:03 PST 2023


================
@@ -110,12 +110,12 @@ template <size_t Bits> struct DyadicFloat {
       exp_hi = FloatProperties<T>::EXPONENT_BIAS;
     }
 
-    int exp_lo = exp_hi - PRECISION - 1;
+    int exp_lo = exp_hi - static_cast<int>(PRECISION) - 1;
----------------
nickdesaulniers wrote:

`PRECISION` is derived from `MANTISSA_WIDTH` which looks like a `uint32_t`. The other expressions using `PRECISION` also use 32b types.  Consider declaring `PRECISION` as an `uint32_t` instead of this one cast.

https://github.com/llvm/llvm-project/pull/74697


More information about the libc-commits mailing list