Skip to content

Commit 6dbd15a

Browse files
committed
Move SIMDJSON_SKIPNUMBERPARSING method out
1 parent 22e5b08 commit 6dbd15a

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

src/generic/stage2/numberparsing.h

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,17 @@ really_inline bool write_float(const uint8_t *const src, bool negative, uint64_t
383383
return true;
384384
}
385385

386+
// for performance analysis, it is sometimes useful to skip parsing
387+
#ifdef SIMDJSON_SKIPNUMBERPARSING
388+
389+
template<typename W>
390+
really_inline bool parse_number(const uint8_t *const, W &writer) {
391+
writer.append_s64(0); // always write zero
392+
return true; // always succeeds
393+
}
394+
395+
#else
396+
386397
// parse the number at src
387398
// define JSON_TEST_NUMBERS for unit testing
388399
//
@@ -393,13 +404,7 @@ really_inline bool write_float(const uint8_t *const src, bool negative, uint64_t
393404
//
394405
// Our objective is accurate parsing (ULP of 0) at high speed.
395406
template<typename W>
396-
really_inline bool parse_number(UNUSED const uint8_t *const src,
397-
W &writer) {
398-
#ifdef SIMDJSON_SKIPNUMBERPARSING // for performance analysis, it is sometimes
399-
// useful to skip parsing
400-
writer.append_s64(0); // always write zero
401-
return true; // always succeeds
402-
#else
407+
really_inline bool parse_number(const uint8_t *const src, W &writer) {
403408

404409
//
405410
// Check for minus sign
@@ -478,9 +483,9 @@ really_inline bool parse_number(UNUSED const uint8_t *const src,
478483
WRITE_INTEGER(negative ? 0 - i : i, src, writer);
479484
}
480485
return is_structural_or_whitespace(*p);
486+
}
481487

482488
#endif // SIMDJSON_SKIPNUMBERPARSING
483-
}
484489

485490
} // namespace numberparsing
486491
} // namespace stage2

0 commit comments

Comments
 (0)