Skip to content

Commit 58e7106

Browse files
authored
remove unused function parse_unsigned
1 parent 7bf391c commit 58e7106

File tree

1 file changed

+0
-55
lines changed

1 file changed

+0
-55
lines changed

include/simdjson/generic/numberparsing.h

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -626,61 +626,6 @@ simdjson_unused simdjson_really_inline simdjson_result<uint64_t> parse_unsigned(
626626
return i;
627627
}
628628

629-
// Parse any number from 0 to 18,446,744,073,709,551,615
630-
// Call this version of the method if you regularly expect 8- or 16-digit numbers.
631-
simdjson_unused simdjson_really_inline simdjson_result<uint64_t> parse_large_unsigned(const uint8_t * const src) noexcept {
632-
const uint8_t *p = src;
633-
634-
//
635-
// Parse the integer part.
636-
//
637-
uint64_t i = 0;
638-
if (is_made_of_eight_digits_fast(p)) {
639-
i = i * 100000000 + parse_eight_digits_unrolled(p);
640-
p += 8;
641-
if (is_made_of_eight_digits_fast(p)) {
642-
i = i * 100000000 + parse_eight_digits_unrolled(p);
643-
p += 8;
644-
if (parse_digit(*p, i)) { // digit 17
645-
p++;
646-
if (parse_digit(*p, i)) { // digit 18
647-
p++;
648-
if (parse_digit(*p, i)) { // digit 19
649-
p++;
650-
if (parse_digit(*p, i)) { // digit 20
651-
p++;
652-
if (parse_digit(*p, i)) { return NUMBER_ERROR; } // 21 digits is an error
653-
// Positive overflow check:
654-
// - A 20 digit number starting with 2-9 is overflow, because 18,446,744,073,709,551,615 is the
655-
// biggest uint64_t.
656-
// - A 20 digit number starting with 1 is overflow if it is less than INT64_MAX.
657-
// If we got here, it's a 20 digit number starting with the digit "1".
658-
// - If a 20 digit number starting with 1 overflowed (i*10+digit), the result will be smaller
659-
// than 1,553,255,926,290,448,384.
660-
// - That is smaller than the smallest possible 20-digit number the user could write:
661-
// 10,000,000,000,000,000,000.
662-
// - Therefore, if the number is positive and lower than that, it's overflow.
663-
// - The value we are looking at is less than or equal to 9,223,372,036,854,775,808 (INT64_MAX).
664-
//
665-
if (src[0] != uint8_t('1') || i <= uint64_t(INT64_MAX)) { return NUMBER_ERROR; }
666-
}
667-
}
668-
}
669-
}
670-
} // 16 digits
671-
} else { // 8 digits
672-
// Less than 8 digits can't overflow, simpler logic here.
673-
if (parse_digit(*p, i)) { p++; } else { return NUMBER_ERROR; }
674-
while (parse_digit(*p, i)) { p++; }
675-
}
676-
677-
if (!jsoncharutils::is_structural_or_whitespace(*p)) { return NUMBER_ERROR; }
678-
// If there were no digits, or if the integer starts with 0 and has more than one digit, it's an error.
679-
int digit_count = int(p - src);
680-
if (digit_count == 0 || ('0' == *src && digit_count > 1)) { return NUMBER_ERROR; }
681-
return i;
682-
}
683-
684629
// Parse any number from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
685630
simdjson_unused simdjson_really_inline simdjson_result<int64_t> parse_integer(const uint8_t *src) noexcept {
686631
//

0 commit comments

Comments
 (0)