1 #ifndef SIMDJSON_HASWELL_STRINGPARSING_DEFS_H
2 #define SIMDJSON_HASWELL_STRINGPARSING_DEFS_H
4 #ifndef SIMDJSON_CONDITIONAL_INCLUDE
5 #include "simdjson/haswell/base.h"
6 #include "simdjson/haswell/simd.h"
7 #include "simdjson/haswell/bitmanipulation.h"
17 struct backslash_and_quote {
19 static constexpr uint32_t BYTES_PROCESSED = 32;
20 simdjson_inline
static backslash_and_quote copy_and_find(
const uint8_t *src, uint8_t *dst);
22 simdjson_inline
bool has_quote_first() {
return ((bs_bits - 1) & quote_bits) != 0; }
23 simdjson_inline
bool has_backslash() {
return ((quote_bits - 1) & bs_bits) != 0; }
24 simdjson_inline
int quote_index() {
return trailing_zeroes(quote_bits); }
25 simdjson_inline
int backslash_index() {
return trailing_zeroes(bs_bits); }
31 simdjson_inline backslash_and_quote backslash_and_quote::copy_and_find(
const uint8_t *src, uint8_t *dst) {
34 static_assert(
SIMDJSON_PADDING >= (BYTES_PROCESSED - 1),
"backslash and quote finder must process fewer than SIMDJSON_PADDING bytes");
35 simd8<uint8_t> v(src);
39 static_cast<uint32_t
>((v ==
'\\').to_bitmask()),
40 static_cast<uint32_t
>((v ==
'"').to_bitmask()),
The top level simdjson namespace, containing everything the library provides.
constexpr size_t SIMDJSON_PADDING
The amount of padding needed in a buffer to parse JSON.