Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[libc] Fix type warning on gcc in float to str #79482

Merged
merged 1 commit into from
Jan 25, 2024

Conversation

michaelrj-google
Copy link
Contributor

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

Minor cast warning that was missed in previous patch. Fixed with
explicit cast.
@llvmbot llvmbot added the libc label Jan 25, 2024
@llvmbot
Copy link

llvmbot commented Jan 25, 2024

@llvm/pr-subscribers-libc

Author: None (michaelrj-google)

Changes

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 --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 ------------------------

Copy link
Contributor

@SchrodingerZhu SchrodingerZhu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@michaelrj-google michaelrj-google merged commit 8a0ff19 into llvm:main Jan 25, 2024
4 of 5 checks passed
@michaelrj-google michaelrj-google deleted the libcPrintfWarningFix branch January 25, 2024 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants