1 #ifndef SIMDJSON_WESTMERE_STRINGPARSING_H
2 #define SIMDJSON_WESTMERE_STRINGPARSING_H
5 namespace SIMDJSON_IMPLEMENTATION {
11 struct backslash_and_quote {
13 static constexpr uint32_t BYTES_PROCESSED = 32;
14 simdjson_inline
static backslash_and_quote copy_and_find(
const uint8_t *src, uint8_t *dst);
16 simdjson_inline
bool has_quote_first() {
return ((bs_bits - 1) & quote_bits) != 0; }
17 simdjson_inline
bool has_backslash() {
return bs_bits != 0; }
18 simdjson_inline
int quote_index() {
return trailing_zeroes(quote_bits); }
19 simdjson_inline
int backslash_index() {
return trailing_zeroes(bs_bits); }
25 simdjson_inline backslash_and_quote backslash_and_quote::copy_and_find(
const uint8_t *src, uint8_t *dst) {
28 static_assert(
SIMDJSON_PADDING >= (BYTES_PROCESSED - 1),
"backslash and quote finder must process fewer than SIMDJSON_PADDING bytes");
29 simd8<uint8_t> v0(src);
30 simd8<uint8_t> v1(src + 16);
33 uint64_t bs_and_quote = simd8x64<bool>(v0 ==
'\\', v1 ==
'\\', v0 ==
'"', v1 ==
'"').to_bitmask();
35 uint32_t(bs_and_quote),
36 uint32_t(bs_and_quote >> 32)
We want to support argument-dependent lookup (ADL).
constexpr size_t SIMDJSON_PADDING
The amount of padding needed in a buffer to parse JSON.