Skip to content

Commit 0aa4c35

Browse files
authored
[libc][__support] Fix -Wimplicit-int-conversion warning (#132839)
Newer versions of clang now warn about these, so use explicit conversion instead.
1 parent e6de45a commit 0aa4c35

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

libc/src/__support/float_to_string.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ class FloatToString {
491491

492492
LIBC_INLINE constexpr BlockInt get_negative_block(int block_index) {
493493
if (exponent < 0) {
494-
const int32_t idx = -exponent / IDX_SIZE;
494+
const int32_t idx = -exponent / static_cast<int32_t>(IDX_SIZE);
495495

496496
UInt<MID_INT_SIZE> val;
497497

@@ -579,7 +579,7 @@ class FloatToString {
579579

580580
return num_requested_digits > -exponent;
581581
#else
582-
const int32_t idx = -exponent / IDX_SIZE;
582+
const int32_t idx = -exponent / static_cast<int32_t>(IDX_SIZE);
583583
const size_t p =
584584
POW10_OFFSET_2[idx] + negative_block_index - MIN_BLOCK_2[idx];
585585
// If the remaining digits are all 0, then this is the lowest block.
@@ -601,7 +601,7 @@ class FloatToString {
601601
}
602602
return 0;
603603
#else
604-
return MIN_BLOCK_2[-exponent / IDX_SIZE];
604+
return MIN_BLOCK_2[-exponent / static_cast<int32_t>(IDX_SIZE)];
605605
#endif
606606
}
607607
};

0 commit comments

Comments
 (0)