1 #ifndef SIMDJSON_HASWELL_STRINGPARSING_H
2 #define SIMDJSON_HASWELL_STRINGPARSING_H
4 #include "simdjson/base.h"
5 #include "simdjson/haswell/simd.h"
6 #include "simdjson/haswell/bitmanipulation.h"
9 namespace SIMDJSON_IMPLEMENTATION {
15 struct backslash_and_quote {
17 static constexpr uint32_t BYTES_PROCESSED = 32;
18 simdjson_inline
static backslash_and_quote copy_and_find(
const uint8_t *src, uint8_t *dst);
20 simdjson_inline
bool has_quote_first() {
return ((bs_bits - 1) & quote_bits) != 0; }
21 simdjson_inline
bool has_backslash() {
return ((quote_bits - 1) & bs_bits) != 0; }
22 simdjson_inline
int quote_index() {
return trailing_zeroes(quote_bits); }
23 simdjson_inline
int backslash_index() {
return trailing_zeroes(bs_bits); }
29 simdjson_inline backslash_and_quote backslash_and_quote::copy_and_find(
const uint8_t *src, uint8_t *dst) {
32 static_assert(
SIMDJSON_PADDING >= (BYTES_PROCESSED - 1),
"backslash and quote finder must process fewer than SIMDJSON_PADDING bytes");
33 simd8<uint8_t> v(src);
37 static_cast<uint32_t
>((v ==
'\\').to_bitmask()),
38 static_cast<uint32_t
>((v ==
'"').to_bitmask()),
We want to support argument-dependent lookup (ADL).
constexpr size_t SIMDJSON_PADDING
The amount of padding needed in a buffer to parse JSON.