1 #ifndef SIMDJSON_PPC64_STRINGPARSING_DEFS_H
2 #define SIMDJSON_PPC64_STRINGPARSING_DEFS_H
4 #ifndef SIMDJSON_CONDITIONAL_INCLUDE
5 #include "simdjson/ppc64/base.h"
6 #include "simdjson/ppc64/bitmanipulation.h"
7 #include "simdjson/ppc64/simd.h"
17 struct backslash_and_quote {
19 static constexpr uint32_t BYTES_PROCESSED = 32;
20 simdjson_inline
static backslash_and_quote
21 copy_and_find(
const uint8_t *src, uint8_t *dst);
23 simdjson_inline
bool has_quote_first() {
24 return ((bs_bits - 1) & quote_bits) != 0;
26 simdjson_inline
bool has_backslash() {
return bs_bits != 0; }
27 simdjson_inline
int quote_index() {
28 return trailing_zeroes(quote_bits);
30 simdjson_inline
int backslash_index() {
31 return trailing_zeroes(bs_bits);
38 simdjson_inline backslash_and_quote
39 backslash_and_quote::copy_and_find(
const uint8_t *src, uint8_t *dst) {
43 "backslash and quote finder must process fewer than "
44 "SIMDJSON_PADDING bytes");
45 simd8<uint8_t> v0(src);
46 simd8<uint8_t> v1(src +
sizeof(v0));
48 v1.store(dst +
sizeof(v0));
53 uint64_t bs_and_quote =
54 simd8x64<bool>(v0 ==
'\\', v1 ==
'\\', v0 ==
'"', v1 ==
'"').to_bitmask();
56 uint32_t(bs_and_quote),
57 uint32_t(bs_and_quote >> 32)
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.