[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:38:20 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libc

Author: None (michaelrj-google)

<details>
<summary>Changes</summary>

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



---
Full diff: https://github.com/llvm/llvm-project/pull/79482.diff


1 Files Affected:

- (modified) libc/src/__support/float_to_string.h (+1-1) 


``````````diff
diff --git a/libc/src/__support/float_to_string.h b/libc/src/__support/float_to_string.h
index 4dc9d6eb3cb7352..1431aeffa5b2108 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 ------------------------

``````````

</details>


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


More information about the libc-commits mailing list