@@ -47,10 +47,9 @@ struct diyfp // f * 2^e
47
47
{
48
48
static constexpr int kPrecision = 64 ; // = q
49
49
50
- uint64_t f;
51
- int e;
50
+ uint64_t f = 0 ;
51
+ int e = 0 ;
52
52
53
- constexpr diyfp () noexcept : f(0 ), e(0 ) {}
54
53
constexpr diyfp (uint64_t f_, int e_) noexcept : f(f_), e(e_) {}
55
54
56
55
/* !
@@ -62,7 +61,7 @@ struct diyfp // f * 2^e
62
61
assert (x.e == y.e );
63
62
assert (x.f >= y.f );
64
63
65
- return diyfp ( x.f - y.f , x.e ) ;
64
+ return { x.f - y.f , x.e } ;
66
65
}
67
66
68
67
/* !
@@ -127,7 +126,7 @@ struct diyfp // f * 2^e
127
126
128
127
const uint64_t h = p3 + p2_hi + p1_hi + (Q >> 32 );
129
128
130
- return diyfp ( h, x.e + y.e + 64 ) ;
129
+ return { h, x.e + y.e + 64 } ;
131
130
}
132
131
133
132
/* !
@@ -158,7 +157,7 @@ struct diyfp // f * 2^e
158
157
assert (delta >= 0 );
159
158
assert (((x.f << delta) >> delta) == x.f );
160
159
161
- return diyfp ( x.f << delta, target_exponent) ;
160
+ return { x.f << delta, target_exponent} ;
162
161
}
163
162
};
164
163
@@ -461,7 +460,7 @@ inline cached_power get_cached_power_for_binary_exponent(int e)
461
460
assert (e >= -1500 );
462
461
assert (e <= 1500 );
463
462
const int f = kAlpha - e - 1 ;
464
- const int k = (f * 78913 ) / (1 << 18 ) + (f > 0 );
463
+ const int k = (f * 78913 ) / (1 << 18 ) + static_cast < int > (f > 0 );
465
464
466
465
const int index = (-kCachedPowersMinDecExp + k + (kCachedPowersDecStep - 1 )) / kCachedPowersDecStep ;
467
466
assert (index >= 0 );
@@ -609,7 +608,7 @@ inline void grisu2_digit_gen(char* buffer, int& length, int& decimal_exponent,
609
608
610
609
const diyfp one (uint64_t {1 } << -M_plus.e , M_plus.e );
611
610
612
- uint32_t p1 = static_cast <uint32_t >(M_plus.f >> -one.e ); // p1 = f div 2^-e (Since -e >= 32, p1 fits into a 32-bit int.)
611
+ auto p1 = static_cast <uint32_t >(M_plus.f >> -one.e ); // p1 = f div 2^-e (Since -e >= 32, p1 fits into a 32-bit int.)
613
612
uint64_t p2 = M_plus.f & (one.f - 1 ); // p2 = f mod 2^-e
614
613
615
614
// 1)
@@ -928,7 +927,7 @@ inline char* append_exponent(char* buf, int e)
928
927
*buf++ = ' +' ;
929
928
}
930
929
931
- uint32_t k = static_cast <uint32_t >(e);
930
+ auto k = static_cast <uint32_t >(e);
932
931
if (k < 10 )
933
932
{
934
933
// Always print at least two digits in the exponent.
@@ -1046,7 +1045,7 @@ format. Returns an iterator pointing past-the-end of the decimal representation.
1046
1045
@note The result is NOT null-terminated.
1047
1046
*/
1048
1047
template <typename FloatType>
1049
- char * to_chars (char * first, char * last, FloatType value)
1048
+ char * to_chars (char * first, const char * last, FloatType value)
1050
1049
{
1051
1050
static_cast <void >(last); // maybe unused - fix warning
1052
1051
assert (std::isfinite (value));
0 commit comments