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
b855c3f7
Commit
b855c3f7
authored
Nov 23, 2014
by
Milo Yip
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor optimization of strtod
parent
3679c280
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
15 deletions
+4
-15
diyfp.h
include/rapidjson/internal/diyfp.h
+2
-14
strtod.h
include/rapidjson/internal/strtod.h
+2
-1
No files found.
include/rapidjson/internal/diyfp.h
View file @
b855c3f7
...
...
@@ -102,8 +102,8 @@ struct DiyFp {
unsigned
long
index
;
_BitScanReverse64
(
&
index
,
f
);
return
DiyFp
(
f
<<
(
63
-
index
),
e
-
(
63
-
index
));
#elif
0//defined(__GNUC__)
int
s
=
__builtin_clzll
(
f
)
+
1
;
#elif
defined(__GNUC__) && __GNUC__ >= 4
int
s
=
__builtin_clzll
(
f
);
return
DiyFp
(
f
<<
s
,
e
-
s
);
#else
DiyFp
res
=
*
this
;
...
...
@@ -111,22 +111,11 @@ struct DiyFp {
res
.
f
<<=
1
;
res
.
e
--
;
}
// while (!(res.f & kDpHiddenBit)) {
// res.f <<= 1;
// res.e--;
// }
// res.f <<= (kDiySignificandSize - kDpSignificandSize - 1);
// res.e = res.e - (kDiySignificandSize - kDpSignificandSize - 1);
return
res
;
#endif
}
DiyFp
NormalizeBoundary
()
const
{
#if defined(_MSC_VER) && defined(_M_AMD64)
unsigned
long
index
;
_BitScanReverse64
(
&
index
,
f
);
return
DiyFp
(
f
<<
(
63
-
index
),
e
-
(
63
-
index
));
#else
DiyFp
res
=
*
this
;
while
(
!
(
res
.
f
&
(
kDpHiddenBit
<<
1
)))
{
res
.
f
<<=
1
;
...
...
@@ -135,7 +124,6 @@ struct DiyFp {
res
.
f
<<=
(
kDiySignificandSize
-
kDpSignificandSize
-
2
);
res
.
e
=
res
.
e
-
(
kDiySignificandSize
-
kDpSignificandSize
-
2
);
return
res
;
#endif
}
void
NormalizedBoundaries
(
DiyFp
*
minus
,
DiyFp
*
plus
)
const
{
...
...
include/rapidjson/internal/strtod.h
View file @
b855c3f7
...
...
@@ -179,7 +179,8 @@ inline bool StrtodDiyFp(const char* decimals, size_t length, size_t decimalPosit
DiyFp
(
RAPIDJSON_UINT64_C2
(
0xf4240000
,
00000000
),
-
44
),
// 10^6
DiyFp
(
RAPIDJSON_UINT64_C2
(
0x98968000
,
00000000
),
-
40
)
// 10^7
};
int
adjustment
=
dExp
-
actualExp
-
1
;
int
adjustment
=
dExp
-
actualExp
-
1
;
RAPIDJSON_ASSERT
(
adjustment
>=
0
&&
adjustment
<
7
);
v
=
v
*
kPow10
[
adjustment
];
if
(
length
+
adjustment
>
19
)
// has more digits than decimal digits in 64-bit
error
+=
kUlp
/
2
;
...
...
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