@@ -435,7 +435,7 @@ parse_number_string(UC const *p, UC const *pend,
435435 } else {
436436 // Now let's parse the explicit exponent.
437437 while ((p != pend) && is_integer (*p)) {
438- if (exp_number < std::numeric_limits< am_pow_t >:: max () ) {
438+ if (exp_number < am_bias_limit ) {
439439 // check for exponent overflow if we have too many digits.
440440 auto const digit = uint8_t (*p - UC (' 0' ));
441441 exp_number = 10 * exp_number + digit;
@@ -561,7 +561,7 @@ parse_int_string(UC const *p, UC const *pend, T &value,
561561 auto const *const start_digits = p;
562562
563563 FASTFLOAT_IF_CONSTEXPR17 ((std::is_same<T, std::uint8_t >::value)) {
564- const size_t len = ( size_t ) (pend - p);
564+ const auto len = static_cast <am_digits> (pend - p);
565565 if (len == 0 ) {
566566 if (has_leading_zeros) {
567567 value = 0 ;
@@ -581,7 +581,7 @@ parse_int_string(UC const *p, UC const *pend, T &value,
581581
582582 if (cpp20_and_in_constexpr ()) {
583583 digits.as_int = 0 ;
584- for (size_t j = 0 ; j < 4 && j < len; ++j) {
584+ for (uint_fast8_t j = 0 ; j < 4 && j < len; ++j) {
585585 digits.as_str [j] = static_cast <uint8_t >(p[j]);
586586 }
587587 } else if (len >= 4 ) {
@@ -598,12 +598,13 @@ parse_int_string(UC const *p, UC const *pend, T &value,
598598#endif
599599 }
600600
601- uint32_t magic =
601+ const uint32_t magic =
602602 ((digits.as_int + 0x46464646u ) | (digits.as_int - 0x30303030u )) &
603603 0x80808080u ;
604- uint32_t tz = (uint32_t )countr_zero_32 (magic); // 7, 15, 23, 31, or 32
604+ const auto tz =
605+ static_cast <uint32_t >(countr_zero_32 (magic)); // 7, 15, 23, 31, or 32
605606 uint32_t nd = (tz == 32 ) ? 4 : (tz >> 3 );
606- nd = ( uint32_t ) std::min (( size_t ) nd, len);
607+ nd = std::min (nd, len);
607608 if (nd == 0 ) {
608609 if (has_leading_zeros) {
609610 value = 0 ;
@@ -617,7 +618,7 @@ parse_int_string(UC const *p, UC const *pend, T &value,
617618 }
618619 if (nd > 3 ) {
619620 const UC *q = p + nd;
620- size_t rem = len - nd;
621+ uint_fast8_t rem = len - nd;
621622 while (rem) {
622623 if (*q < UC (' 0' ) || *q > UC (' 9' ))
623624 break ;
@@ -632,15 +633,15 @@ parse_int_string(UC const *p, UC const *pend, T &value,
632633 digits.as_int ^= 0x30303030u ;
633634 digits.as_int <<= ((4 - nd) * 8 );
634635
635- uint32_t check = ((digits.as_int >> 24 ) & 0xff ) |
636- ((digits.as_int >> 8 ) & 0xff00 ) |
637- ((digits.as_int << 8 ) & 0xff0000 );
636+ const uint32_t check = ((digits.as_int >> 24 ) & 0xff ) |
637+ ((digits.as_int >> 8 ) & 0xff00 ) |
638+ ((digits.as_int << 8 ) & 0xff0000 );
638639 if (check > 0x00020505 ) {
639640 answer.ec = std::errc::result_out_of_range;
640641 answer.ptr = p + nd;
641642 return answer;
642643 }
643- value = ( uint8_t ) ((0x640a01 * digits.as_int ) >> 24 );
644+ value = static_cast < uint8_t > ((0x640a01 * digits.as_int ) >> 24 );
644645 answer.ec = std::errc ();
645646 answer.ptr = p + nd;
646647 return answer;
0 commit comments