diff --git a/generic_2ondemand_2document_8h_source.html b/generic_2ondemand_2document_8h_source.html index aa7cf22be..f83ad78a9 100644 --- a/generic_2ondemand_2document_8h_source.html +++ b/generic_2ondemand_2document_8h_source.html @@ -494,7 +494,7 @@ $(document).ready(function(){initNavTree('generic_2ondemand_2document_8h_source.
simdjson::SIMDJSON_IMPLEMENTATION::ondemand::number
A type representing a JSON number.
Definition: json_type.h:32
simdjson::simdjson_result< SIMDJSON_IMPLEMENTATION::ondemand::array >
Definition: array.h:180
simdjson::simdjson_result< SIMDJSON_IMPLEMENTATION::ondemand::array_iterator >
Definition: array_iterator.h:78
-
simdjson::simdjson_result< SIMDJSON_IMPLEMENTATION::ondemand::json_type >
Definition: json_type.h:152
+
simdjson::simdjson_result< SIMDJSON_IMPLEMENTATION::ondemand::json_type >
Definition: json_type.h:150
simdjson::simdjson_result< SIMDJSON_IMPLEMENTATION::ondemand::object >
Definition: object.h:215
simdjson::simdjson_result< SIMDJSON_IMPLEMENTATION::ondemand::raw_json_string >
Definition: raw_json_string.h:192
simdjson::simdjson_result< SIMDJSON_IMPLEMENTATION::ondemand::value >
Definition: value.h:619
diff --git a/json__type_8h_source.html b/json__type_8h_source.html index d1039bcd8..0c2e16bd6 100644 --- a/json__type_8h_source.html +++ b/json__type_8h_source.html @@ -136,47 +136,45 @@ $(document).ready(function(){initNavTree('json__type_8h_source.html',''); initRe
87 protected:
93  friend class value_iterator;
94  template<typename W>
-
95  friend error_code numberparsing::slow_float_parsing(simdjson_unused const uint8_t * src, W writer);
+
95  friend error_code numberparsing::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);
96  template<typename W>
-
97  friend error_code numberparsing::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);
-
98  template<typename W>
-
99  friend error_code numberparsing::parse_number(const uint8_t *const src, W &writer);
-
101  simdjson_inline void append_s64(int64_t value) noexcept;
-
103  simdjson_inline void append_u64(uint64_t value) noexcept;
-
105  simdjson_inline void append_double(double value) noexcept;
-
107  simdjson_inline void skip_double() noexcept;
-
116  union {
-
117  double floating_point_number;
-
118  int64_t signed_integer;
-
119  uint64_t unsigned_integer;
-
120  } payload{0};
-
121  number_type type{number_type::signed_integer};
-
122 };
-
123 
-
130 inline std::ostream& operator<<(std::ostream& out, json_type type) noexcept;
-
131 
-
132 #if SIMDJSON_EXCEPTIONS
-
142 inline std::ostream& operator<<(std::ostream& out, simdjson_result<json_type> &type) noexcept(false);
-
143 #endif
-
144 
-
145 } // namespace ondemand
-
146 } // namespace SIMDJSON_IMPLEMENTATION
-
147 } // namespace simdjson
+
97  friend error_code numberparsing::parse_number(const uint8_t *const src, W &writer);
+
99  simdjson_inline void append_s64(int64_t value) noexcept;
+
101  simdjson_inline void append_u64(uint64_t value) noexcept;
+
103  simdjson_inline void append_double(double value) noexcept;
+
105  simdjson_inline void skip_double() noexcept;
+
114  union {
+
115  double floating_point_number;
+
116  int64_t signed_integer;
+
117  uint64_t unsigned_integer;
+
118  } payload{0};
+
119  number_type type{number_type::signed_integer};
+
120 };
+
121 
+
128 inline std::ostream& operator<<(std::ostream& out, json_type type) noexcept;
+
129 
+
130 #if SIMDJSON_EXCEPTIONS
+
140 inline std::ostream& operator<<(std::ostream& out, simdjson_result<json_type> &type) noexcept(false);
+
141 #endif
+
142 
+
143 } // namespace ondemand
+
144 } // namespace SIMDJSON_IMPLEMENTATION
+
145 } // namespace simdjson
+
146 
+
147 namespace simdjson {
148 
-
149 namespace simdjson {
-
150 
-
151 template<>
-
152 struct simdjson_result<SIMDJSON_IMPLEMENTATION::ondemand::json_type> : public SIMDJSON_IMPLEMENTATION::implementation_simdjson_result_base<SIMDJSON_IMPLEMENTATION::ondemand::json_type> {
-
153 public:
-
154  simdjson_inline simdjson_result(SIMDJSON_IMPLEMENTATION::ondemand::json_type &&value) noexcept;
-
155  simdjson_inline simdjson_result(error_code error) noexcept;
-
156  simdjson_inline simdjson_result() noexcept = default;
-
157  simdjson_inline ~simdjson_result() noexcept = default;
-
158 };
+
149 template<>
+
150 struct simdjson_result<SIMDJSON_IMPLEMENTATION::ondemand::json_type> : public SIMDJSON_IMPLEMENTATION::implementation_simdjson_result_base<SIMDJSON_IMPLEMENTATION::ondemand::json_type> {
+
151 public:
+
152  simdjson_inline simdjson_result(SIMDJSON_IMPLEMENTATION::ondemand::json_type &&value) noexcept;
+
153  simdjson_inline simdjson_result(error_code error) noexcept;
+
154  simdjson_inline simdjson_result() noexcept = default;
+
155  simdjson_inline ~simdjson_result() noexcept = default;
+
156 };
+
157 
+
158 } // namespace simdjson
159 
-
160 } // namespace simdjson
-
161 
-
162 #endif // SIMDJSON_GENERIC_ONDEMAND_JSON_TYPE_H
+
160 #endif // SIMDJSON_GENERIC_ONDEMAND_JSON_TYPE_H
simdjson::SIMDJSON_IMPLEMENTATION::ondemand::array
A forward-only JSON array.
Definition: array.h:17
simdjson::SIMDJSON_IMPLEMENTATION::ondemand::value
An ephemeral JSON value returned during iteration.
Definition: value.h:18
simdjson::SIMDJSON_IMPLEMENTATION::ondemand::number_type
simdjson::SIMDJSON_IMPLEMENTATION::number_type number_type
Definition: base.h:21
diff --git a/namespacesimdjson.js b/namespacesimdjson.js index d1ab8e766..81e114fcc 100644 --- a/namespacesimdjson.js +++ b/namespacesimdjson.js @@ -9,7 +9,6 @@ var namespacesimdjson = [ "SIMDJSON_IMPLEMENTATION", null, [ [ "numberparsing", null, [ [ "parse_number", "numberparsing_8h.html#abfab4a11a66cf3429d4b584165a0d47e", null ], - [ "slow_float_parsing", "numberparsing_8h.html#a8a19d7f5fc0e7495a136073daee8df78", null ], [ "write_float", "numberparsing_8h.html#a4c645a86ea19178e55e6ceaa96ad29ae", null ] ] ], [ "ondemand", "namespacesimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand.html", "namespacesimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand" ], diff --git a/navtreedata.js b/navtreedata.js index f47a98c99..0e3b336bc 100644 --- a/navtreedata.js +++ b/navtreedata.js @@ -189,12 +189,12 @@ var NAVTREE = var NAVTREEINDEX = [ -"", -"classsimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1object.html#a7c20332b4481f29ace969e40cfce5f5f", -"classsimdjson_1_1dom_1_1object.html#acc66a2f2eb74fbe359d4064531764f50", -"jsoncharutils_8h_source.html", -"namespacesimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand.html#aa3354f8230db6df962b47633591fa232", -"structsimdjson_1_1simdjson__result_3_01_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1document__reference_01_4.html#a84d35046d2328c1b52052b60abdfff5f" +"amalgamated_8h_source.html", +"classsimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1object.html#ab6b2e9769ce75fc625aa91504f26d82b", +"classsimdjson_1_1dom_1_1object_1_1iterator.html", +"jsonparser_8h_source.html", +"namespacesimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand.html#ac915f0c06e5ab0363e09593bba651330", +"structsimdjson_1_1simdjson__result_3_01_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1document__reference_01_4.html#a9e474f04cbd9cf41a1e698ba6bfbf701" ]; var SYNCONMSG = 'click to disable panel synchronisation'; diff --git a/navtreeindex0.js b/navtreeindex0.js index 4fda0fee9..2f82b8c8f 100644 --- a/navtreeindex0.js +++ b/navtreeindex0.js @@ -1,9 +1,5 @@ var NAVTREEINDEX0 = { -"":[10,0,0,6], -"":[10,0,0,6,0], -"":[10,0,1], -"":[10,0,0,6,1,0], "amalgamated_8h_source.html":[12,0,0,0,4,1], "annotated.html":[11,0], "arm64_2base_8h_source.html":[12,0,0,0,0,0], @@ -249,5 +245,9 @@ var NAVTREEINDEX0 = "classsimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1object.html#a60ad1270b86c6a0c27c03b685aec9666":[11,0,0,1,0,7,13], "classsimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1object.html#a62b96abab9d1338d5f5e513f90f8d7d0":[11,0,0,1,0,7,20], "classsimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1object.html#a6724eb440d3fb40018a9a47c715352ed":[11,0,0,1,0,7,1], -"classsimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1object.html#a71600033791f9c6bbc9f40fb2f82fdc8":[11,0,0,1,0,7,15] +"classsimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1object.html#a71600033791f9c6bbc9f40fb2f82fdc8":[11,0,0,1,0,7,15], +"classsimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1object.html#a7c20332b4481f29ace969e40cfce5f5f":[11,0,0,1,0,7,17], +"classsimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1object.html#a9f1cd920980a8bc0330d2c7f1f0be74b":[11,0,0,1,0,7,14], +"classsimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1object.html#aa14649f261616070b04829c9ba6b28da":[11,0,0,1,0,7,18], +"classsimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1object.html#aa25020165cc5a191026a243a10da6558":[11,0,0,1,0,7,8] }; diff --git a/navtreeindex1.js b/navtreeindex1.js index 5e0700f7d..1ee13adee 100644 --- a/navtreeindex1.js +++ b/navtreeindex1.js @@ -1,9 +1,5 @@ var NAVTREEINDEX1 = { -"classsimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1object.html#a7c20332b4481f29ace969e40cfce5f5f":[11,0,0,1,0,7,17], -"classsimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1object.html#a9f1cd920980a8bc0330d2c7f1f0be74b":[11,0,0,1,0,7,14], -"classsimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1object.html#aa14649f261616070b04829c9ba6b28da":[11,0,0,1,0,7,18], -"classsimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1object.html#aa25020165cc5a191026a243a10da6558":[11,0,0,1,0,7,8], "classsimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1object.html#ab6b2e9769ce75fc625aa91504f26d82b":[11,0,0,1,0,7,7], "classsimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1object.html#ad210f9115679a625ada433add55eff51":[11,0,0,1,0,7,12], "classsimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1object.html#ad742392a9223e096f1be16b7bbf20ca8":[11,0,0,1,0,7,6], @@ -249,5 +245,9 @@ var NAVTREEINDEX1 = "classsimdjson_1_1dom_1_1object.html#a5db654c4e603254bd308a7c068d79c43":[11,0,0,0,4,11], "classsimdjson_1_1dom_1_1object.html#a79cf291477bcaa1bf2328411b411587d":[11,0,0,0,4,6], "classsimdjson_1_1dom_1_1object.html#a93ec5c36aae913f266f533b2e02bc873":[11,0,0,0,4,9], -"classsimdjson_1_1dom_1_1object.html#ab075da9eb7678f6321cecf4cbd196039":[11,0,0,0,4,3] +"classsimdjson_1_1dom_1_1object.html#ab075da9eb7678f6321cecf4cbd196039":[11,0,0,0,4,3], +"classsimdjson_1_1dom_1_1object.html#acc66a2f2eb74fbe359d4064531764f50":[11,0,0,0,4,8], +"classsimdjson_1_1dom_1_1object.html#ace84581be0fee46d5128c49710522aba":[11,0,0,0,4,4], +"classsimdjson_1_1dom_1_1object.html#ae2e1a8cbaab9d352495d1dc993407be3":[11,0,0,0,4,1], +"classsimdjson_1_1dom_1_1object.html#afe127a7e9ec8dab9ec76160525a68a83":[11,0,0,0,4,5] }; diff --git a/navtreeindex2.js b/navtreeindex2.js index fe2e59648..1a348bfc0 100644 --- a/navtreeindex2.js +++ b/navtreeindex2.js @@ -1,9 +1,5 @@ var NAVTREEINDEX2 = { -"classsimdjson_1_1dom_1_1object.html#acc66a2f2eb74fbe359d4064531764f50":[11,0,0,0,4,8], -"classsimdjson_1_1dom_1_1object.html#ace84581be0fee46d5128c49710522aba":[11,0,0,0,4,4], -"classsimdjson_1_1dom_1_1object.html#ae2e1a8cbaab9d352495d1dc993407be3":[11,0,0,0,4,1], -"classsimdjson_1_1dom_1_1object.html#afe127a7e9ec8dab9ec76160525a68a83":[11,0,0,0,4,5], "classsimdjson_1_1dom_1_1object_1_1iterator.html":[11,0,0,0,4,0], "classsimdjson_1_1dom_1_1object_1_1iterator.html#a05f201b94ff4852a1f41bca76595280d":[11,0,0,0,4,0,17], "classsimdjson_1_1dom_1_1object_1_1iterator.html#a1da5ce328cc2609432be961736c6e810":[11,0,0,0,4,0,9], @@ -249,5 +245,9 @@ var NAVTREEINDEX2 = "json__iterator-inl_8h_source.html":[12,0,0,0,4,0,13], "json__iterator_8h_source.html":[12,0,0,0,4,0,14], "json__type-inl_8h_source.html":[12,0,0,0,4,0,15], -"json__type_8h_source.html":[12,0,0,0,4,0,16] +"json__type_8h_source.html":[12,0,0,0,4,0,16], +"jsoncharutils_8h_source.html":[12,0,0,0,4,8], +"jsoncharutils__tables_8h_source.html":[12,0,0,0,7,3], +"jsonformatutils_8h_source.html":[12,0,0,0,7,4], +"jsonioutil_8h_source.html":[12,0,0,0,24] }; diff --git a/navtreeindex3.js b/navtreeindex3.js index 460591764..6b03b85ca 100644 --- a/navtreeindex3.js +++ b/navtreeindex3.js @@ -1,9 +1,5 @@ var NAVTREEINDEX3 = { -"jsoncharutils_8h_source.html":[12,0,0,0,4,8], -"jsoncharutils__tables_8h_source.html":[12,0,0,0,7,3], -"jsonformatutils_8h_source.html":[12,0,0,0,7,4], -"jsonioutil_8h_source.html":[12,0,0,0,24], "jsonparser_8h_source.html":[12,0,0,0,2,9], "logger-inl_8h.html#a0176c136680aa97eb8bd8f57033f41be":[10,0,0,6,1,0,9], "logger-inl_8h.html#a12f4fdff59099b28730ba4288877437f":[10,0,0,6,1,0,16], @@ -249,5 +245,9 @@ var NAVTREEINDEX3 = "namespacesimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand.html#a6f753d5e1bc479321c51b54392a96a65":[10,0,0,6,1,22], "namespacesimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand.html#a7cd33d336f2ede5302be79ada9e7bffe":[10,0,0,6,1,30], "namespacesimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand.html#a8dcb00bbb408a0f4ed45601b6de755a6":[10,0,0,6,1,17], -"namespacesimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand.html#a997747305f387c28e46394c0955d2937":[10,0,0,6,1,28] +"namespacesimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand.html#a997747305f387c28e46394c0955d2937":[10,0,0,6,1,28], +"namespacesimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand.html#aa3354f8230db6df962b47633591fa232":[10,0,0,6,1,23], +"namespacesimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand.html#aab771b17058b0c93bdd0a8679c2c4d84":[10,0,0,6,1,32], +"namespacesimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand.html#ab10943c6107de5337f376a6939f817af":[10,0,0,6,1,20], +"namespacesimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand.html#ac3a4f6af474f2b5f6d749f7452bb5477":[10,0,0,6,1,25] }; diff --git a/navtreeindex4.js b/navtreeindex4.js index 82d9e0ba0..e08ae3ee2 100644 --- a/navtreeindex4.js +++ b/navtreeindex4.js @@ -1,9 +1,5 @@ var NAVTREEINDEX4 = { -"namespacesimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand.html#aa3354f8230db6df962b47633591fa232":[10,0,0,6,1,23], -"namespacesimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand.html#aab771b17058b0c93bdd0a8679c2c4d84":[10,0,0,6,1,32], -"namespacesimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand.html#ab10943c6107de5337f376a6939f817af":[10,0,0,6,1,20], -"namespacesimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand.html#ac3a4f6af474f2b5f6d749f7452bb5477":[10,0,0,6,1,25], "namespacesimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand.html#ac915f0c06e5ab0363e09593bba651330":[10,0,0,6,1,16], "namespacesimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand.html#ac915f0c06e5ab0363e09593bba651330a37a6259cc0c1dae299a7866489dff0bd":[10,0,0,6,1,16,5], "namespacesimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand.html#ac915f0c06e5ab0363e09593bba651330a84e2c64f38f78ba3ea5c905ab5a2da27":[10,0,0,6,1,16,4], @@ -38,8 +34,7 @@ var NAVTREEINDEX4 = "namespacesimdjson_1_1icelake.html":[10,0,0,4], "namespacesimdjson_1_1ppc64.html":[10,0,0,5], "namespacesimdjson_1_1westmere.html":[10,0,0,7], -"numberparsing_8h.html#a4c645a86ea19178e55e6ceaa96ad29ae":[10,0,0,6,0,2], -"numberparsing_8h.html#a8a19d7f5fc0e7495a136073daee8df78":[10,0,0,6,0,1], +"numberparsing_8h.html#a4c645a86ea19178e55e6ceaa96ad29ae":[10,0,0,6,0,1], "numberparsing_8h.html#abfab4a11a66cf3429d4b584165a0d47e":[10,0,0,6,0,0], "numberparsing_8h.html#ade2dc27fe18a87c9fb48782885fc76a3":[10,0,0,6,6], "numberparsing_8h_source.html":[12,0,0,0,4,9], @@ -95,26 +90,25 @@ var NAVTREEINDEX4 = "structsimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1implementation__simdjson__result__base.html#af8a436d40886a295f618311d3849d7e5":[11,0,0,1,3,2], "structsimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1implementation__simdjson__result__base.html#affadf1e1f762248d60950e333b739820":[11,0,0,1,3,7], "structsimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1number.html":[11,0,0,1,0,6], -"structsimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1number.html#a0902647d571633bcaf937831430df3ba":[11,0,0,1,0,6,19], -"structsimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1number.html#a2b56b11b68e621bbd8ce2051ed10ab60":[11,0,0,1,0,6,18], +"structsimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1number.html#a0902647d571633bcaf937831430df3ba":[11,0,0,1,0,6,18], +"structsimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1number.html#a2b56b11b68e621bbd8ce2051ed10ab60":[11,0,0,1,0,6,17], "structsimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1number.html#a31e829fc9dac6ebac9dca7af20898b53":[11,0,0,1,0,6,15], "structsimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1number.html#a38d6b4b4e91f30c8def71997d23454c2":[11,0,0,1,0,6,9], "structsimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1number.html#a41dc1bfd660e0b9c86cb5a5171fd7c02":[11,0,0,1,0,6,3], "structsimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1number.html#a48f9e54ebd40e1c060be0a4b1d4ff823":[11,0,0,1,0,6,8], -"structsimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1number.html#a4963fde41cc9ccb03339a4594c005e04":[11,0,0,1,0,6,17], -"structsimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1number.html#a5053e80f5724f8e1ce7dc513b2c93463":[11,0,0,1,0,6,16], +"structsimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1number.html#a4963fde41cc9ccb03339a4594c005e04":[11,0,0,1,0,6,16], "structsimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1number.html#a5d3e0d03bfe425c824dff96329c2f168":[11,0,0,1,0,6,12], -"structsimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1number.html#a73da034f579d79dc2803063e7178a899":[11,0,0,1,0,6,22], +"structsimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1number.html#a73da034f579d79dc2803063e7178a899":[11,0,0,1,0,6,21], "structsimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1number.html#a8c8d29d831635c958e87de0cc2dab8b4":[11,0,0,1,0,6,6], "structsimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1number.html#a92b12b32ee177c2a818618d0595d2584":[11,0,0,1,0,6,5], -"structsimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1number.html#aa17e81138859bcef934d9502a9852049":[11,0,0,1,0,6,20], +"structsimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1number.html#aa17e81138859bcef934d9502a9852049":[11,0,0,1,0,6,19], "structsimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1number.html#aa3481ec0d0726a732688b7fc64372049":[11,0,0,1,0,6,2], "structsimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1number.html#aad531f215d835148bc5bcd49c5cae844":[11,0,0,1,0,6,11], "structsimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1number.html#ab261642a30f5e26b0769ce701cd5b9f8":[11,0,0,1,0,6,4], "structsimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1number.html#abb713c2347a676fe6514e2eae97c4f5d":[11,0,0,1,0,6,13], "structsimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1number.html#ac6b75b1d1af73c9ef8958e573c367e1c":[11,0,0,1,0,6,14], -"structsimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1number.html#ad4f5dee3c5d0c1f3b545d894ec331309":[11,0,0,1,0,6,23], -"structsimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1number.html#adb07d931b15145b11886aede86da4295":[11,0,0,1,0,6,21], +"structsimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1number.html#ad4f5dee3c5d0c1f3b545d894ec331309":[11,0,0,1,0,6,22], +"structsimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1number.html#adb07d931b15145b11886aede86da4295":[11,0,0,1,0,6,20], "structsimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1number.html#adb931b17ba9d4d41dd8111ad9288256c":[11,0,0,1,0,6,1], "structsimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1number.html#ae5b327f855878cba9b026059a1fc8a1b":[11,0,0,1,0,6,0], "structsimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1number.html#af0e89976b80a7a7dedaf8c1a7cfd64a2":[11,0,0,1,0,6,10], @@ -219,8 +213,8 @@ var NAVTREEINDEX4 = "structsimdjson_1_1simdjson__result_3_01_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1document_01_4.html#ac994a43ba5e7fbde29d82c8d437c5fb7":[11,0,0,10,53], "structsimdjson_1_1simdjson__result_3_01_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1document_01_4.html#ad2c7498f364cf7803f83408a8629a5ac":[11,0,0,10,47], "structsimdjson_1_1simdjson__result_3_01_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1document_01_4.html#ad93b76ab3636d40ce75059e0f8653c6f":[11,0,0,10,8], -"structsimdjson_1_1simdjson__result_3_01_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1document_01_4.html#ada47799dcb5e64e43851d78d346b1d47":[11,0,0,10,25], "structsimdjson_1_1simdjson__result_3_01_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1document_01_4.html#ada47799dcb5e64e43851d78d346b1d47":[11,0,0,10,24], +"structsimdjson_1_1simdjson__result_3_01_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1document_01_4.html#ada47799dcb5e64e43851d78d346b1d47":[11,0,0,10,25], "structsimdjson_1_1simdjson__result_3_01_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1document_01_4.html#adb70072b98e8c3c650ce695f3e928e66":[11,0,0,10,16], "structsimdjson_1_1simdjson__result_3_01_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1document_01_4.html#adb70072b98e8c3c650ce695f3e928e66":[11,0,0,10,14], "structsimdjson_1_1simdjson__result_3_01_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1document_01_4.html#ae69c9218f418dab3b1aafeb2b6504fab":[11,0,0,10,56], @@ -249,5 +243,11 @@ var NAVTREEINDEX4 = "structsimdjson_1_1simdjson__result_3_01_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1document__reference_01_4.html#a68051e56ba7cbc7951bdc49d02bb62fa":[11,0,0,11,1], "structsimdjson_1_1simdjson__result_3_01_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1document__reference_01_4.html#a6aae812b1929c086b593c0b3bad9d333":[11,0,0,11,33], "structsimdjson_1_1simdjson__result_3_01_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1document__reference_01_4.html#a6c9dc17807098fba9f964e792c7daf2e":[11,0,0,11,25], -"structsimdjson_1_1simdjson__result_3_01_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1document__reference_01_4.html#a6cdc33399794644363a720d6f271dd8d":[11,0,0,11,22] +"structsimdjson_1_1simdjson__result_3_01_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1document__reference_01_4.html#a6cdc33399794644363a720d6f271dd8d":[11,0,0,11,22], +"structsimdjson_1_1simdjson__result_3_01_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1document__reference_01_4.html#a84d35046d2328c1b52052b60abdfff5f":[11,0,0,11,5], +"structsimdjson_1_1simdjson__result_3_01_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1document__reference_01_4.html#a858f380c29315521e43dd6025785e7a4":[11,0,0,11,40], +"structsimdjson_1_1simdjson__result_3_01_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1document__reference_01_4.html#a90ecb32d9f0c497568d4de9b9affcb04":[11,0,0,11,23], +"structsimdjson_1_1simdjson__result_3_01_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1document__reference_01_4.html#a940c313d530e0254342235d441e334b0":[11,0,0,11,6], +"structsimdjson_1_1simdjson__result_3_01_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1document__reference_01_4.html#a956a0b0a4f8f910c45be61370ae96586":[11,0,0,11,32], +"structsimdjson_1_1simdjson__result_3_01_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1document__reference_01_4.html#a9d15caa939a40325a3dabbe3224ddbbf":[11,0,0,11,41] }; diff --git a/navtreeindex5.js b/navtreeindex5.js index c8ff6ca9f..0e7a54c2a 100644 --- a/navtreeindex5.js +++ b/navtreeindex5.js @@ -1,11 +1,5 @@ var NAVTREEINDEX5 = { -"structsimdjson_1_1simdjson__result_3_01_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1document__reference_01_4.html#a84d35046d2328c1b52052b60abdfff5f":[11,0,0,11,5], -"structsimdjson_1_1simdjson__result_3_01_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1document__reference_01_4.html#a858f380c29315521e43dd6025785e7a4":[11,0,0,11,40], -"structsimdjson_1_1simdjson__result_3_01_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1document__reference_01_4.html#a90ecb32d9f0c497568d4de9b9affcb04":[11,0,0,11,23], -"structsimdjson_1_1simdjson__result_3_01_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1document__reference_01_4.html#a940c313d530e0254342235d441e334b0":[11,0,0,11,6], -"structsimdjson_1_1simdjson__result_3_01_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1document__reference_01_4.html#a956a0b0a4f8f910c45be61370ae96586":[11,0,0,11,32], -"structsimdjson_1_1simdjson__result_3_01_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1document__reference_01_4.html#a9d15caa939a40325a3dabbe3224ddbbf":[11,0,0,11,41], "structsimdjson_1_1simdjson__result_3_01_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1document__reference_01_4.html#a9e474f04cbd9cf41a1e698ba6bfbf701":[11,0,0,11,46], "structsimdjson_1_1simdjson__result_3_01_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1document__reference_01_4.html#aa2873ff8fc330dd1138bba61e7487287":[11,0,0,11,43], "structsimdjson_1_1simdjson__result_3_01_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1document__reference_01_4.html#aa53af9357f3c3aa144ccda80ed709d4c":[11,0,0,11,0], @@ -200,5 +194,9 @@ var NAVTREEINDEX5 = "westmere_2ondemand_8h_source.html":[12,0,0,0,10,8], "westmere_2simd_8h_source.html":[12,0,0,0,10,9], "westmere_2stringparsing__defs_8h_source.html":[12,0,0,0,10,10], -"westmere_8h_source.html":[12,0,0,0,35] +"westmere_8h_source.html":[12,0,0,0,35], +"":[10,0,0,6], +"":[10,0,0,6,0], +"":[10,0,1], +"":[10,0,0,6,1,0] }; diff --git a/numberparsing_8h_source.html b/numberparsing_8h_source.html index c1057d35d..4651481a1 100644 --- a/numberparsing_8h_source.html +++ b/numberparsing_8h_source.html @@ -535,222 +535,222 @@ $(document).ready(function(){initNavTree('numberparsing_8h_source.html',''); ini
445 
446 } // unnamed namespace
447 
-
449 template<typename W>
-
450 error_code slow_float_parsing(simdjson_unused const uint8_t * src, W writer) {
-
451  double d;
-
452  if (parse_float_fallback(src, &d)) {
-
453  writer.append_double(d);
-
454  return SUCCESS;
-
455  }
-
456  return INVALID_NUMBER(src);
-
457 }
-
458 
-
460 template<typename W>
-
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) {
-
462  // If we frequently had to deal with long strings of digits,
-
463  // we could extend our code by using a 128-bit integer instead
-
464  // of a 64-bit integer. However, this is uncommon in practice.
-
465  //
-
466  // 9999999999999999999 < 2**64 so we can accommodate 19 digits.
-
467  // If we have a decimal separator, then digit_count - 1 is the number of digits, but we
-
468  // may not have a decimal separator!
-
469  if (simdjson_unlikely(digit_count > 19 && significant_digits(start_digits, digit_count) > 19)) {
-
470  // Ok, chances are good that we had an overflow!
-
471  // this is almost never going to get called!!!
-
472  // we start anew, going slowly!!!
-
473  // This will happen in the following examples:
-
474  // 10000000000000000000000000000000000000000000e+308
-
475  // 3.1415926535897932384626433832795028841971693993751
-
476  //
-
477  // NOTE: This makes a *copy* of the writer and passes it to slow_float_parsing. This happens
-
478  // because slow_float_parsing is a non-inlined function. If we passed our writer reference to
-
479  // it, it would force it to be stored in memory, preventing the compiler from picking it apart
-
480  // and putting into registers. i.e. if we pass it as reference, it gets slow.
-
481  // This is what forces the skip_double, as well.
-
482  error_code error = slow_float_parsing(src, writer);
-
483  writer.skip_double();
-
484  return error;
-
485  }
-
486  // NOTE: it's weird that the simdjson_unlikely() only wraps half the if, but it seems to get slower any other
-
487  // way we've tried: https://github.com/simdjson/simdjson/pull/990#discussion_r448497331
-
488  // To future reader: we'd love if someone found a better way, or at least could explain this result!
-
489  if (simdjson_unlikely(exponent < simdjson::internal::smallest_power) || (exponent > simdjson::internal::largest_power)) {
-
490  //
-
491  // Important: smallest_power is such that it leads to a zero value.
-
492  // Observe that 18446744073709551615e-343 == 0, i.e. (2**64 - 1) e -343 is zero
-
493  // so something x 10^-343 goes to zero, but not so with something x 10^-342.
-
494  static_assert(simdjson::internal::smallest_power <= -342, "smallest_power is not small enough");
-
495  //
-
496  if((exponent < simdjson::internal::smallest_power) || (i == 0)) {
-
497  // E.g. Parse "-0.0e-999" into the same value as "-0.0". See https://en.wikipedia.org/wiki/Signed_zero
-
498  WRITE_DOUBLE(negative ? -0.0 : 0.0, src, writer);
-
499  return SUCCESS;
-
500  } else { // (exponent > largest_power) and (i != 0)
-
501  // We have, for sure, an infinite value and simdjson refuses to parse infinite values.
-
502  return INVALID_NUMBER(src);
-
503  }
-
504  }
-
505  double d;
-
506  if (!compute_float_64(exponent, i, negative, d)) {
-
507  // we are almost never going to get here.
-
508  if (!parse_float_fallback(src, &d)) { return INVALID_NUMBER(src); }
-
509  }
-
510  WRITE_DOUBLE(d, src, writer);
-
511  return SUCCESS;
-
512 }
+
449 static error_code slow_float_parsing(simdjson_unused const uint8_t * src, double* answer) {
+
450  if (parse_float_fallback(src, answer)) {
+
451  return SUCCESS;
+
452  }
+
453  return INVALID_NUMBER(src);
+
454 }
+
455 
+
457 template<typename W>
+
458 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) {
+
459  // If we frequently had to deal with long strings of digits,
+
460  // we could extend our code by using a 128-bit integer instead
+
461  // of a 64-bit integer. However, this is uncommon in practice.
+
462  //
+
463  // 9999999999999999999 < 2**64 so we can accommodate 19 digits.
+
464  // If we have a decimal separator, then digit_count - 1 is the number of digits, but we
+
465  // may not have a decimal separator!
+
466  if (simdjson_unlikely(digit_count > 19 && significant_digits(start_digits, digit_count) > 19)) {
+
467  // Ok, chances are good that we had an overflow!
+
468  // this is almost never going to get called!!!
+
469  // we start anew, going slowly!!!
+
470  // This will happen in the following examples:
+
471  // 10000000000000000000000000000000000000000000e+308
+
472  // 3.1415926535897932384626433832795028841971693993751
+
473  //
+
474  // NOTE: We do not pass a reference to the to slow_float_parsing. If we passed our writer
+
475  // reference to it, it would force it to be stored in memory, preventing the compiler from
+
476  // picking it apart and putting into registers. i.e. if we pass it as reference,
+
477  // it gets slow.
+
478  double d;
+
479  error_code error = slow_float_parsing(src, &d);
+
480  writer.append_double(d);
+
481  return error;
+
482  }
+
483  // NOTE: it's weird that the simdjson_unlikely() only wraps half the if, but it seems to get slower any other
+
484  // way we've tried: https://github.com/simdjson/simdjson/pull/990#discussion_r448497331
+
485  // To future reader: we'd love if someone found a better way, or at least could explain this result!
+
486  if (simdjson_unlikely(exponent < simdjson::internal::smallest_power) || (exponent > simdjson::internal::largest_power)) {
+
487  //
+
488  // Important: smallest_power is such that it leads to a zero value.
+
489  // Observe that 18446744073709551615e-343 == 0, i.e. (2**64 - 1) e -343 is zero
+
490  // so something x 10^-343 goes to zero, but not so with something x 10^-342.
+
491  static_assert(simdjson::internal::smallest_power <= -342, "smallest_power is not small enough");
+
492  //
+
493  if((exponent < simdjson::internal::smallest_power) || (i == 0)) {
+
494  // E.g. Parse "-0.0e-999" into the same value as "-0.0". See https://en.wikipedia.org/wiki/Signed_zero
+
495  WRITE_DOUBLE(negative ? -0.0 : 0.0, src, writer);
+
496  return SUCCESS;
+
497  } else { // (exponent > largest_power) and (i != 0)
+
498  // We have, for sure, an infinite value and simdjson refuses to parse infinite values.
+
499  return INVALID_NUMBER(src);
+
500  }
+
501  }
+
502  double d;
+
503  if (!compute_float_64(exponent, i, negative, d)) {
+
504  // we are almost never going to get here.
+
505  if (!parse_float_fallback(src, &d)) { return INVALID_NUMBER(src); }
+
506  }
+
507  WRITE_DOUBLE(d, src, writer);
+
508  return SUCCESS;
+
509 }
+
510 
+
511 // for performance analysis, it is sometimes useful to skip parsing
+
512 #ifdef SIMDJSON_SKIPNUMBERPARSING
513 
-
514 // for performance analysis, it is sometimes useful to skip parsing
-
515 #ifdef SIMDJSON_SKIPNUMBERPARSING
-
516 
-
517 template<typename W>
-
518 simdjson_inline error_code parse_number(const uint8_t *const, W &writer) {
-
519  writer.append_s64(0); // always write zero
-
520  return SUCCESS; // always succeeds
-
521 }
-
522 
-
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; }
-
532 #else
-
533 
-
534 // parse the number at src
-
535 // define JSON_TEST_NUMBERS for unit testing
-
536 //
-
537 // It is assumed that the number is followed by a structural ({,},],[) character
-
538 // or a white space character. If that is not the case (e.g., when the JSON
-
539 // document is made of a single number), then it is necessary to copy the
-
540 // content and append a space before calling this function.
-
541 //
-
542 // Our objective is accurate parsing (ULP of 0) at high speed.
-
543 template<typename W>
-
544 simdjson_inline error_code parse_number(const uint8_t *const src, W &writer) {
-
545 
-
546  //
-
547  // Check for minus sign
-
548  //
-
549  bool negative = (*src == '-');
-
550  const uint8_t *p = src + uint8_t(negative);
-
551 
-
552  //
-
553  // Parse the integer part.
-
554  //
-
555  // PERF NOTE: we don't use is_made_of_eight_digits_fast because large integers like 123456789 are rare
-
556  const uint8_t *const start_digits = p;
-
557  uint64_t i = 0;
-
558  while (parse_digit(*p, i)) { p++; }
-
559 
-
560  // If there were no digits, or if the integer starts with 0 and has more than one digit, it's an error.
-
561  // Optimization note: size_t is expected to be unsigned.
-
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); }
-
564 
-
565  //
-
566  // Handle floats if there is a . or e (or both)
-
567  //
-
568  int64_t exponent = 0;
-
569  bool is_float = false;
-
570  if ('.' == *p) {
-
571  is_float = true;
-
572  ++p;
-
573  SIMDJSON_TRY( parse_decimal_after_separator(src, p, i, exponent) );
-
574  digit_count = int(p - start_digits); // used later to guard against overflows
-
575  }
-
576  if (('e' == *p) || ('E' == *p)) {
-
577  is_float = true;
-
578  ++p;
-
579  SIMDJSON_TRY( parse_exponent(src, p, exponent) );
-
580  }
-
581  if (is_float) {
-
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); }
-
585  return SUCCESS;
-
586  }
-
587 
-
588  // The longest negative 64-bit number is 19 digits.
-
589  // The longest positive 64-bit number is 20 digits.
-
590  // We do it this way so we don't trigger this branch unless we must.
-
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) {
-
594  if (negative) {
-
595  // Anything negative above INT64_MAX+1 is invalid
-
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); }
-
599  return SUCCESS;
-
600  // Positive overflow check:
-
601  // - A 20 digit number starting with 2-9 is overflow, because 18,446,744,073,709,551,615 is the
-
602  // biggest uint64_t.
-
603  // - A 20 digit number starting with 1 is overflow if it is less than INT64_MAX.
-
604  // If we got here, it's a 20 digit number starting with the digit "1".
-
605  // - If a 20 digit number starting with 1 overflowed (i*10+digit), the result will be smaller
-
606  // than 1,553,255,926,290,448,384.
-
607  // - That is smaller than the smallest possible 20-digit number the user could write:
-
608  // 10,000,000,000,000,000,000.
-
609  // - Therefore, if the number is positive and lower than that, it's overflow.
-
610  // - The value we are looking at is less than or equal to INT64_MAX.
-
611  //
-
612  } else if (src[0] != uint8_t('1') || i <= uint64_t(INT64_MAX)) { return INVALID_NUMBER(src); }
-
613  }
-
614 
-
615  // Write unsigned if it doesn't fit in a signed integer.
-
616  if (i > uint64_t(INT64_MAX)) {
-
617  WRITE_UNSIGNED(i, src, writer);
-
618  } else {
-
619  WRITE_INTEGER(negative ? (~i+1) : i, src, writer);
-
620  }
-
621  if (jsoncharutils::is_not_structural_or_whitespace(*p)) { return INVALID_NUMBER(src); }
-
622  return SUCCESS;
-
623 }
+
514 template<typename W>
+
515 simdjson_inline error_code parse_number(const uint8_t *const, W &writer) {
+
516  writer.append_s64(0); // always write zero
+
517  return SUCCESS; // always succeeds
+
518 }
+
519 
+
520 simdjson_unused simdjson_inline simdjson_result<uint64_t> parse_unsigned(const uint8_t * const src) noexcept { return 0; }
+
521 simdjson_unused simdjson_inline simdjson_result<int64_t> parse_integer(const uint8_t * const src) noexcept { return 0; }
+
522 simdjson_unused simdjson_inline simdjson_result<double> parse_double(const uint8_t * const src) noexcept { return 0; }
+
523 simdjson_unused simdjson_inline simdjson_result<uint64_t> parse_unsigned_in_string(const uint8_t * const src) noexcept { return 0; }
+
524 simdjson_unused simdjson_inline simdjson_result<int64_t> parse_integer_in_string(const uint8_t * const src) noexcept { return 0; }
+
525 simdjson_unused simdjson_inline simdjson_result<double> parse_double_in_string(const uint8_t * const src) noexcept { return 0; }
+
526 simdjson_unused simdjson_inline bool is_negative(const uint8_t * src) noexcept { return false; }
+
527 simdjson_unused simdjson_inline simdjson_result<bool> is_integer(const uint8_t * src) noexcept { return false; }
+
528 simdjson_unused simdjson_inline simdjson_result<number_type> get_number_type(const uint8_t * src) noexcept { return number_type::signed_integer; }
+
529 #else
+
530 
+
531 // parse the number at src
+
532 // define JSON_TEST_NUMBERS for unit testing
+
533 //
+
534 // It is assumed that the number is followed by a structural ({,},],[) character
+
535 // or a white space character. If that is not the case (e.g., when the JSON
+
536 // document is made of a single number), then it is necessary to copy the
+
537 // content and append a space before calling this function.
+
538 //
+
539 // Our objective is accurate parsing (ULP of 0) at high speed.
+
540 template<typename W>
+
541 simdjson_inline error_code parse_number(const uint8_t *const src, W &writer) {
+
542 
+
543  //
+
544  // Check for minus sign
+
545  //
+
546  bool negative = (*src == '-');
+
547  const uint8_t *p = src + uint8_t(negative);
+
548 
+
549  //
+
550  // Parse the integer part.
+
551  //
+
552  // PERF NOTE: we don't use is_made_of_eight_digits_fast because large integers like 123456789 are rare
+
553  const uint8_t *const start_digits = p;
+
554  uint64_t i = 0;
+
555  while (parse_digit(*p, i)) { p++; }
+
556 
+
557  // If there were no digits, or if the integer starts with 0 and has more than one digit, it's an error.
+
558  // Optimization note: size_t is expected to be unsigned.
+
559  size_t digit_count = size_t(p - start_digits);
+
560  if (digit_count == 0 || ('0' == *start_digits && digit_count > 1)) { return INVALID_NUMBER(src); }
+
561 
+
562  //
+
563  // Handle floats if there is a . or e (or both)
+
564  //
+
565  int64_t exponent = 0;
+
566  bool is_float = false;
+
567  if ('.' == *p) {
+
568  is_float = true;
+
569  ++p;
+
570  SIMDJSON_TRY( parse_decimal_after_separator(src, p, i, exponent) );
+
571  digit_count = int(p - start_digits); // used later to guard against overflows
+
572  }
+
573  if (('e' == *p) || ('E' == *p)) {
+
574  is_float = true;
+
575  ++p;
+
576  SIMDJSON_TRY( parse_exponent(src, p, exponent) );
+
577  }
+
578  if (is_float) {
+
579  const bool dirty_end = jsoncharutils::is_not_structural_or_whitespace(*p);
+
580  SIMDJSON_TRY( write_float(src, negative, i, start_digits, digit_count, exponent, writer) );
+
581  if (dirty_end) { return INVALID_NUMBER(src); }
+
582  return SUCCESS;
+
583  }
+
584 
+
585  // The longest negative 64-bit number is 19 digits.
+
586  // The longest positive 64-bit number is 20 digits.
+
587  // We do it this way so we don't trigger this branch unless we must.
+
588  size_t longest_digit_count = negative ? 19 : 20;
+
589  if (digit_count > longest_digit_count) { return INVALID_NUMBER(src); }
+
590  if (digit_count == longest_digit_count) {
+
591  if (negative) {
+
592  // Anything negative above INT64_MAX+1 is invalid
+
593  if (i > uint64_t(INT64_MAX)+1) { return INVALID_NUMBER(src); }
+
594  WRITE_INTEGER(~i+1, src, writer);
+
595  if (jsoncharutils::is_not_structural_or_whitespace(*p)) { return INVALID_NUMBER(src); }
+
596  return SUCCESS;
+
597  // Positive overflow check:
+
598  // - A 20 digit number starting with 2-9 is overflow, because 18,446,744,073,709,551,615 is the
+
599  // biggest uint64_t.
+
600  // - A 20 digit number starting with 1 is overflow if it is less than INT64_MAX.
+
601  // If we got here, it's a 20 digit number starting with the digit "1".
+
602  // - If a 20 digit number starting with 1 overflowed (i*10+digit), the result will be smaller
+
603  // than 1,553,255,926,290,448,384.
+
604  // - That is smaller than the smallest possible 20-digit number the user could write:
+
605  // 10,000,000,000,000,000,000.
+
606  // - Therefore, if the number is positive and lower than that, it's overflow.
+
607  // - The value we are looking at is less than or equal to INT64_MAX.
+
608  //
+
609  } else if (src[0] != uint8_t('1') || i <= uint64_t(INT64_MAX)) { return INVALID_NUMBER(src); }
+
610  }
+
611 
+
612  // Write unsigned if it doesn't fit in a signed integer.
+
613  if (i > uint64_t(INT64_MAX)) {
+
614  WRITE_UNSIGNED(i, src, writer);
+
615  } else {
+
616  WRITE_INTEGER(negative ? (~i+1) : i, src, writer);
+
617  }
+
618  if (jsoncharutils::is_not_structural_or_whitespace(*p)) { return INVALID_NUMBER(src); }
+
619  return SUCCESS;
+
620 }
+
621 
+
622 // Inlineable functions
+
623 namespace {
624 
-
625 // Inlineable functions
-
626 namespace {
-
627 
-
628 // This table can be used to characterize the final character of an integer
-
629 // string. For JSON structural character and allowable white space characters,
-
630 // we return SUCCESS. For 'e', '.' and 'E', we return INCORRECT_TYPE. Otherwise
-
631 // we return NUMBER_ERROR.
-
632 // Optimization note: we could easily reduce the size of the table by half (to 128)
-
633 // at the cost of an extra branch.
-
634 // Optimization note: we want the values to use at most 8 bits (not, e.g., 32 bits):
-
635 static_assert(error_code(uint8_t(NUMBER_ERROR))== NUMBER_ERROR, "bad NUMBER_ERROR cast");
-
636 static_assert(error_code(uint8_t(SUCCESS))== SUCCESS, "bad NUMBER_ERROR cast");
-
637 static_assert(error_code(uint8_t(INCORRECT_TYPE))== INCORRECT_TYPE, "bad NUMBER_ERROR cast");
-
638 
-
639 const uint8_t integer_string_finisher[256] = {
+
625 // This table can be used to characterize the final character of an integer
+
626 // string. For JSON structural character and allowable white space characters,
+
627 // we return SUCCESS. For 'e', '.' and 'E', we return INCORRECT_TYPE. Otherwise
+
628 // we return NUMBER_ERROR.
+
629 // Optimization note: we could easily reduce the size of the table by half (to 128)
+
630 // at the cost of an extra branch.
+
631 // Optimization note: we want the values to use at most 8 bits (not, e.g., 32 bits):
+
632 static_assert(error_code(uint8_t(NUMBER_ERROR))== NUMBER_ERROR, "bad NUMBER_ERROR cast");
+
633 static_assert(error_code(uint8_t(SUCCESS))== SUCCESS, "bad NUMBER_ERROR cast");
+
634 static_assert(error_code(uint8_t(INCORRECT_TYPE))== INCORRECT_TYPE, "bad NUMBER_ERROR cast");
+
635 
+
636 const uint8_t integer_string_finisher[256] = {
+
637  NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR,
+
638  NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, SUCCESS,
+
639  SUCCESS, NUMBER_ERROR, NUMBER_ERROR, SUCCESS, NUMBER_ERROR,
640  NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR,
-
641  NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, SUCCESS,
-
642  SUCCESS, NUMBER_ERROR, NUMBER_ERROR, SUCCESS, NUMBER_ERROR,
-
643  NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR,
+
641  NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR,
+
642  NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR,
+
643  NUMBER_ERROR, NUMBER_ERROR, SUCCESS, NUMBER_ERROR, NUMBER_ERROR,
644  NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR,
-
645  NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR,
-
646  NUMBER_ERROR, NUMBER_ERROR, SUCCESS, NUMBER_ERROR, NUMBER_ERROR,
+
645  NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, SUCCESS,
+
646  NUMBER_ERROR, INCORRECT_TYPE, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR,
647  NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR,
-
648  NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, SUCCESS,
-
649  NUMBER_ERROR, INCORRECT_TYPE, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR,
-
650  NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR,
-
651  NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, SUCCESS, NUMBER_ERROR,
+
648  NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, SUCCESS, NUMBER_ERROR,
+
649  NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR,
+
650  NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, INCORRECT_TYPE,
+
651  NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR,
652  NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR,
-
653  NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, INCORRECT_TYPE,
+
653  NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR,
654  NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR,
-
655  NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR,
+
655  NUMBER_ERROR, SUCCESS, NUMBER_ERROR, SUCCESS, NUMBER_ERROR,
656  NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR,
-
657  NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR,
-
658  NUMBER_ERROR, SUCCESS, NUMBER_ERROR, SUCCESS, NUMBER_ERROR,
+
657  NUMBER_ERROR, INCORRECT_TYPE, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR,
+
658  NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR,
659  NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR,
-
660  NUMBER_ERROR, INCORRECT_TYPE, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR,
-
661  NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR,
-
662  NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR,
+
660  NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR,
+
661  NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, SUCCESS, NUMBER_ERROR,
+
662  SUCCESS, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR,
663  NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR,
-
664  NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, SUCCESS, NUMBER_ERROR,
-
665  SUCCESS, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR,
+
664  NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR,
+
665  NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR,
666  NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR,
667  NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR,
668  NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR,
@@ -773,583 +773,580 @@ $(document).ready(function(){initNavTree('numberparsing_8h_source.html',''); ini
685  NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR,
686  NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR,
687  NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR,
-
688  NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR,
-
689  NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR,
-
690  NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR, NUMBER_ERROR,
-
691  NUMBER_ERROR};
-
692 
-
693 // Parse any number from 0 to 18,446,744,073,709,551,615
-
694 simdjson_unused simdjson_inline simdjson_result<uint64_t> parse_unsigned(const uint8_t * const src) noexcept {
-
695  const uint8_t *p = src;
-
696  //
-
697  // Parse the integer part.
-
698  //
-
699  // PERF NOTE: we don't use is_made_of_eight_digits_fast because large integers like 123456789 are rare
-
700  const uint8_t *const start_digits = p;
-
701  uint64_t i = 0;
-
702  while (parse_digit(*p, i)) { p++; }
-
703 
-
704  // If there were no digits, or if the integer starts with 0 and has more than one digit, it's an error.
-
705  // Optimization note: size_t is expected to be unsigned.
-
706  size_t digit_count = size_t(p - start_digits);
-
707  // The longest positive 64-bit number is 20 digits.
-
708  // We do it this way so we don't trigger this branch unless we must.
-
709  // Optimization note: the compiler can probably merge
-
710  // ((digit_count == 0) || (digit_count > 20))
-
711  // into a single branch since digit_count is unsigned.
-
712  if ((digit_count == 0) || (digit_count > 20)) { return INCORRECT_TYPE; }
-
713  // Here digit_count > 0.
-
714  if (('0' == *start_digits) && (digit_count > 1)) { return NUMBER_ERROR; }
-
715  // We can do the following...
-
716  // if (!jsoncharutils::is_structural_or_whitespace(*p)) {
-
717  // return (*p == '.' || *p == 'e' || *p == 'E') ? INCORRECT_TYPE : NUMBER_ERROR;
-
718  // }
-
719  // as a single table lookup:
-
720  if (integer_string_finisher[*p] != SUCCESS) { return error_code(integer_string_finisher[*p]); }
-
721 
-
722  if (digit_count == 20) {
-
723  // Positive overflow check:
-
724  // - A 20 digit number starting with 2-9 is overflow, because 18,446,744,073,709,551,615 is the
-
725  // biggest uint64_t.
-
726  // - A 20 digit number starting with 1 is overflow if it is less than INT64_MAX.
-
727  // If we got here, it's a 20 digit number starting with the digit "1".
-
728  // - If a 20 digit number starting with 1 overflowed (i*10+digit), the result will be smaller
-
729  // than 1,553,255,926,290,448,384.
-
730  // - That is smaller than the smallest possible 20-digit number the user could write:
-
731  // 10,000,000,000,000,000,000.
-
732  // - Therefore, if the number is positive and lower than that, it's overflow.
-
733  // - The value we are looking at is less than or equal to INT64_MAX.
-
734  //
-
735  if (src[0] != uint8_t('1') || i <= uint64_t(INT64_MAX)) { return INCORRECT_TYPE; }
-
736  }
+
688  NUMBER_ERROR};
+
689 
+
690 // Parse any number from 0 to 18,446,744,073,709,551,615
+
691 simdjson_unused simdjson_inline simdjson_result<uint64_t> parse_unsigned(const uint8_t * const src) noexcept {
+
692  const uint8_t *p = src;
+
693  //
+
694  // Parse the integer part.
+
695  //
+
696  // PERF NOTE: we don't use is_made_of_eight_digits_fast because large integers like 123456789 are rare
+
697  const uint8_t *const start_digits = p;
+
698  uint64_t i = 0;
+
699  while (parse_digit(*p, i)) { p++; }
+
700 
+
701  // If there were no digits, or if the integer starts with 0 and has more than one digit, it's an error.
+
702  // Optimization note: size_t is expected to be unsigned.
+
703  size_t digit_count = size_t(p - start_digits);
+
704  // The longest positive 64-bit number is 20 digits.
+
705  // We do it this way so we don't trigger this branch unless we must.
+
706  // Optimization note: the compiler can probably merge
+
707  // ((digit_count == 0) || (digit_count > 20))
+
708  // into a single branch since digit_count is unsigned.
+
709  if ((digit_count == 0) || (digit_count > 20)) { return INCORRECT_TYPE; }
+
710  // Here digit_count > 0.
+
711  if (('0' == *start_digits) && (digit_count > 1)) { return NUMBER_ERROR; }
+
712  // We can do the following...
+
713  // if (!jsoncharutils::is_structural_or_whitespace(*p)) {
+
714  // return (*p == '.' || *p == 'e' || *p == 'E') ? INCORRECT_TYPE : NUMBER_ERROR;
+
715  // }
+
716  // as a single table lookup:
+
717  if (integer_string_finisher[*p] != SUCCESS) { return error_code(integer_string_finisher[*p]); }
+
718 
+
719  if (digit_count == 20) {
+
720  // Positive overflow check:
+
721  // - A 20 digit number starting with 2-9 is overflow, because 18,446,744,073,709,551,615 is the
+
722  // biggest uint64_t.
+
723  // - A 20 digit number starting with 1 is overflow if it is less than INT64_MAX.
+
724  // If we got here, it's a 20 digit number starting with the digit "1".
+
725  // - If a 20 digit number starting with 1 overflowed (i*10+digit), the result will be smaller
+
726  // than 1,553,255,926,290,448,384.
+
727  // - That is smaller than the smallest possible 20-digit number the user could write:
+
728  // 10,000,000,000,000,000,000.
+
729  // - Therefore, if the number is positive and lower than that, it's overflow.
+
730  // - The value we are looking at is less than or equal to INT64_MAX.
+
731  //
+
732  if (src[0] != uint8_t('1') || i <= uint64_t(INT64_MAX)) { return INCORRECT_TYPE; }
+
733  }
+
734 
+
735  return i;
+
736 }
737 
-
738  return i;
-
739 }
-
740 
-
741 
-
742 // Parse any number from 0 to 18,446,744,073,709,551,615
-
743 // Never read at src_end or beyond
-
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;
-
746  //
-
747  // Parse the integer part.
-
748  //
-
749  // PERF NOTE: we don't use is_made_of_eight_digits_fast because large integers like 123456789 are rare
-
750  const uint8_t *const start_digits = p;
-
751  uint64_t i = 0;
-
752  while ((p != src_end) && parse_digit(*p, i)) { p++; }
-
753 
-
754  // If there were no digits, or if the integer starts with 0 and has more than one digit, it's an error.
-
755  // Optimization note: size_t is expected to be unsigned.
-
756  size_t digit_count = size_t(p - start_digits);
-
757  // The longest positive 64-bit number is 20 digits.
-
758  // We do it this way so we don't trigger this branch unless we must.
-
759  // Optimization note: the compiler can probably merge
-
760  // ((digit_count == 0) || (digit_count > 20))
-
761  // into a single branch since digit_count is unsigned.
-
762  if ((digit_count == 0) || (digit_count > 20)) { return INCORRECT_TYPE; }
-
763  // Here digit_count > 0.
-
764  if (('0' == *start_digits) && (digit_count > 1)) { return NUMBER_ERROR; }
-
765  // We can do the following...
-
766  // if (!jsoncharutils::is_structural_or_whitespace(*p)) {
-
767  // return (*p == '.' || *p == 'e' || *p == 'E') ? INCORRECT_TYPE : NUMBER_ERROR;
-
768  // }
-
769  // as a single table lookup:
-
770  if ((p != src_end) && integer_string_finisher[*p] != SUCCESS) { return error_code(integer_string_finisher[*p]); }
-
771 
-
772  if (digit_count == 20) {
-
773  // Positive overflow check:
-
774  // - A 20 digit number starting with 2-9 is overflow, because 18,446,744,073,709,551,615 is the
-
775  // biggest uint64_t.
-
776  // - A 20 digit number starting with 1 is overflow if it is less than INT64_MAX.
-
777  // If we got here, it's a 20 digit number starting with the digit "1".
-
778  // - If a 20 digit number starting with 1 overflowed (i*10+digit), the result will be smaller
-
779  // than 1,553,255,926,290,448,384.
-
780  // - That is smaller than the smallest possible 20-digit number the user could write:
-
781  // 10,000,000,000,000,000,000.
-
782  // - Therefore, if the number is positive and lower than that, it's overflow.
-
783  // - The value we are looking at is less than or equal to INT64_MAX.
-
784  //
-
785  if (src[0] != uint8_t('1') || i <= uint64_t(INT64_MAX)) { return INCORRECT_TYPE; }
-
786  }
+
738 
+
739 // Parse any number from 0 to 18,446,744,073,709,551,615
+
740 // Never read at src_end or beyond
+
741 simdjson_unused simdjson_inline simdjson_result<uint64_t> parse_unsigned(const uint8_t * const src, const uint8_t * const src_end) noexcept {
+
742  const uint8_t *p = src;
+
743  //
+
744  // Parse the integer part.
+
745  //
+
746  // PERF NOTE: we don't use is_made_of_eight_digits_fast because large integers like 123456789 are rare
+
747  const uint8_t *const start_digits = p;
+
748  uint64_t i = 0;
+
749  while ((p != src_end) && parse_digit(*p, i)) { p++; }
+
750 
+
751  // If there were no digits, or if the integer starts with 0 and has more than one digit, it's an error.
+
752  // Optimization note: size_t is expected to be unsigned.
+
753  size_t digit_count = size_t(p - start_digits);
+
754  // The longest positive 64-bit number is 20 digits.
+
755  // We do it this way so we don't trigger this branch unless we must.
+
756  // Optimization note: the compiler can probably merge
+
757  // ((digit_count == 0) || (digit_count > 20))
+
758  // into a single branch since digit_count is unsigned.
+
759  if ((digit_count == 0) || (digit_count > 20)) { return INCORRECT_TYPE; }
+
760  // Here digit_count > 0.
+
761  if (('0' == *start_digits) && (digit_count > 1)) { return NUMBER_ERROR; }
+
762  // We can do the following...
+
763  // if (!jsoncharutils::is_structural_or_whitespace(*p)) {
+
764  // return (*p == '.' || *p == 'e' || *p == 'E') ? INCORRECT_TYPE : NUMBER_ERROR;
+
765  // }
+
766  // as a single table lookup:
+
767  if ((p != src_end) && integer_string_finisher[*p] != SUCCESS) { return error_code(integer_string_finisher[*p]); }
+
768 
+
769  if (digit_count == 20) {
+
770  // Positive overflow check:
+
771  // - A 20 digit number starting with 2-9 is overflow, because 18,446,744,073,709,551,615 is the
+
772  // biggest uint64_t.
+
773  // - A 20 digit number starting with 1 is overflow if it is less than INT64_MAX.
+
774  // If we got here, it's a 20 digit number starting with the digit "1".
+
775  // - If a 20 digit number starting with 1 overflowed (i*10+digit), the result will be smaller
+
776  // than 1,553,255,926,290,448,384.
+
777  // - That is smaller than the smallest possible 20-digit number the user could write:
+
778  // 10,000,000,000,000,000,000.
+
779  // - Therefore, if the number is positive and lower than that, it's overflow.
+
780  // - The value we are looking at is less than or equal to INT64_MAX.
+
781  //
+
782  if (src[0] != uint8_t('1') || i <= uint64_t(INT64_MAX)) { return INCORRECT_TYPE; }
+
783  }
+
784 
+
785  return i;
+
786 }
787 
-
788  return i;
-
789 }
-
790 
-
791 // Parse any number from 0 to 18,446,744,073,709,551,615
-
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;
-
794  //
-
795  // Parse the integer part.
-
796  //
-
797  // PERF NOTE: we don't use is_made_of_eight_digits_fast because large integers like 123456789 are rare
-
798  const uint8_t *const start_digits = p;
-
799  uint64_t i = 0;
-
800  while (parse_digit(*p, i)) { p++; }
-
801 
-
802  // If there were no digits, or if the integer starts with 0 and has more than one digit, it's an error.
-
803  // Optimization note: size_t is expected to be unsigned.
-
804  size_t digit_count = size_t(p - start_digits);
-
805  // The longest positive 64-bit number is 20 digits.
-
806  // We do it this way so we don't trigger this branch unless we must.
-
807  // Optimization note: the compiler can probably merge
-
808  // ((digit_count == 0) || (digit_count > 20))
-
809  // into a single branch since digit_count is unsigned.
-
810  if ((digit_count == 0) || (digit_count > 20)) { return INCORRECT_TYPE; }
-
811  // Here digit_count > 0.
-
812  if (('0' == *start_digits) && (digit_count > 1)) { return NUMBER_ERROR; }
-
813  // We can do the following...
-
814  // if (!jsoncharutils::is_structural_or_whitespace(*p)) {
-
815  // return (*p == '.' || *p == 'e' || *p == 'E') ? INCORRECT_TYPE : NUMBER_ERROR;
-
816  // }
-
817  // as a single table lookup:
-
818  if (*p != '"') { return NUMBER_ERROR; }
-
819 
-
820  if (digit_count == 20) {
-
821  // Positive overflow check:
-
822  // - A 20 digit number starting with 2-9 is overflow, because 18,446,744,073,709,551,615 is the
-
823  // biggest uint64_t.
-
824  // - A 20 digit number starting with 1 is overflow if it is less than INT64_MAX.
-
825  // If we got here, it's a 20 digit number starting with the digit "1".
-
826  // - If a 20 digit number starting with 1 overflowed (i*10+digit), the result will be smaller
-
827  // than 1,553,255,926,290,448,384.
-
828  // - That is smaller than the smallest possible 20-digit number the user could write:
-
829  // 10,000,000,000,000,000,000.
-
830  // - Therefore, if the number is positive and lower than that, it's overflow.
-
831  // - The value we are looking at is less than or equal to INT64_MAX.
-
832  //
-
833  // Note: we use src[1] and not src[0] because src[0] is the quote character in this
-
834  // instance.
-
835  if (src[1] != uint8_t('1') || i <= uint64_t(INT64_MAX)) { return INCORRECT_TYPE; }
-
836  }
+
788 // Parse any number from 0 to 18,446,744,073,709,551,615
+
789 simdjson_unused simdjson_inline simdjson_result<uint64_t> parse_unsigned_in_string(const uint8_t * const src) noexcept {
+
790  const uint8_t *p = src + 1;
+
791  //
+
792  // Parse the integer part.
+
793  //
+
794  // PERF NOTE: we don't use is_made_of_eight_digits_fast because large integers like 123456789 are rare
+
795  const uint8_t *const start_digits = p;
+
796  uint64_t i = 0;
+
797  while (parse_digit(*p, i)) { p++; }
+
798 
+
799  // If there were no digits, or if the integer starts with 0 and has more than one digit, it's an error.
+
800  // Optimization note: size_t is expected to be unsigned.
+
801  size_t digit_count = size_t(p - start_digits);
+
802  // The longest positive 64-bit number is 20 digits.
+
803  // We do it this way so we don't trigger this branch unless we must.
+
804  // Optimization note: the compiler can probably merge
+
805  // ((digit_count == 0) || (digit_count > 20))
+
806  // into a single branch since digit_count is unsigned.
+
807  if ((digit_count == 0) || (digit_count > 20)) { return INCORRECT_TYPE; }
+
808  // Here digit_count > 0.
+
809  if (('0' == *start_digits) && (digit_count > 1)) { return NUMBER_ERROR; }
+
810  // We can do the following...
+
811  // if (!jsoncharutils::is_structural_or_whitespace(*p)) {
+
812  // return (*p == '.' || *p == 'e' || *p == 'E') ? INCORRECT_TYPE : NUMBER_ERROR;
+
813  // }
+
814  // as a single table lookup:
+
815  if (*p != '"') { return NUMBER_ERROR; }
+
816 
+
817  if (digit_count == 20) {
+
818  // Positive overflow check:
+
819  // - A 20 digit number starting with 2-9 is overflow, because 18,446,744,073,709,551,615 is the
+
820  // biggest uint64_t.
+
821  // - A 20 digit number starting with 1 is overflow if it is less than INT64_MAX.
+
822  // If we got here, it's a 20 digit number starting with the digit "1".
+
823  // - If a 20 digit number starting with 1 overflowed (i*10+digit), the result will be smaller
+
824  // than 1,553,255,926,290,448,384.
+
825  // - That is smaller than the smallest possible 20-digit number the user could write:
+
826  // 10,000,000,000,000,000,000.
+
827  // - Therefore, if the number is positive and lower than that, it's overflow.
+
828  // - The value we are looking at is less than or equal to INT64_MAX.
+
829  //
+
830  // Note: we use src[1] and not src[0] because src[0] is the quote character in this
+
831  // instance.
+
832  if (src[1] != uint8_t('1') || i <= uint64_t(INT64_MAX)) { return INCORRECT_TYPE; }
+
833  }
+
834 
+
835  return i;
+
836 }
837 
-
838  return i;
-
839 }
-
840 
-
841 // Parse any number from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
-
842 simdjson_unused simdjson_inline simdjson_result<int64_t> parse_integer(const uint8_t *src) noexcept {
-
843  //
-
844  // Check for minus sign
-
845  //
-
846  bool negative = (*src == '-');
-
847  const uint8_t *p = src + uint8_t(negative);
-
848 
-
849  //
-
850  // Parse the integer part.
-
851  //
-
852  // PERF NOTE: we don't use is_made_of_eight_digits_fast because large integers like 123456789 are rare
-
853  const uint8_t *const start_digits = p;
-
854  uint64_t i = 0;
-
855  while (parse_digit(*p, i)) { p++; }
-
856 
-
857  // If there were no digits, or if the integer starts with 0 and has more than one digit, it's an error.
-
858  // Optimization note: size_t is expected to be unsigned.
-
859  size_t digit_count = size_t(p - start_digits);
-
860  // We go from
-
861  // -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
-
862  // so we can never represent numbers that have more than 19 digits.
-
863  size_t longest_digit_count = 19;
-
864  // Optimization note: the compiler can probably merge
-
865  // ((digit_count == 0) || (digit_count > longest_digit_count))
-
866  // into a single branch since digit_count is unsigned.
-
867  if ((digit_count == 0) || (digit_count > longest_digit_count)) { return INCORRECT_TYPE; }
-
868  // Here digit_count > 0.
-
869  if (('0' == *start_digits) && (digit_count > 1)) { return NUMBER_ERROR; }
-
870  // We can do the following...
-
871  // if (!jsoncharutils::is_structural_or_whitespace(*p)) {
-
872  // return (*p == '.' || *p == 'e' || *p == 'E') ? INCORRECT_TYPE : NUMBER_ERROR;
-
873  // }
-
874  // as a single table lookup:
-
875  if(integer_string_finisher[*p] != SUCCESS) { return error_code(integer_string_finisher[*p]); }
-
876  // Negative numbers have can go down to - INT64_MAX - 1 whereas positive numbers are limited to INT64_MAX.
-
877  // Performance note: This check is only needed when digit_count == longest_digit_count but it is
-
878  // so cheap that we might as well always make it.
-
879  if(i > uint64_t(INT64_MAX) + uint64_t(negative)) { return INCORRECT_TYPE; }
-
880  return negative ? (~i+1) : i;
-
881 }
-
882 
-
883 // Parse any number from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
-
884 // Never read at src_end or beyond
-
885 simdjson_unused simdjson_inline simdjson_result<int64_t> parse_integer(const uint8_t * const src, const uint8_t * const src_end) noexcept {
-
886  //
-
887  // Check for minus sign
-
888  //
-
889  if(src == src_end) { return NUMBER_ERROR; }
-
890  bool negative = (*src == '-');
-
891  const uint8_t *p = src + uint8_t(negative);
-
892 
-
893  //
-
894  // Parse the integer part.
-
895  //
-
896  // PERF NOTE: we don't use is_made_of_eight_digits_fast because large integers like 123456789 are rare
-
897  const uint8_t *const start_digits = p;
-
898  uint64_t i = 0;
-
899  while ((p != src_end) && parse_digit(*p, i)) { p++; }
-
900 
-
901  // If there were no digits, or if the integer starts with 0 and has more than one digit, it's an error.
-
902  // Optimization note: size_t is expected to be unsigned.
-
903  size_t digit_count = size_t(p - start_digits);
-
904  // We go from
-
905  // -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
-
906  // so we can never represent numbers that have more than 19 digits.
-
907  size_t longest_digit_count = 19;
-
908  // Optimization note: the compiler can probably merge
-
909  // ((digit_count == 0) || (digit_count > longest_digit_count))
-
910  // into a single branch since digit_count is unsigned.
-
911  if ((digit_count == 0) || (digit_count > longest_digit_count)) { return INCORRECT_TYPE; }
-
912  // Here digit_count > 0.
-
913  if (('0' == *start_digits) && (digit_count > 1)) { return NUMBER_ERROR; }
-
914  // We can do the following...
-
915  // if (!jsoncharutils::is_structural_or_whitespace(*p)) {
-
916  // return (*p == '.' || *p == 'e' || *p == 'E') ? INCORRECT_TYPE : NUMBER_ERROR;
-
917  // }
-
918  // as a single table lookup:
-
919  if((p != src_end) && integer_string_finisher[*p] != SUCCESS) { return error_code(integer_string_finisher[*p]); }
-
920  // Negative numbers have can go down to - INT64_MAX - 1 whereas positive numbers are limited to INT64_MAX.
-
921  // Performance note: This check is only needed when digit_count == longest_digit_count but it is
-
922  // so cheap that we might as well always make it.
-
923  if(i > uint64_t(INT64_MAX) + uint64_t(negative)) { return INCORRECT_TYPE; }
-
924  return negative ? (~i+1) : i;
-
925 }
-
926 
-
927 // Parse any number from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
-
928 simdjson_unused simdjson_inline simdjson_result<int64_t> parse_integer_in_string(const uint8_t *src) noexcept {
-
929  //
-
930  // Check for minus sign
-
931  //
-
932  bool negative = (*(src + 1) == '-');
-
933  src += uint8_t(negative) + 1;
-
934 
-
935  //
-
936  // Parse the integer part.
-
937  //
-
938  // PERF NOTE: we don't use is_made_of_eight_digits_fast because large integers like 123456789 are rare
-
939  const uint8_t *const start_digits = src;
-
940  uint64_t i = 0;
-
941  while (parse_digit(*src, i)) { src++; }
-
942 
-
943  // If there were no digits, or if the integer starts with 0 and has more than one digit, it's an error.
-
944  // Optimization note: size_t is expected to be unsigned.
-
945  size_t digit_count = size_t(src - start_digits);
-
946  // We go from
-
947  // -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
-
948  // so we can never represent numbers that have more than 19 digits.
-
949  size_t longest_digit_count = 19;
-
950  // Optimization note: the compiler can probably merge
-
951  // ((digit_count == 0) || (digit_count > longest_digit_count))
-
952  // into a single branch since digit_count is unsigned.
-
953  if ((digit_count == 0) || (digit_count > longest_digit_count)) { return INCORRECT_TYPE; }
-
954  // Here digit_count > 0.
-
955  if (('0' == *start_digits) && (digit_count > 1)) { return NUMBER_ERROR; }
-
956  // We can do the following...
-
957  // if (!jsoncharutils::is_structural_or_whitespace(*src)) {
-
958  // return (*src == '.' || *src == 'e' || *src == 'E') ? INCORRECT_TYPE : NUMBER_ERROR;
-
959  // }
-
960  // as a single table lookup:
-
961  if(*src != '"') { return NUMBER_ERROR; }
-
962  // Negative numbers have can go down to - INT64_MAX - 1 whereas positive numbers are limited to INT64_MAX.
-
963  // Performance note: This check is only needed when digit_count == longest_digit_count but it is
-
964  // so cheap that we might as well always make it.
-
965  if(i > uint64_t(INT64_MAX) + uint64_t(negative)) { return INCORRECT_TYPE; }
-
966  return negative ? (~i+1) : i;
-
967 }
-
968 
-
969 simdjson_unused simdjson_inline simdjson_result<double> parse_double(const uint8_t * src) noexcept {
-
970  //
-
971  // Check for minus sign
-
972  //
-
973  bool negative = (*src == '-');
-
974  src += uint8_t(negative);
-
975 
-
976  //
-
977  // Parse the integer part.
-
978  //
-
979  uint64_t i = 0;
-
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++; }
-
984  // no integer digits, or 0123 (zero must be solo)
-
985  if ( p == src ) { return INCORRECT_TYPE; }
-
986  if ( (leading_zero && p != src+1)) { return NUMBER_ERROR; }
-
987 
-
988  //
-
989  // Parse the decimal part.
-
990  //
-
991  int64_t exponent = 0;
-
992  bool overflow;
-
993  if (simdjson_likely(*p == '.')) {
+
838 // Parse any number from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
+
839 simdjson_unused simdjson_inline simdjson_result<int64_t> parse_integer(const uint8_t *src) noexcept {
+
840  //
+
841  // Check for minus sign
+
842  //
+
843  bool negative = (*src == '-');
+
844  const uint8_t *p = src + uint8_t(negative);
+
845 
+
846  //
+
847  // Parse the integer part.
+
848  //
+
849  // PERF NOTE: we don't use is_made_of_eight_digits_fast because large integers like 123456789 are rare
+
850  const uint8_t *const start_digits = p;
+
851  uint64_t i = 0;
+
852  while (parse_digit(*p, i)) { p++; }
+
853 
+
854  // If there were no digits, or if the integer starts with 0 and has more than one digit, it's an error.
+
855  // Optimization note: size_t is expected to be unsigned.
+
856  size_t digit_count = size_t(p - start_digits);
+
857  // We go from
+
858  // -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
+
859  // so we can never represent numbers that have more than 19 digits.
+
860  size_t longest_digit_count = 19;
+
861  // Optimization note: the compiler can probably merge
+
862  // ((digit_count == 0) || (digit_count > longest_digit_count))
+
863  // into a single branch since digit_count is unsigned.
+
864  if ((digit_count == 0) || (digit_count > longest_digit_count)) { return INCORRECT_TYPE; }
+
865  // Here digit_count > 0.
+
866  if (('0' == *start_digits) && (digit_count > 1)) { return NUMBER_ERROR; }
+
867  // We can do the following...
+
868  // if (!jsoncharutils::is_structural_or_whitespace(*p)) {
+
869  // return (*p == '.' || *p == 'e' || *p == 'E') ? INCORRECT_TYPE : NUMBER_ERROR;
+
870  // }
+
871  // as a single table lookup:
+
872  if(integer_string_finisher[*p] != SUCCESS) { return error_code(integer_string_finisher[*p]); }
+
873  // Negative numbers have can go down to - INT64_MAX - 1 whereas positive numbers are limited to INT64_MAX.
+
874  // Performance note: This check is only needed when digit_count == longest_digit_count but it is
+
875  // so cheap that we might as well always make it.
+
876  if(i > uint64_t(INT64_MAX) + uint64_t(negative)) { return INCORRECT_TYPE; }
+
877  return negative ? (~i+1) : i;
+
878 }
+
879 
+
880 // Parse any number from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
+
881 // Never read at src_end or beyond
+
882 simdjson_unused simdjson_inline simdjson_result<int64_t> parse_integer(const uint8_t * const src, const uint8_t * const src_end) noexcept {
+
883  //
+
884  // Check for minus sign
+
885  //
+
886  if(src == src_end) { return NUMBER_ERROR; }
+
887  bool negative = (*src == '-');
+
888  const uint8_t *p = src + uint8_t(negative);
+
889 
+
890  //
+
891  // Parse the integer part.
+
892  //
+
893  // PERF NOTE: we don't use is_made_of_eight_digits_fast because large integers like 123456789 are rare
+
894  const uint8_t *const start_digits = p;
+
895  uint64_t i = 0;
+
896  while ((p != src_end) && parse_digit(*p, i)) { p++; }
+
897 
+
898  // If there were no digits, or if the integer starts with 0 and has more than one digit, it's an error.
+
899  // Optimization note: size_t is expected to be unsigned.
+
900  size_t digit_count = size_t(p - start_digits);
+
901  // We go from
+
902  // -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
+
903  // so we can never represent numbers that have more than 19 digits.
+
904  size_t longest_digit_count = 19;
+
905  // Optimization note: the compiler can probably merge
+
906  // ((digit_count == 0) || (digit_count > longest_digit_count))
+
907  // into a single branch since digit_count is unsigned.
+
908  if ((digit_count == 0) || (digit_count > longest_digit_count)) { return INCORRECT_TYPE; }
+
909  // Here digit_count > 0.
+
910  if (('0' == *start_digits) && (digit_count > 1)) { return NUMBER_ERROR; }
+
911  // We can do the following...
+
912  // if (!jsoncharutils::is_structural_or_whitespace(*p)) {
+
913  // return (*p == '.' || *p == 'e' || *p == 'E') ? INCORRECT_TYPE : NUMBER_ERROR;
+
914  // }
+
915  // as a single table lookup:
+
916  if((p != src_end) && integer_string_finisher[*p] != SUCCESS) { return error_code(integer_string_finisher[*p]); }
+
917  // Negative numbers have can go down to - INT64_MAX - 1 whereas positive numbers are limited to INT64_MAX.
+
918  // Performance note: This check is only needed when digit_count == longest_digit_count but it is
+
919  // so cheap that we might as well always make it.
+
920  if(i > uint64_t(INT64_MAX) + uint64_t(negative)) { return INCORRECT_TYPE; }
+
921  return negative ? (~i+1) : i;
+
922 }
+
923 
+
924 // Parse any number from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
+
925 simdjson_unused simdjson_inline simdjson_result<int64_t> parse_integer_in_string(const uint8_t *src) noexcept {
+
926  //
+
927  // Check for minus sign
+
928  //
+
929  bool negative = (*(src + 1) == '-');
+
930  src += uint8_t(negative) + 1;
+
931 
+
932  //
+
933  // Parse the integer part.
+
934  //
+
935  // PERF NOTE: we don't use is_made_of_eight_digits_fast because large integers like 123456789 are rare
+
936  const uint8_t *const start_digits = src;
+
937  uint64_t i = 0;
+
938  while (parse_digit(*src, i)) { src++; }
+
939 
+
940  // If there were no digits, or if the integer starts with 0 and has more than one digit, it's an error.
+
941  // Optimization note: size_t is expected to be unsigned.
+
942  size_t digit_count = size_t(src - start_digits);
+
943  // We go from
+
944  // -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
+
945  // so we can never represent numbers that have more than 19 digits.
+
946  size_t longest_digit_count = 19;
+
947  // Optimization note: the compiler can probably merge
+
948  // ((digit_count == 0) || (digit_count > longest_digit_count))
+
949  // into a single branch since digit_count is unsigned.
+
950  if ((digit_count == 0) || (digit_count > longest_digit_count)) { return INCORRECT_TYPE; }
+
951  // Here digit_count > 0.
+
952  if (('0' == *start_digits) && (digit_count > 1)) { return NUMBER_ERROR; }
+
953  // We can do the following...
+
954  // if (!jsoncharutils::is_structural_or_whitespace(*src)) {
+
955  // return (*src == '.' || *src == 'e' || *src == 'E') ? INCORRECT_TYPE : NUMBER_ERROR;
+
956  // }
+
957  // as a single table lookup:
+
958  if(*src != '"') { return NUMBER_ERROR; }
+
959  // Negative numbers have can go down to - INT64_MAX - 1 whereas positive numbers are limited to INT64_MAX.
+
960  // Performance note: This check is only needed when digit_count == longest_digit_count but it is
+
961  // so cheap that we might as well always make it.
+
962  if(i > uint64_t(INT64_MAX) + uint64_t(negative)) { return INCORRECT_TYPE; }
+
963  return negative ? (~i+1) : i;
+
964 }
+
965 
+
966 simdjson_unused simdjson_inline simdjson_result<double> parse_double(const uint8_t * src) noexcept {
+
967  //
+
968  // Check for minus sign
+
969  //
+
970  bool negative = (*src == '-');
+
971  src += uint8_t(negative);
+
972 
+
973  //
+
974  // Parse the integer part.
+
975  //
+
976  uint64_t i = 0;
+
977  const uint8_t *p = src;
+
978  p += parse_digit(*p, i);
+
979  bool leading_zero = (i == 0);
+
980  while (parse_digit(*p, i)) { p++; }
+
981  // no integer digits, or 0123 (zero must be solo)
+
982  if ( p == src ) { return INCORRECT_TYPE; }
+
983  if ( (leading_zero && p != src+1)) { return NUMBER_ERROR; }
+
984 
+
985  //
+
986  // Parse the decimal part.
+
987  //
+
988  int64_t exponent = 0;
+
989  bool overflow;
+
990  if (simdjson_likely(*p == '.')) {
+
991  p++;
+
992  const uint8_t *start_decimal_digits = p;
+
993  if (!parse_digit(*p, i)) { return NUMBER_ERROR; } // no decimal digits
994  p++;
-
995  const uint8_t *start_decimal_digits = p;
-
996  if (!parse_digit(*p, i)) { return NUMBER_ERROR; } // no decimal digits
-
997  p++;
-
998  while (parse_digit(*p, i)) { p++; }
-
999  exponent = -(p - start_decimal_digits);
-
1000 
-
1001  // Overflow check. More than 19 digits (minus the decimal) may be overflow.
-
1002  overflow = p-src-1 > 19;
-
1003  if (simdjson_unlikely(overflow && leading_zero)) {
-
1004  // Skip leading 0.00000 and see if it still overflows
-
1005  const uint8_t *start_digits = src + 2;
-
1006  while (*start_digits == '0') { start_digits++; }
-
1007  overflow = p-start_digits > 19;
-
1008  }
-
1009  } else {
-
1010  overflow = p-src > 19;
-
1011  }
-
1012 
-
1013  //
-
1014  // Parse the exponent
-
1015  //
-
1016  if (*p == 'e' || *p == 'E') {
-
1017  p++;
-
1018  bool exp_neg = *p == '-';
-
1019  p += exp_neg || *p == '+';
-
1020 
-
1021  uint64_t exp = 0;
-
1022  const uint8_t *start_exp_digits = p;
-
1023  while (parse_digit(*p, exp)) { p++; }
-
1024  // no exp digits, or 20+ exp digits
-
1025  if (p-start_exp_digits == 0 || p-start_exp_digits > 19) { return NUMBER_ERROR; }
+
995  while (parse_digit(*p, i)) { p++; }
+
996  exponent = -(p - start_decimal_digits);
+
997 
+
998  // Overflow check. More than 19 digits (minus the decimal) may be overflow.
+
999  overflow = p-src-1 > 19;
+
1000  if (simdjson_unlikely(overflow && leading_zero)) {
+
1001  // Skip leading 0.00000 and see if it still overflows
+
1002  const uint8_t *start_digits = src + 2;
+
1003  while (*start_digits == '0') { start_digits++; }
+
1004  overflow = p-start_digits > 19;
+
1005  }
+
1006  } else {
+
1007  overflow = p-src > 19;
+
1008  }
+
1009 
+
1010  //
+
1011  // Parse the exponent
+
1012  //
+
1013  if (*p == 'e' || *p == 'E') {
+
1014  p++;
+
1015  bool exp_neg = *p == '-';
+
1016  p += exp_neg || *p == '+';
+
1017 
+
1018  uint64_t exp = 0;
+
1019  const uint8_t *start_exp_digits = p;
+
1020  while (parse_digit(*p, exp)) { p++; }
+
1021  // no exp digits, or 20+ exp digits
+
1022  if (p-start_exp_digits == 0 || p-start_exp_digits > 19) { return NUMBER_ERROR; }
+
1023 
+
1024  exponent += exp_neg ? 0-exp : exp;
+
1025  }
1026 
-
1027  exponent += exp_neg ? 0-exp : exp;
-
1028  }
-
1029 
-
1030  if (jsoncharutils::is_not_structural_or_whitespace(*p)) { return NUMBER_ERROR; }
-
1031 
-
1032  overflow = overflow || exponent < simdjson::internal::smallest_power || exponent > simdjson::internal::largest_power;
-
1033 
-
1034  //
-
1035  // Assemble (or slow-parse) the float
-
1036  //
-
1037  double d;
-
1038  if (simdjson_likely(!overflow)) {
-
1039  if (compute_float_64(exponent, i, negative, d)) { return d; }
+
1027  if (jsoncharutils::is_not_structural_or_whitespace(*p)) { return NUMBER_ERROR; }
+
1028 
+
1029  overflow = overflow || exponent < simdjson::internal::smallest_power || exponent > simdjson::internal::largest_power;
+
1030 
+
1031  //
+
1032  // Assemble (or slow-parse) the float
+
1033  //
+
1034  double d;
+
1035  if (simdjson_likely(!overflow)) {
+
1036  if (compute_float_64(exponent, i, negative, d)) { return d; }
+
1037  }
+
1038  if (!parse_float_fallback(src - uint8_t(negative), &d)) {
+
1039  return NUMBER_ERROR;
1040  }
-
1041  if (!parse_float_fallback(src - uint8_t(negative), &d)) {
-
1042  return NUMBER_ERROR;
-
1043  }
-
1044  return d;
-
1045 }
-
1046 
-
1047 simdjson_unused simdjson_inline bool is_negative(const uint8_t * src) noexcept {
-
1048  return (*src == '-');
-
1049 }
-
1050 
-
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++; }
-
1056  if ( p == src ) { return NUMBER_ERROR; }
-
1057  if (jsoncharutils::is_structural_or_whitespace(*p)) { return true; }
-
1058  return false;
-
1059 }
-
1060 
-
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++; }
-
1066  if ( p == src ) { return NUMBER_ERROR; }
-
1067  if (jsoncharutils::is_structural_or_whitespace(*p)) {
-
1068  // We have an integer.
-
1069  // If the number is negative and valid, it must be a signed integer.
-
1070  if(negative) { return number_type::signed_integer; }
-
1071  // We want values larger or equal to 9223372036854775808 to be unsigned
-
1072  // integers, and the other values to be signed integers.
-
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;
-
1078  }
-
1079  }
-
1080  return number_type::signed_integer;
-
1081  }
-
1082  // Hopefully, we have 'e' or 'E' or '.'.
-
1083  return number_type::floating_point_number;
-
1084 }
-
1085 
-
1086 // Never read at src_end or beyond
-
1087 simdjson_unused simdjson_inline simdjson_result<double> parse_double(const uint8_t * src, const uint8_t * const src_end) noexcept {
-
1088  if(src == src_end) { return NUMBER_ERROR; }
-
1089  //
-
1090  // Check for minus sign
-
1091  //
-
1092  bool negative = (*src == '-');
-
1093  src += uint8_t(negative);
-
1094 
-
1095  //
-
1096  // Parse the integer part.
-
1097  //
-
1098  uint64_t i = 0;
-
1099  const uint8_t *p = src;
-
1100  if(p == src_end) { return NUMBER_ERROR; }
-
1101  p += parse_digit(*p, i);
-
1102  bool leading_zero = (i == 0);
-
1103  while ((p != src_end) && parse_digit(*p, i)) { p++; }
-
1104  // no integer digits, or 0123 (zero must be solo)
-
1105  if ( p == src ) { return INCORRECT_TYPE; }
-
1106  if ( (leading_zero && p != src+1)) { return NUMBER_ERROR; }
-
1107 
-
1108  //
-
1109  // Parse the decimal part.
-
1110  //
-
1111  int64_t exponent = 0;
-
1112  bool overflow;
-
1113  if (simdjson_likely((p != src_end) && (*p == '.'))) {
+
1041  return d;
+
1042 }
+
1043 
+
1044 simdjson_unused simdjson_inline bool is_negative(const uint8_t * src) noexcept {
+
1045  return (*src == '-');
+
1046 }
+
1047 
+
1048 simdjson_unused simdjson_inline simdjson_result<bool> is_integer(const uint8_t * src) noexcept {
+
1049  bool negative = (*src == '-');
+
1050  src += uint8_t(negative);
+
1051  const uint8_t *p = src;
+
1052  while(static_cast<uint8_t>(*p - '0') <= 9) { p++; }
+
1053  if ( p == src ) { return NUMBER_ERROR; }
+
1054  if (jsoncharutils::is_structural_or_whitespace(*p)) { return true; }
+
1055  return false;
+
1056 }
+
1057 
+
1058 simdjson_unused simdjson_inline simdjson_result<number_type> get_number_type(const uint8_t * src) noexcept {
+
1059  bool negative = (*src == '-');
+
1060  src += uint8_t(negative);
+
1061  const uint8_t *p = src;
+
1062  while(static_cast<uint8_t>(*p - '0') <= 9) { p++; }
+
1063  if ( p == src ) { return NUMBER_ERROR; }
+
1064  if (jsoncharutils::is_structural_or_whitespace(*p)) {
+
1065  // We have an integer.
+
1066  // If the number is negative and valid, it must be a signed integer.
+
1067  if(negative) { return number_type::signed_integer; }
+
1068  // We want values larger or equal to 9223372036854775808 to be unsigned
+
1069  // integers, and the other values to be signed integers.
+
1070  int digit_count = int(p - src);
+
1071  if(digit_count >= 19) {
+
1072  const uint8_t * smaller_big_integer = reinterpret_cast<const uint8_t *>("9223372036854775808");
+
1073  if((digit_count >= 20) || (memcmp(src, smaller_big_integer, 19) >= 0)) {
+
1074  return number_type::unsigned_integer;
+
1075  }
+
1076  }
+
1077  return number_type::signed_integer;
+
1078  }
+
1079  // Hopefully, we have 'e' or 'E' or '.'.
+
1080  return number_type::floating_point_number;
+
1081 }
+
1082 
+
1083 // Never read at src_end or beyond
+
1084 simdjson_unused simdjson_inline simdjson_result<double> parse_double(const uint8_t * src, const uint8_t * const src_end) noexcept {
+
1085  if(src == src_end) { return NUMBER_ERROR; }
+
1086  //
+
1087  // Check for minus sign
+
1088  //
+
1089  bool negative = (*src == '-');
+
1090  src += uint8_t(negative);
+
1091 
+
1092  //
+
1093  // Parse the integer part.
+
1094  //
+
1095  uint64_t i = 0;
+
1096  const uint8_t *p = src;
+
1097  if(p == src_end) { return NUMBER_ERROR; }
+
1098  p += parse_digit(*p, i);
+
1099  bool leading_zero = (i == 0);
+
1100  while ((p != src_end) && parse_digit(*p, i)) { p++; }
+
1101  // no integer digits, or 0123 (zero must be solo)
+
1102  if ( p == src ) { return INCORRECT_TYPE; }
+
1103  if ( (leading_zero && p != src+1)) { return NUMBER_ERROR; }
+
1104 
+
1105  //
+
1106  // Parse the decimal part.
+
1107  //
+
1108  int64_t exponent = 0;
+
1109  bool overflow;
+
1110  if (simdjson_likely((p != src_end) && (*p == '.'))) {
+
1111  p++;
+
1112  const uint8_t *start_decimal_digits = p;
+
1113  if ((p == src_end) || !parse_digit(*p, i)) { return NUMBER_ERROR; } // no decimal digits
1114  p++;
-
1115  const uint8_t *start_decimal_digits = p;
-
1116  if ((p == src_end) || !parse_digit(*p, i)) { return NUMBER_ERROR; } // no decimal digits
-
1117  p++;
-
1118  while ((p != src_end) && parse_digit(*p, i)) { p++; }
-
1119  exponent = -(p - start_decimal_digits);
-
1120 
-
1121  // Overflow check. More than 19 digits (minus the decimal) may be overflow.
-
1122  overflow = p-src-1 > 19;
-
1123  if (simdjson_unlikely(overflow && leading_zero)) {
-
1124  // Skip leading 0.00000 and see if it still overflows
-
1125  const uint8_t *start_digits = src + 2;
-
1126  while (*start_digits == '0') { start_digits++; }
-
1127  overflow = start_digits-src > 19;
-
1128  }
-
1129  } else {
-
1130  overflow = p-src > 19;
-
1131  }
-
1132 
-
1133  //
-
1134  // Parse the exponent
-
1135  //
-
1136  if ((p != src_end) && (*p == 'e' || *p == 'E')) {
-
1137  p++;
-
1138  if(p == src_end) { return NUMBER_ERROR; }
-
1139  bool exp_neg = *p == '-';
-
1140  p += exp_neg || *p == '+';
-
1141 
-
1142  uint64_t exp = 0;
-
1143  const uint8_t *start_exp_digits = p;
-
1144  while ((p != src_end) && parse_digit(*p, exp)) { p++; }
-
1145  // no exp digits, or 20+ exp digits
-
1146  if (p-start_exp_digits == 0 || p-start_exp_digits > 19) { return NUMBER_ERROR; }
+
1115  while ((p != src_end) && parse_digit(*p, i)) { p++; }
+
1116  exponent = -(p - start_decimal_digits);
+
1117 
+
1118  // Overflow check. More than 19 digits (minus the decimal) may be overflow.
+
1119  overflow = p-src-1 > 19;
+
1120  if (simdjson_unlikely(overflow && leading_zero)) {
+
1121  // Skip leading 0.00000 and see if it still overflows
+
1122  const uint8_t *start_digits = src + 2;
+
1123  while (*start_digits == '0') { start_digits++; }
+
1124  overflow = start_digits-src > 19;
+
1125  }
+
1126  } else {
+
1127  overflow = p-src > 19;
+
1128  }
+
1129 
+
1130  //
+
1131  // Parse the exponent
+
1132  //
+
1133  if ((p != src_end) && (*p == 'e' || *p == 'E')) {
+
1134  p++;
+
1135  if(p == src_end) { return NUMBER_ERROR; }
+
1136  bool exp_neg = *p == '-';
+
1137  p += exp_neg || *p == '+';
+
1138 
+
1139  uint64_t exp = 0;
+
1140  const uint8_t *start_exp_digits = p;
+
1141  while ((p != src_end) && parse_digit(*p, exp)) { p++; }
+
1142  // no exp digits, or 20+ exp digits
+
1143  if (p-start_exp_digits == 0 || p-start_exp_digits > 19) { return NUMBER_ERROR; }
+
1144 
+
1145  exponent += exp_neg ? 0-exp : exp;
+
1146  }
1147 
-
1148  exponent += exp_neg ? 0-exp : exp;
-
1149  }
-
1150 
-
1151  if ((p != src_end) && jsoncharutils::is_not_structural_or_whitespace(*p)) { return NUMBER_ERROR; }
-
1152 
-
1153  overflow = overflow || exponent < simdjson::internal::smallest_power || exponent > simdjson::internal::largest_power;
-
1154 
-
1155  //
-
1156  // Assemble (or slow-parse) the float
-
1157  //
-
1158  double d;
-
1159  if (simdjson_likely(!overflow)) {
-
1160  if (compute_float_64(exponent, i, negative, d)) { return d; }
+
1148  if ((p != src_end) && jsoncharutils::is_not_structural_or_whitespace(*p)) { return NUMBER_ERROR; }
+
1149 
+
1150  overflow = overflow || exponent < simdjson::internal::smallest_power || exponent > simdjson::internal::largest_power;
+
1151 
+
1152  //
+
1153  // Assemble (or slow-parse) the float
+
1154  //
+
1155  double d;
+
1156  if (simdjson_likely(!overflow)) {
+
1157  if (compute_float_64(exponent, i, negative, d)) { return d; }
+
1158  }
+
1159  if (!parse_float_fallback(src - uint8_t(negative), src_end, &d)) {
+
1160  return NUMBER_ERROR;
1161  }
-
1162  if (!parse_float_fallback(src - uint8_t(negative), src_end, &d)) {
-
1163  return NUMBER_ERROR;
-
1164  }
-
1165  return d;
-
1166 }
-
1167 
-
1168 simdjson_unused simdjson_inline simdjson_result<double> parse_double_in_string(const uint8_t * src) noexcept {
-
1169  //
-
1170  // Check for minus sign
-
1171  //
-
1172  bool negative = (*(src + 1) == '-');
-
1173  src += uint8_t(negative) + 1;
-
1174 
-
1175  //
-
1176  // Parse the integer part.
-
1177  //
-
1178  uint64_t i = 0;
-
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++; }
-
1183  // no integer digits, or 0123 (zero must be solo)
-
1184  if ( p == src ) { return INCORRECT_TYPE; }
-
1185  if ( (leading_zero && p != src+1)) { return NUMBER_ERROR; }
-
1186 
-
1187  //
-
1188  // Parse the decimal part.
-
1189  //
-
1190  int64_t exponent = 0;
-
1191  bool overflow;
-
1192  if (simdjson_likely(*p == '.')) {
+
1162  return d;
+
1163 }
+
1164 
+
1165 simdjson_unused simdjson_inline simdjson_result<double> parse_double_in_string(const uint8_t * src) noexcept {
+
1166  //
+
1167  // Check for minus sign
+
1168  //
+
1169  bool negative = (*(src + 1) == '-');
+
1170  src += uint8_t(negative) + 1;
+
1171 
+
1172  //
+
1173  // Parse the integer part.
+
1174  //
+
1175  uint64_t i = 0;
+
1176  const uint8_t *p = src;
+
1177  p += parse_digit(*p, i);
+
1178  bool leading_zero = (i == 0);
+
1179  while (parse_digit(*p, i)) { p++; }
+
1180  // no integer digits, or 0123 (zero must be solo)
+
1181  if ( p == src ) { return INCORRECT_TYPE; }
+
1182  if ( (leading_zero && p != src+1)) { return NUMBER_ERROR; }
+
1183 
+
1184  //
+
1185  // Parse the decimal part.
+
1186  //
+
1187  int64_t exponent = 0;
+
1188  bool overflow;
+
1189  if (simdjson_likely(*p == '.')) {
+
1190  p++;
+
1191  const uint8_t *start_decimal_digits = p;
+
1192  if (!parse_digit(*p, i)) { return NUMBER_ERROR; } // no decimal digits
1193  p++;
-
1194  const uint8_t *start_decimal_digits = p;
-
1195  if (!parse_digit(*p, i)) { return NUMBER_ERROR; } // no decimal digits
-
1196  p++;
-
1197  while (parse_digit(*p, i)) { p++; }
-
1198  exponent = -(p - start_decimal_digits);
-
1199 
-
1200  // Overflow check. More than 19 digits (minus the decimal) may be overflow.
-
1201  overflow = p-src-1 > 19;
-
1202  if (simdjson_unlikely(overflow && leading_zero)) {
-
1203  // Skip leading 0.00000 and see if it still overflows
-
1204  const uint8_t *start_digits = src + 2;
-
1205  while (*start_digits == '0') { start_digits++; }
-
1206  overflow = p-start_digits > 19;
-
1207  }
-
1208  } else {
-
1209  overflow = p-src > 19;
-
1210  }
-
1211 
-
1212  //
-
1213  // Parse the exponent
-
1214  //
-
1215  if (*p == 'e' || *p == 'E') {
-
1216  p++;
-
1217  bool exp_neg = *p == '-';
-
1218  p += exp_neg || *p == '+';
-
1219 
-
1220  uint64_t exp = 0;
-
1221  const uint8_t *start_exp_digits = p;
-
1222  while (parse_digit(*p, exp)) { p++; }
-
1223  // no exp digits, or 20+ exp digits
-
1224  if (p-start_exp_digits == 0 || p-start_exp_digits > 19) { return NUMBER_ERROR; }
+
1194  while (parse_digit(*p, i)) { p++; }
+
1195  exponent = -(p - start_decimal_digits);
+
1196 
+
1197  // Overflow check. More than 19 digits (minus the decimal) may be overflow.
+
1198  overflow = p-src-1 > 19;
+
1199  if (simdjson_unlikely(overflow && leading_zero)) {
+
1200  // Skip leading 0.00000 and see if it still overflows
+
1201  const uint8_t *start_digits = src + 2;
+
1202  while (*start_digits == '0') { start_digits++; }
+
1203  overflow = p-start_digits > 19;
+
1204  }
+
1205  } else {
+
1206  overflow = p-src > 19;
+
1207  }
+
1208 
+
1209  //
+
1210  // Parse the exponent
+
1211  //
+
1212  if (*p == 'e' || *p == 'E') {
+
1213  p++;
+
1214  bool exp_neg = *p == '-';
+
1215  p += exp_neg || *p == '+';
+
1216 
+
1217  uint64_t exp = 0;
+
1218  const uint8_t *start_exp_digits = p;
+
1219  while (parse_digit(*p, exp)) { p++; }
+
1220  // no exp digits, or 20+ exp digits
+
1221  if (p-start_exp_digits == 0 || p-start_exp_digits > 19) { return NUMBER_ERROR; }
+
1222 
+
1223  exponent += exp_neg ? 0-exp : exp;
+
1224  }
1225 
-
1226  exponent += exp_neg ? 0-exp : exp;
-
1227  }
-
1228 
-
1229  if (*p != '"') { return NUMBER_ERROR; }
-
1230 
-
1231  overflow = overflow || exponent < simdjson::internal::smallest_power || exponent > simdjson::internal::largest_power;
-
1232 
-
1233  //
-
1234  // Assemble (or slow-parse) the float
-
1235  //
-
1236  double d;
-
1237  if (simdjson_likely(!overflow)) {
-
1238  if (compute_float_64(exponent, i, negative, d)) { return d; }
+
1226  if (*p != '"') { return NUMBER_ERROR; }
+
1227 
+
1228  overflow = overflow || exponent < simdjson::internal::smallest_power || exponent > simdjson::internal::largest_power;
+
1229 
+
1230  //
+
1231  // Assemble (or slow-parse) the float
+
1232  //
+
1233  double d;
+
1234  if (simdjson_likely(!overflow)) {
+
1235  if (compute_float_64(exponent, i, negative, d)) { return d; }
+
1236  }
+
1237  if (!parse_float_fallback(src - uint8_t(negative), &d)) {
+
1238  return NUMBER_ERROR;
1239  }
-
1240  if (!parse_float_fallback(src - uint8_t(negative), &d)) {
-
1241  return NUMBER_ERROR;
-
1242  }
-
1243  return d;
-
1244 }
+
1240  return d;
+
1241 }
+
1242 
+
1243 } // unnamed namespace
+
1244 #endif // SIMDJSON_SKIPNUMBERPARSING
1245 
-
1246 } // unnamed namespace
-
1247 #endif // SIMDJSON_SKIPNUMBERPARSING
-
1248 
-
1249 } // namespace numberparsing
-
1250 
-
1251 inline std::ostream& operator<<(std::ostream& out, number_type type) noexcept {
-
1252  switch (type) {
-
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();
-
1257  }
-
1258  return out;
-
1259 }
+
1246 } // namespace numberparsing
+
1247 
+
1248 inline std::ostream& operator<<(std::ostream& out, number_type type) noexcept {
+
1249  switch (type) {
+
1250  case number_type::signed_integer: out << "integer in [-9223372036854775808,9223372036854775808)"; break;
+
1251  case number_type::unsigned_integer: out << "unsigned integer in [9223372036854775808,18446744073709551616)"; break;
+
1252  case number_type::floating_point_number: out << "floating-point number (binary64)"; break;
+
1253  default: SIMDJSON_UNREACHABLE();
+
1254  }
+
1255  return out;
+
1256 }
+
1257 
+
1258 } // namespace SIMDJSON_IMPLEMENTATION
+
1259 } // namespace simdjson
1260 
-
1261 } // namespace SIMDJSON_IMPLEMENTATION
-
1262 } // namespace simdjson
-
1263 
-
1264 #endif // SIMDJSON_GENERIC_NUMBERPARSING_H
+
1261 #endif // SIMDJSON_GENERIC_NUMBERPARSING_H
simdjson
The top level simdjson namespace, containing everything the library provides.
Definition: base.h:8
simdjson::operator<<
std::ostream & operator<<(std::ostream &out, error_code error) noexcept
Write the error message to the output stream.
Definition: error-inl.h:35
simdjson::error_code
error_code
All possible errors returned by simdjson.
Definition: error.h:19
diff --git a/structsimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1number-members.html b/structsimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1number-members.html index 575287eef..4a1b4a4ef 100644 --- a/structsimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1number-members.html +++ b/structsimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1number-members.html @@ -107,16 +107,15 @@ $(document).ready(function(){initNavTree('structsimdjson_1_1_s_i_m_d_j_s_o_n___i is_int64() const noexceptsimdjson::SIMDJSON_IMPLEMENTATION::ondemand::number is_uint64() const noexceptsimdjson::SIMDJSON_IMPLEMENTATION::ondemand::number numberparsing::parse_number (defined in simdjson::SIMDJSON_IMPLEMENTATION::ondemand::number)simdjson::SIMDJSON_IMPLEMENTATION::ondemand::numberfriend - numberparsing::slow_float_parsing (defined in simdjson::SIMDJSON_IMPLEMENTATION::ondemand::number)simdjson::SIMDJSON_IMPLEMENTATION::ondemand::numberfriend - numberparsing::write_float (defined in simdjson::SIMDJSON_IMPLEMENTATION::ondemand::number)simdjson::SIMDJSON_IMPLEMENTATION::ondemand::numberfriend - operator double() const noexcept (defined in simdjson::SIMDJSON_IMPLEMENTATION::ondemand::number)simdjson::SIMDJSON_IMPLEMENTATION::ondemand::number - operator int64_t() const noexcept (defined in simdjson::SIMDJSON_IMPLEMENTATION::ondemand::number)simdjson::SIMDJSON_IMPLEMENTATION::ondemand::number - operator uint64_t() const noexcept (defined in simdjson::SIMDJSON_IMPLEMENTATION::ondemand::number)simdjson::SIMDJSON_IMPLEMENTATION::ondemand::number - payloadsimdjson::SIMDJSON_IMPLEMENTATION::ondemand::numberprotected - signed_integer (defined in simdjson::SIMDJSON_IMPLEMENTATION::ondemand::number)simdjson::SIMDJSON_IMPLEMENTATION::ondemand::number - skip_double() noexceptsimdjson::SIMDJSON_IMPLEMENTATION::ondemand::numberprotected - type (defined in simdjson::SIMDJSON_IMPLEMENTATION::ondemand::number)simdjson::SIMDJSON_IMPLEMENTATION::ondemand::numberprotected - unsigned_integer (defined in simdjson::SIMDJSON_IMPLEMENTATION::ondemand::number)simdjson::SIMDJSON_IMPLEMENTATION::ondemand::number + numberparsing::write_float (defined in simdjson::SIMDJSON_IMPLEMENTATION::ondemand::number)simdjson::SIMDJSON_IMPLEMENTATION::ondemand::numberfriend + operator double() const noexcept (defined in simdjson::SIMDJSON_IMPLEMENTATION::ondemand::number)simdjson::SIMDJSON_IMPLEMENTATION::ondemand::number + operator int64_t() const noexcept (defined in simdjson::SIMDJSON_IMPLEMENTATION::ondemand::number)simdjson::SIMDJSON_IMPLEMENTATION::ondemand::number + operator uint64_t() const noexcept (defined in simdjson::SIMDJSON_IMPLEMENTATION::ondemand::number)simdjson::SIMDJSON_IMPLEMENTATION::ondemand::number + payloadsimdjson::SIMDJSON_IMPLEMENTATION::ondemand::numberprotected + signed_integer (defined in simdjson::SIMDJSON_IMPLEMENTATION::ondemand::number)simdjson::SIMDJSON_IMPLEMENTATION::ondemand::number + skip_double() noexceptsimdjson::SIMDJSON_IMPLEMENTATION::ondemand::numberprotected + type (defined in simdjson::SIMDJSON_IMPLEMENTATION::ondemand::number)simdjson::SIMDJSON_IMPLEMENTATION::ondemand::numberprotected + unsigned_integer (defined in simdjson::SIMDJSON_IMPLEMENTATION::ondemand::number)simdjson::SIMDJSON_IMPLEMENTATION::ondemand::number diff --git a/structsimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1number.js b/structsimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1number.js index 136fddf6f..5e8913989 100644 --- a/structsimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1number.js +++ b/structsimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1number.js @@ -16,7 +16,6 @@ var structsimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand [ "operator uint64_t", "structsimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1number.html#abb713c2347a676fe6514e2eae97c4f5d", null ], [ "skip_double", "structsimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1number.html#ac6b75b1d1af73c9ef8958e573c367e1c", null ], [ "numberparsing::parse_number", "structsimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1number.html#a31e829fc9dac6ebac9dca7af20898b53", null ], - [ "numberparsing::slow_float_parsing", "structsimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1number.html#a5053e80f5724f8e1ce7dc513b2c93463", null ], [ "numberparsing::write_float", "structsimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1number.html#a4963fde41cc9ccb03339a4594c005e04", null ], [ "value_iterator", "structsimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1number.html#a2b56b11b68e621bbd8ce2051ed10ab60", null ], [ "floating_point_number", "structsimdjson_1_1_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1number.html#a0902647d571633bcaf937831430df3ba", null ], diff --git a/structsimdjson_1_1simdjson__result_3_01_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1json__type_01_4.html b/structsimdjson_1_1simdjson__result_3_01_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1json__type_01_4.html index e74c44fb8..80d19c681 100644 --- a/structsimdjson_1_1simdjson__result_3_01_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1json__type_01_4.html +++ b/structsimdjson_1_1simdjson__result_3_01_s_i_m_d_j_s_o_n___i_m_p_l_e_m_e_n_t_a_t_i_o_n_1_1ondemand_1_1json__type_01_4.html @@ -165,7 +165,7 @@ simdjson_inline

Detailed Description

-

Definition at line 152 of file json_type.h.

+

Definition at line 150 of file json_type.h.


The documentation for this struct was generated from the following files: