Skip to content

Commit 7b9159a

Browse files
committed
* signed/unsigned mismatch fix.
1 parent e1bc8fc commit 7b9159a

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

include/fast_float/ascii_number.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ template <typename UC, FASTFLOAT_ENABLE_IF(!std::is_same<UC, char>::value) = 0>
228228
fastfloat_really_inline FASTFLOAT_CONSTEXPR20 void
229229
loop_parse_if_digits(UC const *&p, UC const *const pend, uint64_t &i) {
230230
FASTFLOAT_IF_CONSTEXPR17(!has_simd_opt<UC>()) { return; }
231-
while (std::distance(p, pend) >= sizeof(uint64_t) &&
231+
while (std::distance(p, pend) >= 8 /*sizeof(uint64_t)*/ &&
232232
simd_parse_if_eight_digits_unrolled(p, i)) { // may overflow, that's ok
233233
p += sizeof(uint64_t);
234234
}
@@ -237,7 +237,7 @@ loop_parse_if_digits(UC const *&p, UC const *const pend, uint64_t &i) {
237237
fastfloat_really_inline FASTFLOAT_CONSTEXPR20 void
238238
loop_parse_if_digits(char const *&p, char const *const pend, uint64_t &i) {
239239
// optimizes better than parse_if_eight_digits_unrolled() for UC = char.
240-
while (std::distance(p, pend) >= sizeof(uint64_t)) {
240+
while (std::distance(p, pend) >= 8 /*sizeof(uint64_t)*/) {
241241
auto const val = read_chars_to_unsigned<uint64_t>(p);
242242
if (is_made_of_eight_digits_fast(val)) {
243243
i = i * 100000000 /*10 ^ sizeof(uint64_t)*/ +
@@ -250,7 +250,7 @@ loop_parse_if_digits(char const *&p, char const *const pend, uint64_t &i) {
250250
// Consume a remaining 4-7 digit run in a single SWAR step instead of
251251
// byte-by-byte (reuses the existing 4-digit helpers). The parsed result is
252252
// identical either way.
253-
if (std::distance(p, pend) >= sizeof(uint32_t)) {
253+
if (std::distance(p, pend) >= 4 /*sizeof(uint32_t)*/) {
254254
auto const val = read_chars_to_unsigned<uint32_t>(p);
255255
if (is_made_of_four_digits_fast(val)) {
256256
i = i * 10000 /*10 ^ sizeof(uint32_t)*/ +

0 commit comments

Comments
 (0)