[libc-commits] [libc] [libc] Fix type warning on gcc in float to str (PR #79482)

via libc-commits libc-commits at lists.llvm.org
Thu Jan 25 10:37:47 PST 2024


https://github.com/michaelrj-google created https://github.com/llvm/llvm-project/pull/79482

Minor cast warning that was missed in previous patch. Fixed with
explicit cast.



>From 7f3bab38cfb6e463757183c2f430b1ac7eb1fb73 Mon Sep 17 00:00:00 2001
From: Michael Jones <michaelrj at google.com>
Date: Thu, 25 Jan 2024 10:36:18 -0800
Subject: [PATCH] [libc] Fix type warning on gcc in float to str

Minor cast warning that was missed in previous patch. Fixed with
explicit cast.
---
 libc/src/__support/float_to_string.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libc/src/__support/float_to_string.h b/libc/src/__support/float_to_string.h
index 4dc9d6eb3cb735..1431aeffa5b210 100644
--- a/libc/src/__support/float_to_string.h
+++ b/libc/src/__support/float_to_string.h
@@ -503,7 +503,7 @@ class FloatToString {
 
       cpp::UInt<MID_INT_SIZE> val;
 
-      const uint32_t pos_exp = idx * IDX_SIZE;
+      const uint32_t pos_exp = static_cast<uint32_t>(idx * IDX_SIZE);
 
 #if defined(LIBC_COPT_FLOAT_TO_STR_USE_DYADIC_FLOAT)
       // ----------------------- DYADIC FLOAT CALC MODE ------------------------



More information about the libc-commits mailing list