[libc-commits] [libc] [libc][NFC] fix int warnings in float conversion (PR #74379)

Nick Desaulniers via libc-commits libc-commits at lists.llvm.org
Mon Dec 4 14:40:17 PST 2023


================
@@ -488,7 +489,8 @@ class FloatToString {
 
       val = POW10_SPLIT[POW10_OFFSET[idx] + block_index];
 #endif
-      const uint32_t shift_amount = SHIFT_CONST + (IDX_SIZE * idx) - exponent;
+      const uint32_t shift_amount =
+          static_cast<uint32_t>(SHIFT_CONST + (IDX_SIZE * idx) - exponent);
----------------
nickdesaulniers wrote:

I think just IDX_SIZE is a size_t; You could limit the static cast to just those (or perhaps define IDX_SIZE as a smaller type?)

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


More information about the libc-commits mailing list