fix for issue 354

This commit is contained in:
Daniel Lemire 2025-12-29 10:55:20 -05:00
parent fd85e52349
commit f4f9da1e6b

View File

@ -532,6 +532,9 @@ parse_int_string(UC const *p, UC const *pend, T &value,
str[j] = static_cast<uint8_t>(p[j]);
}
digits = std::bit_cast<uint32_t>(str);
#if FASTFLOAT_IS_BIG_ENDIAN
digits = byteswap(digits);
#endif
}
#else
if (false) {
@ -539,6 +542,9 @@ parse_int_string(UC const *p, UC const *pend, T &value,
#endif
else if (len >= 4) {
::memcpy(&digits, p, 4);
#if FASTFLOAT_IS_BIG_ENDIAN
digits = byteswap(digits);
#endif
} else {
uint32_t b0 = static_cast<uint8_t>(p[0]);
uint32_t b1 = (len > 1) ? static_cast<uint8_t>(p[1]) : 0xFFu;