mirror of
https://github.com/fastfloat/fast_float.git
synced 2026-01-01 03:12:18 +08:00
fix for issue 354
This commit is contained in:
parent
fd85e52349
commit
f4f9da1e6b
@ -532,6 +532,9 @@ parse_int_string(UC const *p, UC const *pend, T &value,
|
|||||||
str[j] = static_cast<uint8_t>(p[j]);
|
str[j] = static_cast<uint8_t>(p[j]);
|
||||||
}
|
}
|
||||||
digits = std::bit_cast<uint32_t>(str);
|
digits = std::bit_cast<uint32_t>(str);
|
||||||
|
#if FASTFLOAT_IS_BIG_ENDIAN
|
||||||
|
digits = byteswap(digits);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if (false) {
|
if (false) {
|
||||||
@ -539,6 +542,9 @@ parse_int_string(UC const *p, UC const *pend, T &value,
|
|||||||
#endif
|
#endif
|
||||||
else if (len >= 4) {
|
else if (len >= 4) {
|
||||||
::memcpy(&digits, p, 4);
|
::memcpy(&digits, p, 4);
|
||||||
|
#if FASTFLOAT_IS_BIG_ENDIAN
|
||||||
|
digits = byteswap(digits);
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
uint32_t b0 = static_cast<uint8_t>(p[0]);
|
uint32_t b0 = static_cast<uint8_t>(p[0]);
|
||||||
uint32_t b1 = (len > 1) ? static_cast<uint8_t>(p[1]) : 0xFFu;
|
uint32_t b1 = (len > 1) ? static_cast<uint8_t>(p[1]) : 0xFFu;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user