20#if defined(__SSE4_2__)
21# define RAPIDJSON_SSE42
22#elif defined(__SSE2__)
23# define RAPIDJSON_SSE2
24#elif defined(__ARM_NEON)
25# define RAPIDJSON_NEON
28#define RAPIDJSON_NAMESPACE rapidjson_simd
37RAPIDJSON_DIAG_OFF(effc++)
40using namespace rapidjson_simd;
43#define SIMD_SUFFIX(name) name##_SSE2
44#elif defined(RAPIDJSON_SSE42)
45#define SIMD_SUFFIX(name) name##_SSE42
46#elif defined(RAPIDJSON_NEON)
47#define SIMD_SUFFIX(name) name##_NEON
49#define SIMD_SUFFIX(name) name
52template <
typename StreamType>
54 for (
size_t step = 1; step < 32; step++) {
56 for (
size_t i = 0; i < 1024; i++)
57 buffer[i] =
" \t\r\n"[i % 4];
58 for (
size_t i = 0; i < 1024; i += step)
81 for (
size_t step = 1; step < 32; step++) {
83 for (
size_t i = 0; i < 1024; i++)
84 buffer[i] =
" \t\r\n"[i % 4];
85 for (
size_t i = 0; i < 1024; i += step)
103 bool String(
const char* str,
size_t length,
bool) {
110template <
unsigned parseFlags,
typename StreamType>
112 char buffer[1024u + 5 + 32];
113 char backup[1024u + 5 + 32];
116 for (
size_t offset = 0; offset < 32; offset++) {
117 for (
size_t step = 0; step < 1024; step++) {
118 char* json = buffer + offset;
121 for (
size_t i = 0; i < step; i++)
122 *
p++ =
"ABCD"[i % 4];
127 strcpy(backup, json);
132 reader.
Parse<parseFlags>(
s, h);
140 for (
size_t offset = 0; offset < 32; offset++) {
141 for (
size_t step = 0; step < 1024; step++) {
142 char* json = buffer + offset;
147 for (
size_t i = 0; i < step; i++)
148 *
p++ =
"ABCD"[i % 4];
151 strcpy(backup, json);
156 reader.
Parse<parseFlags>(
s, h);
170 char buffer[2048 + 1 + 32];
171 for (
size_t offset = 0; offset < 32; offset++) {
172 for (
size_t step = 0; step < 1024; step++) {
173 char*
s = buffer + offset;
175 for (
size_t i = 0; i < step; i++)
176 *
p++ =
"ABCD"[i % 4];
177 char escape =
"\0\n\\\""[step % 4];
179 for (
size_t i = 0; i < step; i++)
180 *
p++ =
"ABCD"[i % 4];
187 for (
size_t i = 0; i < step; i++)
189 if (escape ==
'\0') {
197 else if (escape ==
'\n') {
201 else if (escape ==
'\\') {
205 else if (escape ==
'\"') {
209 for (
size_t i = 0; i < step; i++)
ParseResult Parse(InputStream &is, Handler &handler)
Parse JSON text.
const Ch * GetString() const
bool String(const Ch *str, SizeType length, bool copy=false)
#define EXPECT_EQ(val1, val2)
#define EXPECT_TRUE(condition)
#define TEST(test_case_name, test_name)
RAPIDJSON_NAMESPACE_BEGIN typedef unsigned SizeType
Size type (for string lengths, array sizes, etc.)
void SkipWhitespace(InputStream &is)
Skip the JSON white spaces in a stream.
void TestScanCopyUnescapedString()
#define SIMD_SUFFIX(name)
void TestSkipWhitespace()
Default implementation of Handler.
Represents an in-memory input byte stream.
bool String(const char *str, size_t length, bool)
memcpy((char *) pInfo->slotDescription, s, l)