@@ -572,17 +572,13 @@ class FloatToString {
572
572
}
573
573
574
574
LIBC_INLINE constexpr size_t get_positive_blocks () {
575
- if (exponent >= -FRACTION_LEN) {
576
- const uint32_t idx =
577
- exponent < 0
578
- ? 0
579
- : static_cast <uint32_t >(exponent + (IDX_SIZE - 1 )) / IDX_SIZE;
580
- const uint32_t len =
581
- internal::length_for_num (idx * IDX_SIZE, FRACTION_LEN);
582
- return len;
583
- } else {
575
+ if (exponent < -FRACTION_LEN)
584
576
return 0 ;
585
- }
577
+ const uint32_t idx =
578
+ exponent < 0
579
+ ? 0
580
+ : static_cast <uint32_t >(exponent + (IDX_SIZE - 1 )) / IDX_SIZE;
581
+ return internal::length_for_num (idx * IDX_SIZE, FRACTION_LEN);
586
582
}
587
583
588
584
// This takes the index of a block after the decimal point (a negative block)
@@ -614,7 +610,7 @@ class FloatToString {
614
610
internal::ceil_log10_pow2 (FRACTION_LEN + 1 )) /
615
611
BLOCK_SIZE) -
616
612
1 ;
617
- return len = static_cast <uint32_t >(pos_len > 0 ? pos_len : 0 );
613
+ return static_cast <uint32_t >(pos_len > 0 ? pos_len : 0 );
618
614
}
619
615
return 0 ;
620
616
#else
@@ -668,9 +664,8 @@ template <> class FloatToString<long double> {
668
664
cpp::UInt<FLOAT_AS_INT_WIDTH + EXTRA_INT_WIDTH> &int_num) {
669
665
// WORD_SIZE is the width of the numbers used to internally represent the
670
666
// UInt
671
- for (size_t i = 0 ; i < EXTRA_INT_WIDTH / int_num.WORD_SIZE ; ++i) {
667
+ for (size_t i = 0 ; i < EXTRA_INT_WIDTH / int_num.WORD_SIZE ; ++i)
672
668
int_num[i + (FLOAT_AS_INT_WIDTH / int_num.WORD_SIZE )] = 0 ;
673
- }
674
669
}
675
670
676
671
// init_convert initializes float_as_int, cur_block, and block_buffer based on
@@ -775,7 +770,7 @@ template <> class FloatToString<long double> {
775
770
LIBC_INLINE constexpr bool is_lowest_block (size_t negative_block_index) {
776
771
// The decimal representation of 2**(-i) will have exactly i digits after
777
772
// the decimal point.
778
- int num_requested_digits =
773
+ const int num_requested_digits =
779
774
static_cast <int >((negative_block_index + 1 ) * BLOCK_SIZE);
780
775
781
776
return num_requested_digits > -exponent;
@@ -798,7 +793,7 @@ template <> class FloatToString<long double> {
798
793
// point, and 1 with the second and so on. This converts to the same
799
794
// block_index used everywhere else.
800
795
801
- int block_index = -1 - negative_block_index;
796
+ const int block_index = -1 - negative_block_index;
802
797
803
798
// If we're currently after the requested block (remember these are
804
799
// negative indices) we reset the number to the start. This is only
0 commit comments