1 | #ifndef SIMDJSON_ARM64_NUMBERPARSING_H |
---|---|
2 | #define SIMDJSON_ARM64_NUMBERPARSING_H |
3 | |
4 | namespace simdjson { |
5 | namespace SIMDJSON_IMPLEMENTATION { |
6 | namespace { |
7 | |
8 | // we don't have SSE, so let us use a scalar function |
9 | // credit: https://johnnylee-sde.github.io/Fast-numeric-string-to-int/ |
10 | static simdjson_inline uint32_t parse_eight_digits_unrolled(const uint8_t *chars) { |
11 | uint64_t val; |
12 | std::memcpy(dest: &val, src: chars, n: sizeof(uint64_t)); |
13 | val = (val & 0x0F0F0F0F0F0F0F0F) * 2561 >> 8; |
14 | val = (val & 0x00FF00FF00FF00FF) * 6553601 >> 16; |
15 | return uint32_t((val & 0x0000FFFF0000FFFF) * 42949672960001 >> 32); |
16 | } |
17 | |
18 | } // unnamed namespace |
19 | } // namespace SIMDJSON_IMPLEMENTATION |
20 | } // namespace simdjson |
21 | |
22 | #define SIMDJSON_SWAR_NUMBER_PARSING 1 |
23 | |
24 | #include "simdjson/generic/numberparsing.h" |
25 | |
26 | #endif // SIMDJSON_ARM64_NUMBERPARSING_H |
27 |