1 #ifndef SIMDJSON_PPC64_STRINGPARSING_H
2 #define SIMDJSON_PPC64_STRINGPARSING_H
4 #include "simdjson/base.h"
5 #include "simdjson/ppc64/bitmanipulation.h"
6 #include "simdjson/ppc64/simd.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
19 copy_and_find(
const uint8_t *src, uint8_t *dst);
21 simdjson_inline
bool has_quote_first() {
22 return ((bs_bits - 1) & quote_bits) != 0;
24 simdjson_inline
bool has_backslash() {
return bs_bits != 0; }
25 simdjson_inline
int quote_index() {
26 return trailing_zeroes(quote_bits);
28 simdjson_inline
int backslash_index() {
29 return trailing_zeroes(bs_bits);
36 simdjson_inline backslash_and_quote
37 backslash_and_quote::copy_and_find(
const uint8_t *src, uint8_t *dst) {
41 "backslash and quote finder must process fewer than "
42 "SIMDJSON_PADDING bytes");
43 simd8<uint8_t> v0(src);
44 simd8<uint8_t> v1(src +
sizeof(v0));
46 v1.store(dst +
sizeof(v0));
51 uint64_t bs_and_quote =
52 simd8x64<bool>(v0 ==
'\\', v1 ==
'\\', v0 ==
'"', v1 ==
'"').to_bitmask();
54 uint32_t(bs_and_quote),
55 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.