Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
R
rapidjson
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
rapidjson
Commits
22021d66
Commit
22021d66
authored
Apr 16, 2015
by
miloyip
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Converts tabs to spaces
parent
a7763cbe
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
36 deletions
+36
-36
reader.h
include/rapidjson/reader.h
+36
-36
No files found.
include/rapidjson/reader.h
View file @
22021d66
...
...
@@ -255,23 +255,23 @@ void SkipWhitespace(InputStream& is) {
#ifdef RAPIDJSON_SSE42
//! Skip whitespace with SSE 4.2 pcmpistrm instruction, testing 16 8-byte characters at once.
inline
const
char
*
SkipWhitespace_SIMD
(
const
char
*
p
)
{
// Fast return for single non-whitespace
if
(
*
p
==
' '
||
*
p
==
'\n'
||
*
p
==
'\r'
||
*
p
==
'\t'
)
++
p
;
else
return
p
;
// 16-byte align to the next boundary
const
char
*
nextAligned
=
reinterpret_cast
<
const
char
*>
((
reinterpret_cast
<
size_t
>
(
p
)
+
15
)
&
~
15
);
while
(
p
!=
nextAligned
)
if
(
*
p
==
' '
||
*
p
==
'\n'
||
*
p
==
'\r'
||
*
p
==
'\t'
)
++
p
;
else
return
p
;
// Fast return for single non-whitespace
if
(
*
p
==
' '
||
*
p
==
'\n'
||
*
p
==
'\r'
||
*
p
==
'\t'
)
++
p
;
else
return
p
;
// 16-byte align to the next boundary
const
char
*
nextAligned
=
reinterpret_cast
<
const
char
*>
((
reinterpret_cast
<
size_t
>
(
p
)
+
15
)
&
~
15
);
while
(
p
!=
nextAligned
)
if
(
*
p
==
' '
||
*
p
==
'\n'
||
*
p
==
'\r'
||
*
p
==
'\t'
)
++
p
;
else
return
p
;
// The rest of string using SIMD
static
const
char
whitespace
[
16
]
=
"
\n\r\t
"
;
const
__m128i
w
=
_mm_load_si128
((
const
__m128i
*
)
&
whitespace
[
0
]);
static
const
char
whitespace
[
16
]
=
"
\n\r\t
"
;
const
__m128i
w
=
_mm_load_si128
((
const
__m128i
*
)
&
whitespace
[
0
]);
for
(;;
p
+=
16
)
{
const
__m128i
s
=
_mm_load_si128
((
const
__m128i
*
)
p
);
...
...
@@ -292,31 +292,31 @@ inline const char *SkipWhitespace_SIMD(const char* p) {
//! Skip whitespace with SSE2 instructions, testing 16 8-byte characters at once.
inline
const
char
*
SkipWhitespace_SIMD
(
const
char
*
p
)
{
// Fast return for single non-whitespace
if
(
*
p
==
' '
||
*
p
==
'\n'
||
*
p
==
'\r'
||
*
p
==
'\t'
)
++
p
;
else
return
p
;
// Fast return for single non-whitespace
if
(
*
p
==
' '
||
*
p
==
'\n'
||
*
p
==
'\r'
||
*
p
==
'\t'
)
++
p
;
else
return
p
;
// 16-byte align to the next boundary
const
char
*
nextAligned
=
reinterpret_cast
<
const
char
*>
((
reinterpret_cast
<
size_t
>
(
p
)
+
15
)
&
~
15
);
while
(
p
!=
nextAligned
)
if
(
*
p
==
' '
||
*
p
==
'\n'
||
*
p
==
'\r'
||
*
p
==
'\t'
)
++
p
;
else
return
p
;
const
char
*
nextAligned
=
reinterpret_cast
<
const
char
*>
((
reinterpret_cast
<
size_t
>
(
p
)
+
15
)
&
~
15
);
while
(
p
!=
nextAligned
)
if
(
*
p
==
' '
||
*
p
==
'\n'
||
*
p
==
'\r'
||
*
p
==
'\t'
)
++
p
;
else
return
p
;
// The rest of string
static
const
char
whitespaces
[
4
][
17
]
=
{
" "
,
"
\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
"
,
"
\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r
"
,
"
\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t
"
};
const
__m128i
w0
=
_mm_loadu_si128
((
const
__m128i
*
)
&
whitespaces
[
0
][
0
]);
const
__m128i
w1
=
_mm_loadu_si128
((
const
__m128i
*
)
&
whitespaces
[
1
][
0
]);
const
__m128i
w2
=
_mm_loadu_si128
((
const
__m128i
*
)
&
whitespaces
[
2
][
0
]);
const
__m128i
w3
=
_mm_loadu_si128
((
const
__m128i
*
)
&
whitespaces
[
3
][
0
]);
static
const
char
whitespaces
[
4
][
17
]
=
{
" "
,
"
\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
"
,
"
\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r
"
,
"
\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t
"
};
const
__m128i
w0
=
_mm_loadu_si128
((
const
__m128i
*
)
&
whitespaces
[
0
][
0
]);
const
__m128i
w1
=
_mm_loadu_si128
((
const
__m128i
*
)
&
whitespaces
[
1
][
0
]);
const
__m128i
w2
=
_mm_loadu_si128
((
const
__m128i
*
)
&
whitespaces
[
2
][
0
]);
const
__m128i
w3
=
_mm_loadu_si128
((
const
__m128i
*
)
&
whitespaces
[
3
][
0
]);
for
(;;
p
+=
16
)
{
const
__m128i
s
=
_mm_load_si128
((
const
__m128i
*
)
p
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment