MCPcopy Create free account
hub / github.com/bytedance/sonic-cpp / parseFloatEiselLemire64

Method parseFloatEiselLemire64

include/sonic/dom/parser.h:190–217  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

188 }
189
190 SonicError parseFloatEiselLemire64(double &dbl, int exp10, uint64_t man,
191 int sgn, bool trunc, const char *s) const {
192 union {
193 double val = 0;
194 uint64_t uval;
195 } d;
196 double val_up = 0;
197 if (internal::AtofEiselLemire64(man, exp10, sgn, &d.val)) {
198 if (!trunc) {
199 dbl = d.val;
200 return kErrorNone;
201 }
202 if (internal::AtofEiselLemire64(man + 1, exp10, sgn, &val_up) &&
203 val_up == d.val) {
204 dbl = d.val;
205 return kErrorNone;
206 }
207 }
208
209 d.val = internal::AtofNative(s + pos_ - 1, len_ - pos_ + 1);
210 dbl = d.val;
211 /* if the float number is infinity */
212 if (sonic_unlikely((d.uval << 1) == 0xFFE0000000000000)) {
213 return kParseErrorInfinity;
214 } else {
215 return kErrorNone;
216 }
217 }
218
219 template <typename SAX>
220 sonic_force_inline bool parseNumber(SAX &sax) {

Callers

nothing calls this directly

Calls 2

AtofEiselLemire64Function · 0.85
AtofNativeFunction · 0.85

Tested by

no test coverage detected