File tree Expand file tree Collapse file tree 3 files changed +11
-7
lines changed
Expand file tree Collapse file tree 3 files changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -138,8 +138,8 @@ namespace tao
138138 }
139139 const auto c = std::min ( in.size (), max_mantissa_digits );
140140 std::memcpy ( result.mantissa , in.begin (), c );
141- result.exponent10 += in.size () - c;
142- result.msize = c ;
141+ result.exponent10 += static_cast <number_state:: exponent10_t >( in.size () - c) ;
142+ result.msize = static_cast <number_state:: msize_t >(c) ;
143143
144144 for ( std::size_t i = c; i < in.size (); ++i ) {
145145 if ( in.peek_char ( i ) != ' 0' ) {
@@ -171,8 +171,8 @@ namespace tao
171171 }
172172 const auto c = std::min ( std::size_t ( e - b ), max_mantissa_digits - result.msize );
173173 std::memcpy ( result.mantissa + result.msize , b, c );
174- result.exponent10 -= c ;
175- result.msize += c ;
174+ result.exponent10 -= static_cast <number_state:: exponent10_t >(c) ;
175+ result.msize += static_cast <number_state:: msize_t >(c) ;
176176
177177 for ( const auto * r = b + c; r < e; ++r ) {
178178 if ( *r != ' 0' ) {
Original file line number Diff line number Diff line change @@ -20,13 +20,16 @@ namespace tao
2020
2121 struct number_state
2222 {
23+ using exponent10_t = int32_t ;
24+ using msize_t = uint16_t ;
25+
2326 number_state () {}
2427
2528 number_state ( const number_state & ) = delete ;
2629 void operator = ( const number_state & ) = delete ;
2730
28- int32_t exponent10 = 0 ;
29- uint16_t msize = 0 ; // Excluding sign.
31+ exponent10_t exponent10 = 0 ;
32+ msize_t msize = 0 ; // Excluding sign.
3033 bool isfp = false ;
3134 bool mneg = false ;
3235 bool eneg = false ;
Original file line number Diff line number Diff line change 99#include < utility>
1010#include < stdexcept>
1111#include < vector>
12+ #include < limits>
1213
1314#include " external/operators.hpp"
1415
@@ -30,7 +31,7 @@ namespace tao
3031 std::string m_key;
3132
3233 public:
33- static const std::size_t npos = - 1 ;
34+ static const std::size_t npos = std::numeric_limits< size_t >::max() ;
3435
3536 explicit token ( const std::string & key )
3637 : m_index( internal::token_to_index( key ) ),
You can’t perform that action at this time.
0 commit comments