Merge pull request #358 from shikharish/uint8-base-fix

add base check for uint8
This commit is contained in:
Daniel Lemire 2025-12-31 13:44:12 -05:00 committed by GitHub
commit d5bc4e1b2e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -515,6 +515,7 @@ parse_int_string(UC const *p, UC const *pend, T &value,
UC const *const start_digits = p; UC const *const start_digits = p;
FASTFLOAT_IF_CONSTEXPR17((std::is_same<T, std::uint8_t>::value)) { FASTFLOAT_IF_CONSTEXPR17((std::is_same<T, std::uint8_t>::value)) {
if (base == 10) {
const size_t len = (size_t)(pend - p); const size_t len = (size_t)(pend - p);
if (len == 0) { if (len == 0) {
if (has_leading_zeros) { if (has_leading_zeros) {
@ -603,6 +604,7 @@ parse_int_string(UC const *p, UC const *pend, T &value,
answer.ptr = p + nd; answer.ptr = p + nd;
return answer; return answer;
} }
}
uint64_t i = 0; uint64_t i = 0;
if (base == 10) { if (base == 10) {