1
- /* auto-generated on 2025-03-27 15:01 :10 -0400. Do not edit! */
1
+ /* auto-generated on 2025-06-04 00:22 :10 -0400. Do not edit! */
2
2
/* including simdjson.cpp: */
3
3
/* begin file simdjson.cpp */
4
4
#define SIMDJSON_SRC_SIMDJSON_CPP
@@ -373,7 +373,7 @@ double from_chars(const char *first, const char* end) noexcept;
373
373
}
374
374
375
375
#ifndef SIMDJSON_EXCEPTIONS
376
- #if __cpp_exceptions
376
+ #if defined( __cpp_exceptions) || defined(_CPPUNWIND)
377
377
#define SIMDJSON_EXCEPTIONS 1
378
378
#else
379
379
#define SIMDJSON_EXCEPTIONS 0
@@ -576,12 +576,14 @@ double from_chars(const char *first, const char* end) noexcept;
576
576
// even if we do not have C++17 support.
577
577
#ifdef __cpp_lib_string_view
578
578
#define SIMDJSON_HAS_STRING_VIEW
579
+ #include <string_view>
579
580
#endif
580
581
581
582
// Some systems have string_view even if we do not have C++17 support,
582
583
// and even if __cpp_lib_string_view is undefined, it is the case
583
584
// with Apple clang version 11.
584
585
// We must handle it. *This is important.*
586
+ #ifndef _MSC_VER
585
587
#ifndef SIMDJSON_HAS_STRING_VIEW
586
588
#if defined __has_include
587
589
// do not combine the next #if with the previous one (unsafe)
@@ -597,6 +599,7 @@ double from_chars(const char *first, const char* end) noexcept;
597
599
#endif // __has_include (<string_view>)
598
600
#endif // defined __has_include
599
601
#endif // def SIMDJSON_HAS_STRING_VIEW
602
+ #endif // def _MSC_VER
600
603
// end of complicated but important routine to try to detect string_view.
601
604
602
605
//
@@ -2607,6 +2610,7 @@ struct simdjson_result_base : protected std::pair<T, error_code> {
2607
2610
* @throw simdjson_error if there was an error.
2608
2611
*/
2609
2612
simdjson_inline operator T&&() && noexcept(false);
2613
+
2610
2614
#endif // SIMDJSON_EXCEPTIONS
2611
2615
2612
2616
/**
@@ -2663,7 +2667,17 @@ struct simdjson_result : public internal::simdjson_result_base<T> {
2663
2667
* @param value The variable to assign the value to. May not be set if there is an error.
2664
2668
*/
2665
2669
simdjson_warn_unused simdjson_inline error_code get(T &value) && noexcept;
2666
-
2670
+ //
2671
+ /**
2672
+ * Copy the value to a provided std::string, only enabled for std::string_view.
2673
+ *
2674
+ * @param value The variable to assign the value to. May not be set if there is an error.
2675
+ */
2676
+ simdjson_warn_unused simdjson_inline error_code get(std::string &value) && noexcept
2677
+ #if SIMDJSON_SUPPORTS_DESERIALIZATION
2678
+ requires (!std::is_same_v<T, std::string>)
2679
+ #endif // SIMDJSON_SUPPORTS_DESERIALIZATION
2680
+ ;
2667
2681
/**
2668
2682
* The error.
2669
2683
*/
@@ -4663,6 +4677,23 @@ simdjson_warn_unused simdjson_inline error_code simdjson_result<T>::get(T &value
4663
4677
return std::forward<internal::simdjson_result_base<T>>(*this).get(value);
4664
4678
}
4665
4679
4680
+ template<typename T>
4681
+ simdjson_warn_unused simdjson_inline error_code
4682
+ simdjson_result<T>::get(std::string &value) && noexcept
4683
+ #if SIMDJSON_SUPPORTS_DESERIALIZATION
4684
+ requires (!std::is_same_v<T, std::string>)
4685
+ #endif // SIMDJSON_SUPPORTS_DESERIALIZATION
4686
+ {
4687
+ // SFINAE : n'active que pour T = std::string_view
4688
+ static_assert(std::is_same<T, std::string_view>::value, "simdjson_result<T>::get(std::string&) n'est disponible que pour T = std::string_view");
4689
+ std::string_view v;
4690
+ error_code error = std::forward<simdjson_result<T>>(*this).get(v);
4691
+ if (!error) {
4692
+ value.assign(v.data(), v.size());
4693
+ }
4694
+ return error;
4695
+ }
4696
+
4666
4697
template<typename T>
4667
4698
simdjson_inline error_code simdjson_result<T>::error() const noexcept {
4668
4699
return internal::simdjson_result_base<T>::error();
@@ -9726,7 +9757,16 @@ simdjson_inline error_code parse_number(const uint8_t *const src, W &writer) {
9726
9757
if (i > uint64_t(INT64_MAX)) {
9727
9758
WRITE_UNSIGNED(i, src, writer);
9728
9759
} else {
9729
- WRITE_INTEGER(negative ? (~i+1) : i, src, writer);
9760
+ #if SIMDJSON_MINUS_ZERO_AS_FLOAT
9761
+ if(i == 0 && negative) {
9762
+ // We have to write -0.0 instead of 0
9763
+ WRITE_DOUBLE(-0.0, src, writer);
9764
+ } else {
9765
+ WRITE_INTEGER(negative ? (~i+1) : i, src, writer);
9766
+ }
9767
+ #else
9768
+ WRITE_INTEGER(negative ? (~i+1) : i, src, writer);
9769
+ #endif
9730
9770
}
9731
9771
if (jsoncharutils::is_not_structural_or_whitespace(*p)) { return INVALID_NUMBER(src); }
9732
9772
return SUCCESS;
@@ -10187,6 +10227,12 @@ simdjson_unused simdjson_inline simdjson_result<number_type> get_number_type(con
10187
10227
if (simdjson_unlikely(digit_count == 19 && memcmp(src, smaller_big_integer, 19) > 0)) {
10188
10228
return number_type::big_integer;
10189
10229
}
10230
+ #if SIMDJSON_MINUS_ZERO_AS_FLOAT
10231
+ if(digit_count == 1 && src[0] == '0') {
10232
+ // We have to write -0.0 instead of 0
10233
+ return number_type::floating_point_number;
10234
+ }
10235
+ #endif
10190
10236
return number_type::signed_integer;
10191
10237
}
10192
10238
// Let us check if we have a big integer (>=2**64).
@@ -16086,7 +16132,16 @@ simdjson_inline error_code parse_number(const uint8_t *const src, W &writer) {
16086
16132
if (i > uint64_t(INT64_MAX)) {
16087
16133
WRITE_UNSIGNED(i, src, writer);
16088
16134
} else {
16089
- WRITE_INTEGER(negative ? (~i+1) : i, src, writer);
16135
+ #if SIMDJSON_MINUS_ZERO_AS_FLOAT
16136
+ if(i == 0 && negative) {
16137
+ // We have to write -0.0 instead of 0
16138
+ WRITE_DOUBLE(-0.0, src, writer);
16139
+ } else {
16140
+ WRITE_INTEGER(negative ? (~i+1) : i, src, writer);
16141
+ }
16142
+ #else
16143
+ WRITE_INTEGER(negative ? (~i+1) : i, src, writer);
16144
+ #endif
16090
16145
}
16091
16146
if (jsoncharutils::is_not_structural_or_whitespace(*p)) { return INVALID_NUMBER(src); }
16092
16147
return SUCCESS;
@@ -16547,6 +16602,12 @@ simdjson_unused simdjson_inline simdjson_result<number_type> get_number_type(con
16547
16602
if (simdjson_unlikely(digit_count == 19 && memcmp(src, smaller_big_integer, 19) > 0)) {
16548
16603
return number_type::big_integer;
16549
16604
}
16605
+ #if SIMDJSON_MINUS_ZERO_AS_FLOAT
16606
+ if(digit_count == 1 && src[0] == '0') {
16607
+ // We have to write -0.0 instead of 0
16608
+ return number_type::floating_point_number;
16609
+ }
16610
+ #endif
16550
16611
return number_type::signed_integer;
16551
16612
}
16552
16613
// Let us check if we have a big integer (>=2**64).
@@ -22310,7 +22371,16 @@ simdjson_inline error_code parse_number(const uint8_t *const src, W &writer) {
22310
22371
if (i > uint64_t(INT64_MAX)) {
22311
22372
WRITE_UNSIGNED(i, src, writer);
22312
22373
} else {
22313
- WRITE_INTEGER(negative ? (~i+1) : i, src, writer);
22374
+ #if SIMDJSON_MINUS_ZERO_AS_FLOAT
22375
+ if(i == 0 && negative) {
22376
+ // We have to write -0.0 instead of 0
22377
+ WRITE_DOUBLE(-0.0, src, writer);
22378
+ } else {
22379
+ WRITE_INTEGER(negative ? (~i+1) : i, src, writer);
22380
+ }
22381
+ #else
22382
+ WRITE_INTEGER(negative ? (~i+1) : i, src, writer);
22383
+ #endif
22314
22384
}
22315
22385
if (jsoncharutils::is_not_structural_or_whitespace(*p)) { return INVALID_NUMBER(src); }
22316
22386
return SUCCESS;
@@ -22771,6 +22841,12 @@ simdjson_unused simdjson_inline simdjson_result<number_type> get_number_type(con
22771
22841
if (simdjson_unlikely(digit_count == 19 && memcmp(src, smaller_big_integer, 19) > 0)) {
22772
22842
return number_type::big_integer;
22773
22843
}
22844
+ #if SIMDJSON_MINUS_ZERO_AS_FLOAT
22845
+ if(digit_count == 1 && src[0] == '0') {
22846
+ // We have to write -0.0 instead of 0
22847
+ return number_type::floating_point_number;
22848
+ }
22849
+ #endif
22774
22850
return number_type::signed_integer;
22775
22851
}
22776
22852
// Let us check if we have a big integer (>=2**64).
@@ -28690,7 +28766,16 @@ simdjson_inline error_code parse_number(const uint8_t *const src, W &writer) {
28690
28766
if (i > uint64_t(INT64_MAX)) {
28691
28767
WRITE_UNSIGNED(i, src, writer);
28692
28768
} else {
28693
- WRITE_INTEGER(negative ? (~i+1) : i, src, writer);
28769
+ #if SIMDJSON_MINUS_ZERO_AS_FLOAT
28770
+ if(i == 0 && negative) {
28771
+ // We have to write -0.0 instead of 0
28772
+ WRITE_DOUBLE(-0.0, src, writer);
28773
+ } else {
28774
+ WRITE_INTEGER(negative ? (~i+1) : i, src, writer);
28775
+ }
28776
+ #else
28777
+ WRITE_INTEGER(negative ? (~i+1) : i, src, writer);
28778
+ #endif
28694
28779
}
28695
28780
if (jsoncharutils::is_not_structural_or_whitespace(*p)) { return INVALID_NUMBER(src); }
28696
28781
return SUCCESS;
@@ -29151,6 +29236,12 @@ simdjson_unused simdjson_inline simdjson_result<number_type> get_number_type(con
29151
29236
if (simdjson_unlikely(digit_count == 19 && memcmp(src, smaller_big_integer, 19) > 0)) {
29152
29237
return number_type::big_integer;
29153
29238
}
29239
+ #if SIMDJSON_MINUS_ZERO_AS_FLOAT
29240
+ if(digit_count == 1 && src[0] == '0') {
29241
+ // We have to write -0.0 instead of 0
29242
+ return number_type::floating_point_number;
29243
+ }
29244
+ #endif
29154
29245
return number_type::signed_integer;
29155
29246
}
29156
29247
// Let us check if we have a big integer (>=2**64).
@@ -35432,7 +35523,16 @@ simdjson_inline error_code parse_number(const uint8_t *const src, W &writer) {
35432
35523
if (i > uint64_t(INT64_MAX)) {
35433
35524
WRITE_UNSIGNED(i, src, writer);
35434
35525
} else {
35435
- WRITE_INTEGER(negative ? (~i+1) : i, src, writer);
35526
+ #if SIMDJSON_MINUS_ZERO_AS_FLOAT
35527
+ if(i == 0 && negative) {
35528
+ // We have to write -0.0 instead of 0
35529
+ WRITE_DOUBLE(-0.0, src, writer);
35530
+ } else {
35531
+ WRITE_INTEGER(negative ? (~i+1) : i, src, writer);
35532
+ }
35533
+ #else
35534
+ WRITE_INTEGER(negative ? (~i+1) : i, src, writer);
35535
+ #endif
35436
35536
}
35437
35537
if (jsoncharutils::is_not_structural_or_whitespace(*p)) { return INVALID_NUMBER(src); }
35438
35538
return SUCCESS;
@@ -35893,6 +35993,12 @@ simdjson_unused simdjson_inline simdjson_result<number_type> get_number_type(con
35893
35993
if (simdjson_unlikely(digit_count == 19 && memcmp(src, smaller_big_integer, 19) > 0)) {
35894
35994
return number_type::big_integer;
35895
35995
}
35996
+ #if SIMDJSON_MINUS_ZERO_AS_FLOAT
35997
+ if(digit_count == 1 && src[0] == '0') {
35998
+ // We have to write -0.0 instead of 0
35999
+ return number_type::floating_point_number;
36000
+ }
36001
+ #endif
35896
36002
return number_type::signed_integer;
35897
36003
}
35898
36004
// Let us check if we have a big integer (>=2**64).
@@ -41998,7 +42104,16 @@ simdjson_inline error_code parse_number(const uint8_t *const src, W &writer) {
41998
42104
if (i > uint64_t(INT64_MAX)) {
41999
42105
WRITE_UNSIGNED(i, src, writer);
42000
42106
} else {
42001
- WRITE_INTEGER(negative ? (~i+1) : i, src, writer);
42107
+ #if SIMDJSON_MINUS_ZERO_AS_FLOAT
42108
+ if(i == 0 && negative) {
42109
+ // We have to write -0.0 instead of 0
42110
+ WRITE_DOUBLE(-0.0, src, writer);
42111
+ } else {
42112
+ WRITE_INTEGER(negative ? (~i+1) : i, src, writer);
42113
+ }
42114
+ #else
42115
+ WRITE_INTEGER(negative ? (~i+1) : i, src, writer);
42116
+ #endif
42002
42117
}
42003
42118
if (jsoncharutils::is_not_structural_or_whitespace(*p)) { return INVALID_NUMBER(src); }
42004
42119
return SUCCESS;
@@ -42459,6 +42574,12 @@ simdjson_unused simdjson_inline simdjson_result<number_type> get_number_type(con
42459
42574
if (simdjson_unlikely(digit_count == 19 && memcmp(src, smaller_big_integer, 19) > 0)) {
42460
42575
return number_type::big_integer;
42461
42576
}
42577
+ #if SIMDJSON_MINUS_ZERO_AS_FLOAT
42578
+ if(digit_count == 1 && src[0] == '0') {
42579
+ // We have to write -0.0 instead of 0
42580
+ return number_type::floating_point_number;
42581
+ }
42582
+ #endif
42462
42583
return number_type::signed_integer;
42463
42584
}
42464
42585
// Let us check if we have a big integer (>=2**64).
@@ -48009,7 +48130,16 @@ simdjson_inline error_code parse_number(const uint8_t *const src, W &writer) {
48009
48130
if (i > uint64_t(INT64_MAX)) {
48010
48131
WRITE_UNSIGNED(i, src, writer);
48011
48132
} else {
48012
- WRITE_INTEGER(negative ? (~i+1) : i, src, writer);
48133
+ #if SIMDJSON_MINUS_ZERO_AS_FLOAT
48134
+ if(i == 0 && negative) {
48135
+ // We have to write -0.0 instead of 0
48136
+ WRITE_DOUBLE(-0.0, src, writer);
48137
+ } else {
48138
+ WRITE_INTEGER(negative ? (~i+1) : i, src, writer);
48139
+ }
48140
+ #else
48141
+ WRITE_INTEGER(negative ? (~i+1) : i, src, writer);
48142
+ #endif
48013
48143
}
48014
48144
if (jsoncharutils::is_not_structural_or_whitespace(*p)) { return INVALID_NUMBER(src); }
48015
48145
return SUCCESS;
@@ -48470,6 +48600,12 @@ simdjson_unused simdjson_inline simdjson_result<number_type> get_number_type(con
48470
48600
if (simdjson_unlikely(digit_count == 19 && memcmp(src, smaller_big_integer, 19) > 0)) {
48471
48601
return number_type::big_integer;
48472
48602
}
48603
+ #if SIMDJSON_MINUS_ZERO_AS_FLOAT
48604
+ if(digit_count == 1 && src[0] == '0') {
48605
+ // We have to write -0.0 instead of 0
48606
+ return number_type::floating_point_number;
48607
+ }
48608
+ #endif
48473
48609
return number_type::signed_integer;
48474
48610
}
48475
48611
// Let us check if we have a big integer (>=2**64).
@@ -53619,7 +53755,16 @@ simdjson_inline error_code parse_number(const uint8_t *const src, W &writer) {
53619
53755
if (i > uint64_t(INT64_MAX)) {
53620
53756
WRITE_UNSIGNED(i, src, writer);
53621
53757
} else {
53622
- WRITE_INTEGER(negative ? (~i+1) : i, src, writer);
53758
+ #if SIMDJSON_MINUS_ZERO_AS_FLOAT
53759
+ if(i == 0 && negative) {
53760
+ // We have to write -0.0 instead of 0
53761
+ WRITE_DOUBLE(-0.0, src, writer);
53762
+ } else {
53763
+ WRITE_INTEGER(negative ? (~i+1) : i, src, writer);
53764
+ }
53765
+ #else
53766
+ WRITE_INTEGER(negative ? (~i+1) : i, src, writer);
53767
+ #endif
53623
53768
}
53624
53769
if (jsoncharutils::is_not_structural_or_whitespace(*p)) { return INVALID_NUMBER(src); }
53625
53770
return SUCCESS;
@@ -54080,6 +54225,12 @@ simdjson_unused simdjson_inline simdjson_result<number_type> get_number_type(con
54080
54225
if (simdjson_unlikely(digit_count == 19 && memcmp(src, smaller_big_integer, 19) > 0)) {
54081
54226
return number_type::big_integer;
54082
54227
}
54228
+ #if SIMDJSON_MINUS_ZERO_AS_FLOAT
54229
+ if(digit_count == 1 && src[0] == '0') {
54230
+ // We have to write -0.0 instead of 0
54231
+ return number_type::floating_point_number;
54232
+ }
54233
+ #endif
54083
54234
return number_type::signed_integer;
54084
54235
}
54085
54236
// Let us check if we have a big integer (>=2**64).
0 commit comments