1 #ifndef SIMDJSON_GENERIC_NUMBERPARSING_H
3 #ifndef SIMDJSON_CONDITIONAL_INCLUDE
4 #define SIMDJSON_GENERIC_NUMBERPARSING_H
5 #include "simdjson/generic/base.h"
6 #include "simdjson/generic/jsoncharutils.h"
7 #include "simdjson/internal/numberparsing_tables.h"
15 namespace SIMDJSON_IMPLEMENTATION {
16 namespace numberparsing {
18 #ifdef JSON_TEST_NUMBERS
19 #define INVALID_NUMBER(SRC) (found_invalid_number((SRC)), NUMBER_ERROR)
20 #define WRITE_INTEGER(VALUE, SRC, WRITER) (found_integer((VALUE), (SRC)), (WRITER).append_s64((VALUE)))
21 #define WRITE_UNSIGNED(VALUE, SRC, WRITER) (found_unsigned_integer((VALUE), (SRC)), (WRITER).append_u64((VALUE)))
22 #define WRITE_DOUBLE(VALUE, SRC, WRITER) (found_float((VALUE), (SRC)), (WRITER).append_double((VALUE)))
24 #define INVALID_NUMBER(SRC) (NUMBER_ERROR)
25 #define WRITE_INTEGER(VALUE, SRC, WRITER) (WRITER).append_s64((VALUE))
26 #define WRITE_UNSIGNED(VALUE, SRC, WRITER) (WRITER).append_u64((VALUE))
27 #define WRITE_DOUBLE(VALUE, SRC, WRITER) (WRITER).append_double((VALUE))
35 simdjson_inline
double to_double(uint64_t mantissa, uint64_t real_exponent,
bool negative) {
37 mantissa &= ~(1ULL << 52);
38 mantissa |= real_exponent << 52;
39 mantissa |= ((
static_cast<uint64_t
>(negative)) << 63);
40 std::memcpy(&d, &mantissa,
sizeof(d));
50 simdjson_inline
bool compute_float_64(int64_t power, uint64_t i,
bool negative,
double &d) {
55 #ifndef FLT_EVAL_METHOD
56 #error "FLT_EVAL_METHOD should be defined, please include cfloat."
58 #if (FLT_EVAL_METHOD != 1) && (FLT_EVAL_METHOD != 0)
60 if (0 <= power && power <= 22 && i <= 9007199254740991)
62 if (-22 <= power && power <= 22 && i <= 9007199254740991)
79 d = d / simdjson::internal::power_of_ten[-power];
81 d = d * simdjson::internal::power_of_ten[power];
111 d = negative ? -0.0 : 0.0;
142 int64_t exponent = (((152170 + 65536) * power) >> 16) + 1024 + 63;
146 int lz = leading_zeroes(i);
161 const uint32_t index = 2 * uint32_t(power - simdjson::internal::smallest_power);
168 simdjson::internal::value128 firstproduct = full_multiplication(i, simdjson::internal::power_of_five_128[index]);
180 if((firstproduct.high & 0x1FF) == 0x1FF) {
201 simdjson::internal::value128 secondproduct = full_multiplication(i, simdjson::internal::power_of_five_128[index + 1]);
202 firstproduct.low += secondproduct.high;
203 if(secondproduct.high > firstproduct.low) { firstproduct.high++; }
208 uint64_t lower = firstproduct.low;
209 uint64_t upper = firstproduct.high;
213 uint64_t upperbit = upper >> 63;
214 uint64_t mantissa = upper >> (upperbit + 9);
215 lz += int(1 ^ upperbit);
218 int64_t real_exponent = exponent - lz;
219 if (simdjson_unlikely(real_exponent <= 0)) {
221 if(-real_exponent + 1 >= 64) {
222 d = negative ? -0.0 : 0.0;
226 mantissa >>= -real_exponent + 1;
229 mantissa += (mantissa & 1);
238 real_exponent = (mantissa < (uint64_t(1) << 52)) ? 0 : 1;
239 d = to_double(mantissa, real_exponent, negative);
264 if (simdjson_unlikely((lower <= 1) && (power >= -4) && (power <= 23) && ((mantissa & 3) == 1))) {
265 if((mantissa << (upperbit + 64 - 53 - 2)) == upper) {
270 mantissa += mantissa & 1;
274 if (mantissa >= (1ULL << 53)) {
278 mantissa = (1ULL << 52);
281 mantissa &= ~(1ULL << 52);
283 if (simdjson_unlikely(real_exponent > 2046)) {
287 d = to_double(mantissa, real_exponent, negative);
298 static bool parse_float_fallback(
const uint8_t *ptr,
double *outDouble) {
299 *outDouble = simdjson::internal::from_chars(
reinterpret_cast<const char *
>(ptr));
310 return !(*outDouble > (std::numeric_limits<double>::max)() || *outDouble < std::numeric_limits<double>::lowest());
313 static bool parse_float_fallback(
const uint8_t *ptr,
const uint8_t *end_ptr,
double *outDouble) {
314 *outDouble = simdjson::internal::from_chars(
reinterpret_cast<const char *
>(ptr),
reinterpret_cast<const char *
>(end_ptr));
325 return !(*outDouble > (std::numeric_limits<double>::max)() || *outDouble < std::numeric_limits<double>::lowest());
331 simdjson_inline
bool is_made_of_eight_digits_fast(
const uint8_t *chars) {
335 static_assert(7 <=
SIMDJSON_PADDING,
"SIMDJSON_PADDING must be bigger than 7");
336 std::memcpy(&val, chars, 8);
341 return (((val & 0xF0F0F0F0F0F0F0F0) |
342 (((val + 0x0606060606060606) & 0xF0F0F0F0F0F0F0F0) >> 4)) ==
347 SIMDJSON_NO_SANITIZE_UNDEFINED
348 simdjson_inline
bool parse_digit(
const uint8_t c, I &i) {
349 const uint8_t digit =
static_cast<uint8_t
>(c -
'0');
358 simdjson_inline
error_code parse_decimal_after_separator(simdjson_unused
const uint8_t *
const src,
const uint8_t *&p, uint64_t &i, int64_t &exponent) {
363 const uint8_t *
const first_after_period = p;
365 #ifdef SIMDJSON_SWAR_NUMBER_PARSING
366 #if SIMDJSON_SWAR_NUMBER_PARSING
369 if (is_made_of_eight_digits_fast(p)) {
370 i = i * 100000000 + parse_eight_digits_unrolled(p);
376 if (parse_digit(*p, i)) { ++p; }
377 while (parse_digit(*p, i)) { p++; }
378 exponent = first_after_period - p;
381 return INVALID_NUMBER(src);
386 simdjson_inline
error_code parse_exponent(simdjson_unused
const uint8_t *
const src,
const uint8_t *&p, int64_t &exponent) {
388 bool neg_exp = (
'-' == *p);
389 if (neg_exp ||
'+' == *p) { p++; }
393 int64_t exp_number = 0;
394 while (parse_digit(*p, exp_number)) { ++p; }
406 if (simdjson_unlikely(p == start_exp)) {
407 return INVALID_NUMBER(src);
414 if (simdjson_unlikely(p > start_exp+18)) {
416 while (*start_exp ==
'0') { start_exp++; }
426 if (p > start_exp+18) { exp_number = 999999999999999999; }
433 exponent += (neg_exp ? -exp_number : exp_number);
437 simdjson_inline
size_t significant_digits(
const uint8_t * start_digits,
size_t digit_count) {
440 const uint8_t *start = start_digits;
441 while ((*start ==
'0') || (*start ==
'.')) { ++start; }
443 return digit_count - size_t(start - start_digits);
450 error_code slow_float_parsing(simdjson_unused
const uint8_t * src, W writer) {
452 if (parse_float_fallback(src, &d)) {
453 writer.append_double(d);
456 return INVALID_NUMBER(src);
461 simdjson_inline
error_code write_float(
const uint8_t *
const src,
bool negative, uint64_t i,
const uint8_t * start_digits,
size_t digit_count, int64_t exponent, W &writer) {
469 if (simdjson_unlikely(digit_count > 19 && significant_digits(start_digits, digit_count) > 19)) {
482 error_code error = slow_float_parsing(src, writer);
483 writer.skip_double();
489 if (simdjson_unlikely(exponent < simdjson::internal::smallest_power) || (exponent > simdjson::internal::largest_power)) {
494 static_assert(simdjson::internal::smallest_power <= -342,
"smallest_power is not small enough");
496 if((exponent < simdjson::internal::smallest_power) || (i == 0)) {
498 WRITE_DOUBLE(negative ? -0.0 : 0.0, src, writer);
502 return INVALID_NUMBER(src);
506 if (!compute_float_64(exponent, i, negative, d)) {
508 if (!parse_float_fallback(src, &d)) {
return INVALID_NUMBER(src); }
510 WRITE_DOUBLE(d, src, writer);
515 #ifdef SIMDJSON_SKIPNUMBERPARSING
518 simdjson_inline
error_code parse_number(
const uint8_t *
const, W &writer) {
519 writer.append_s64(0);
523 simdjson_unused simdjson_inline simdjson_result<uint64_t> parse_unsigned(
const uint8_t *
const src) noexcept {
return 0; }
524 simdjson_unused simdjson_inline simdjson_result<int64_t> parse_integer(
const uint8_t *
const src) noexcept {
return 0; }
525 simdjson_unused simdjson_inline simdjson_result<double> parse_double(
const uint8_t *
const src) noexcept {
return 0; }
526 simdjson_unused simdjson_inline simdjson_result<uint64_t> parse_unsigned_in_string(
const uint8_t *
const src) noexcept {
return 0; }
527 simdjson_unused simdjson_inline simdjson_result<int64_t> parse_integer_in_string(
const uint8_t *
const src) noexcept {
return 0; }
528 simdjson_unused simdjson_inline simdjson_result<double> parse_double_in_string(
const uint8_t *
const src) noexcept {
return 0; }
529 simdjson_unused simdjson_inline
bool is_negative(
const uint8_t * src) noexcept {
return false; }
530 simdjson_unused simdjson_inline simdjson_result<bool> is_integer(
const uint8_t * src) noexcept {
return false; }
531 simdjson_unused simdjson_inline simdjson_result<number_type> get_number_type(
const uint8_t * src) noexcept {
return number_type::signed_integer; }
544 simdjson_inline
error_code parse_number(
const uint8_t *
const src, W &writer) {
549 bool negative = (*src ==
'-');
550 const uint8_t *p = src + uint8_t(negative);
556 const uint8_t *
const start_digits = p;
558 while (parse_digit(*p, i)) { p++; }
562 size_t digit_count = size_t(p - start_digits);
563 if (digit_count == 0 || (
'0' == *start_digits && digit_count > 1)) {
return INVALID_NUMBER(src); }
568 int64_t exponent = 0;
569 bool is_float =
false;
573 SIMDJSON_TRY( parse_decimal_after_separator(src, p, i, exponent) );
574 digit_count = int(p - start_digits);
576 if ((
'e' == *p) || (
'E' == *p)) {
579 SIMDJSON_TRY( parse_exponent(src, p, exponent) );
582 const bool dirty_end = jsoncharutils::is_not_structural_or_whitespace(*p);
583 SIMDJSON_TRY( write_float(src, negative, i, start_digits, digit_count, exponent, writer) );
584 if (dirty_end) {
return INVALID_NUMBER(src); }
591 size_t longest_digit_count = negative ? 19 : 20;
592 if (digit_count > longest_digit_count) {
return INVALID_NUMBER(src); }
593 if (digit_count == longest_digit_count) {
596 if (i > uint64_t(INT64_MAX)+1) {
return INVALID_NUMBER(src); }
597 WRITE_INTEGER(~i+1, src, writer);
598 if (jsoncharutils::is_not_structural_or_whitespace(*p)) {
return INVALID_NUMBER(src); }
612 }
else if (src[0] != uint8_t(
'1') || i <= uint64_t(INT64_MAX)) {
return INVALID_NUMBER(src); }
616 if (i > uint64_t(INT64_MAX)) {
617 WRITE_UNSIGNED(i, src, writer);
619 WRITE_INTEGER(negative ? (~i+1) : i, src, writer);
621 if (jsoncharutils::is_not_structural_or_whitespace(*p)) {
return INVALID_NUMBER(src); }
639 const uint8_t integer_string_finisher[256] = {
694 simdjson_unused simdjson_inline simdjson_result<uint64_t> parse_unsigned(
const uint8_t *
const src) noexcept {
695 const uint8_t *p = src;
700 const uint8_t *
const start_digits = p;
702 while (parse_digit(*p, i)) { p++; }
706 size_t digit_count = size_t(p - start_digits);
712 if ((digit_count == 0) || (digit_count > 20)) {
return INCORRECT_TYPE; }
714 if ((
'0' == *start_digits) && (digit_count > 1)) {
return NUMBER_ERROR; }
720 if (integer_string_finisher[*p] !=
SUCCESS) {
return error_code(integer_string_finisher[*p]); }
722 if (digit_count == 20) {
735 if (src[0] != uint8_t(
'1') || i <= uint64_t(INT64_MAX)) {
return INCORRECT_TYPE; }
744 simdjson_unused simdjson_inline simdjson_result<uint64_t> parse_unsigned(
const uint8_t *
const src,
const uint8_t *
const src_end) noexcept {
745 const uint8_t *p = src;
750 const uint8_t *
const start_digits = p;
752 while ((p != src_end) && parse_digit(*p, i)) { p++; }
756 size_t digit_count = size_t(p - start_digits);
762 if ((digit_count == 0) || (digit_count > 20)) {
return INCORRECT_TYPE; }
764 if ((
'0' == *start_digits) && (digit_count > 1)) {
return NUMBER_ERROR; }
770 if ((p != src_end) && integer_string_finisher[*p] !=
SUCCESS) {
return error_code(integer_string_finisher[*p]); }
772 if (digit_count == 20) {
785 if (src[0] != uint8_t(
'1') || i <= uint64_t(INT64_MAX)) {
return INCORRECT_TYPE; }
792 simdjson_unused simdjson_inline simdjson_result<uint64_t> parse_unsigned_in_string(
const uint8_t *
const src) noexcept {
793 const uint8_t *p = src + 1;
798 const uint8_t *
const start_digits = p;
800 while (parse_digit(*p, i)) { p++; }
804 size_t digit_count = size_t(p - start_digits);
810 if ((digit_count == 0) || (digit_count > 20)) {
return INCORRECT_TYPE; }
812 if ((
'0' == *start_digits) && (digit_count > 1)) {
return NUMBER_ERROR; }
820 if (digit_count == 20) {
835 if (src[1] != uint8_t(
'1') || i <= uint64_t(INT64_MAX)) {
return INCORRECT_TYPE; }
842 simdjson_unused simdjson_inline simdjson_result<int64_t> parse_integer(
const uint8_t *src) noexcept {
846 bool negative = (*src ==
'-');
847 const uint8_t *p = src + uint8_t(negative);
853 const uint8_t *
const start_digits = p;
855 while (parse_digit(*p, i)) { p++; }
859 size_t digit_count = size_t(p - start_digits);
863 size_t longest_digit_count = 19;
867 if ((digit_count == 0) || (digit_count > longest_digit_count)) {
return INCORRECT_TYPE; }
869 if ((
'0' == *start_digits) && (digit_count > 1)) {
return NUMBER_ERROR; }
875 if(integer_string_finisher[*p] !=
SUCCESS) {
return error_code(integer_string_finisher[*p]); }
879 if(i > uint64_t(INT64_MAX) + uint64_t(negative)) {
return INCORRECT_TYPE; }
880 return negative ? (~i+1) : i;
885 simdjson_unused simdjson_inline simdjson_result<int64_t> parse_integer(
const uint8_t *
const src,
const uint8_t *
const src_end) noexcept {
890 bool negative = (*src ==
'-');
891 const uint8_t *p = src + uint8_t(negative);
897 const uint8_t *
const start_digits = p;
899 while ((p != src_end) && parse_digit(*p, i)) { p++; }
903 size_t digit_count = size_t(p - start_digits);
907 size_t longest_digit_count = 19;
911 if ((digit_count == 0) || (digit_count > longest_digit_count)) {
return INCORRECT_TYPE; }
913 if ((
'0' == *start_digits) && (digit_count > 1)) {
return NUMBER_ERROR; }
919 if((p != src_end) && integer_string_finisher[*p] !=
SUCCESS) {
return error_code(integer_string_finisher[*p]); }
923 if(i > uint64_t(INT64_MAX) + uint64_t(negative)) {
return INCORRECT_TYPE; }
924 return negative ? (~i+1) : i;
928 simdjson_unused simdjson_inline simdjson_result<int64_t> parse_integer_in_string(
const uint8_t *src) noexcept {
932 bool negative = (*(src + 1) ==
'-');
933 src += uint8_t(negative) + 1;
939 const uint8_t *
const start_digits = src;
941 while (parse_digit(*src, i)) { src++; }
945 size_t digit_count = size_t(src - start_digits);
949 size_t longest_digit_count = 19;
953 if ((digit_count == 0) || (digit_count > longest_digit_count)) {
return INCORRECT_TYPE; }
955 if ((
'0' == *start_digits) && (digit_count > 1)) {
return NUMBER_ERROR; }
965 if(i > uint64_t(INT64_MAX) + uint64_t(negative)) {
return INCORRECT_TYPE; }
966 return negative ? (~i+1) : i;
969 simdjson_unused simdjson_inline simdjson_result<double> parse_double(
const uint8_t * src) noexcept {
973 bool negative = (*src ==
'-');
974 src += uint8_t(negative);
980 const uint8_t *p = src;
981 p += parse_digit(*p, i);
982 bool leading_zero = (i == 0);
983 while (parse_digit(*p, i)) { p++; }
986 if ( (leading_zero && p != src+1)) {
return NUMBER_ERROR; }
991 int64_t exponent = 0;
993 if (simdjson_likely(*p ==
'.')) {
995 const uint8_t *start_decimal_digits = p;
998 while (parse_digit(*p, i)) { p++; }
999 exponent = -(p - start_decimal_digits);
1002 overflow = p-src-1 > 19;
1003 if (simdjson_unlikely(overflow && leading_zero)) {
1005 const uint8_t *start_digits = src + 2;
1006 while (*start_digits ==
'0') { start_digits++; }
1007 overflow = start_digits-src > 19;
1010 overflow = p-src > 19;
1016 if (*p ==
'e' || *p ==
'E') {
1018 bool exp_neg = *p ==
'-';
1019 p += exp_neg || *p ==
'+';
1022 const uint8_t *start_exp_digits = p;
1023 while (parse_digit(*p, exp)) { p++; }
1025 if (p-start_exp_digits == 0 || p-start_exp_digits > 19) {
return NUMBER_ERROR; }
1027 exponent += exp_neg ? 0-exp : exp;
1030 if (jsoncharutils::is_not_structural_or_whitespace(*p)) {
return NUMBER_ERROR; }
1032 overflow = overflow || exponent < simdjson::internal::smallest_power || exponent > simdjson::internal::largest_power;
1038 if (simdjson_likely(!overflow)) {
1039 if (compute_float_64(exponent, i, negative, d)) {
return d; }
1041 if (!parse_float_fallback(src - uint8_t(negative), &d)) {
1047 simdjson_unused simdjson_inline
bool is_negative(
const uint8_t * src) noexcept {
1048 return (*src ==
'-');
1051 simdjson_unused simdjson_inline simdjson_result<bool> is_integer(
const uint8_t * src) noexcept {
1052 bool negative = (*src ==
'-');
1053 src += uint8_t(negative);
1054 const uint8_t *p = src;
1055 while(
static_cast<uint8_t
>(*p -
'0') <= 9) { p++; }
1057 if (jsoncharutils::is_structural_or_whitespace(*p)) {
return true; }
1061 simdjson_unused simdjson_inline simdjson_result<number_type> get_number_type(
const uint8_t * src) noexcept {
1062 bool negative = (*src ==
'-');
1063 src += uint8_t(negative);
1064 const uint8_t *p = src;
1065 while(
static_cast<uint8_t
>(*p -
'0') <= 9) { p++; }
1067 if (jsoncharutils::is_structural_or_whitespace(*p)) {
1070 if(negative) {
return number_type::signed_integer; }
1073 int digit_count = int(p - src);
1074 if(digit_count >= 19) {
1075 const uint8_t * smaller_big_integer =
reinterpret_cast<const uint8_t *
>(
"9223372036854775808");
1076 if((digit_count >= 20) || (memcmp(src, smaller_big_integer, 19) >= 0)) {
1077 return number_type::unsigned_integer;
1080 return number_type::signed_integer;
1083 return number_type::floating_point_number;
1087 simdjson_unused simdjson_inline simdjson_result<double> parse_double(
const uint8_t * src,
const uint8_t *
const src_end) noexcept {
1092 bool negative = (*src ==
'-');
1093 src += uint8_t(negative);
1099 const uint8_t *p = src;
1101 p += parse_digit(*p, i);
1102 bool leading_zero = (i == 0);
1103 while ((p != src_end) && parse_digit(*p, i)) { p++; }
1106 if ( (leading_zero && p != src+1)) {
return NUMBER_ERROR; }
1111 int64_t exponent = 0;
1113 if (simdjson_likely((p != src_end) && (*p ==
'.'))) {
1115 const uint8_t *start_decimal_digits = p;
1116 if ((p == src_end) || !parse_digit(*p, i)) {
return NUMBER_ERROR; }
1118 while ((p != src_end) && parse_digit(*p, i)) { p++; }
1119 exponent = -(p - start_decimal_digits);
1122 overflow = p-src-1 > 19;
1123 if (simdjson_unlikely(overflow && leading_zero)) {
1125 const uint8_t *start_digits = src + 2;
1126 while (*start_digits ==
'0') { start_digits++; }
1127 overflow = start_digits-src > 19;
1130 overflow = p-src > 19;
1136 if ((p != src_end) && (*p ==
'e' || *p ==
'E')) {
1139 bool exp_neg = *p ==
'-';
1140 p += exp_neg || *p ==
'+';
1143 const uint8_t *start_exp_digits = p;
1144 while ((p != src_end) && parse_digit(*p, exp)) { p++; }
1146 if (p-start_exp_digits == 0 || p-start_exp_digits > 19) {
return NUMBER_ERROR; }
1148 exponent += exp_neg ? 0-exp : exp;
1151 if ((p != src_end) && jsoncharutils::is_not_structural_or_whitespace(*p)) {
return NUMBER_ERROR; }
1153 overflow = overflow || exponent < simdjson::internal::smallest_power || exponent > simdjson::internal::largest_power;
1159 if (simdjson_likely(!overflow)) {
1160 if (compute_float_64(exponent, i, negative, d)) {
return d; }
1162 if (!parse_float_fallback(src - uint8_t(negative), src_end, &d)) {
1168 simdjson_unused simdjson_inline simdjson_result<double> parse_double_in_string(
const uint8_t * src) noexcept {
1172 bool negative = (*(src + 1) ==
'-');
1173 src += uint8_t(negative) + 1;
1179 const uint8_t *p = src;
1180 p += parse_digit(*p, i);
1181 bool leading_zero = (i == 0);
1182 while (parse_digit(*p, i)) { p++; }
1185 if ( (leading_zero && p != src+1)) {
return NUMBER_ERROR; }
1190 int64_t exponent = 0;
1192 if (simdjson_likely(*p ==
'.')) {
1194 const uint8_t *start_decimal_digits = p;
1197 while (parse_digit(*p, i)) { p++; }
1198 exponent = -(p - start_decimal_digits);
1201 overflow = p-src-1 > 19;
1202 if (simdjson_unlikely(overflow && leading_zero)) {
1204 const uint8_t *start_digits = src + 2;
1205 while (*start_digits ==
'0') { start_digits++; }
1206 overflow = start_digits-src > 19;
1209 overflow = p-src > 19;
1215 if (*p ==
'e' || *p ==
'E') {
1217 bool exp_neg = *p ==
'-';
1218 p += exp_neg || *p ==
'+';
1221 const uint8_t *start_exp_digits = p;
1222 while (parse_digit(*p, exp)) { p++; }
1224 if (p-start_exp_digits == 0 || p-start_exp_digits > 19) {
return NUMBER_ERROR; }
1226 exponent += exp_neg ? 0-exp : exp;
1231 overflow = overflow || exponent < simdjson::internal::smallest_power || exponent > simdjson::internal::largest_power;
1237 if (simdjson_likely(!overflow)) {
1238 if (compute_float_64(exponent, i, negative, d)) {
return d; }
1240 if (!parse_float_fallback(src - uint8_t(negative), &d)) {
1251 inline std::ostream&
operator<<(std::ostream& out, number_type type) noexcept {
1253 case number_type::signed_integer: out <<
"integer in [-9223372036854775808,9223372036854775808)";
break;
1254 case number_type::unsigned_integer: out <<
"unsigned integer in [9223372036854775808,18446744073709551616)";
break;
1255 case number_type::floating_point_number: out <<
"floating-point number (binary64)";
break;
1256 default: SIMDJSON_UNREACHABLE();
The top level simdjson namespace, containing everything the library provides.
std::ostream & operator<<(std::ostream &out, error_code error) noexcept
Write the error message to the output stream.
error_code
All possible errors returned by simdjson.
@ INCORRECT_TYPE
JSON element has a different type than user expected.
@ NUMBER_ERROR
Problem while parsing a number.
constexpr size_t SIMDJSON_PADDING
The amount of padding needed in a buffer to parse JSON.