Ensuring that stage 1's json_block and cie are never copied and using explicit constructors (issue 1475) (#1478)

This commit is contained in:
Daniel Lemire
2021-03-04 07:59:36 -05:00
committed by GitHub
parent 79e94227c2
commit dc2f767171
14 changed files with 77 additions and 47 deletions
+6 -6
View File
@@ -13,19 +13,19 @@ using namespace simd;
struct json_character_block {
static simdjson_really_inline json_character_block classify(const simd::simd8x64<uint8_t>& in);
// ASCII white-space ('\r','\n','\t',' ')
simdjson_really_inline uint64_t whitespace() const;
simdjson_really_inline uint64_t whitespace() const noexcept;
// non-quote structural characters (comma, colon, braces, brackets)
simdjson_really_inline uint64_t op() const;
simdjson_really_inline uint64_t op() const noexcept;
// neither a structural character nor a white-space, so letters, numbers and quotes
simdjson_really_inline uint64_t scalar() const;
simdjson_really_inline uint64_t scalar() const noexcept;
uint64_t _whitespace; // ASCII white-space ('\r','\n','\t',' ')
uint64_t _op; // structural characters (comma, colon, braces, brackets but not quotes)
};
simdjson_really_inline uint64_t json_character_block::whitespace() const { return _whitespace; }
simdjson_really_inline uint64_t json_character_block::op() const { return _op; }
simdjson_really_inline uint64_t json_character_block::scalar() const { return ~(op() | whitespace()); }
simdjson_really_inline uint64_t json_character_block::whitespace() const noexcept { return _whitespace; }
simdjson_really_inline uint64_t json_character_block::op() const noexcept { return _op; }
simdjson_really_inline uint64_t json_character_block::scalar() const noexcept { return ~(op() | whitespace()); }
// This identifies structural characters (comma, colon, braces, brackets),
// and ASCII white-space ('\r','\n','\t',' ').