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
30588248
Commit
30588248
authored
Mar 13, 2016
by
Konstantin Trushin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
do potentially precision-losing conversions explicitly
parent
d454d214
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
7 deletions
+7
-7
pointer.h
include/rapidjson/pointer.h
+4
-4
itoatest.cpp
test/unittest/itoatest.cpp
+2
-2
strtodtest.cpp
test/unittest/strtodtest.cpp
+1
-1
No files found.
include/rapidjson/pointer.h
View file @
30588248
...
...
@@ -987,11 +987,11 @@ private:
src_
++
;
Ch
c
=
0
;
for
(
int
j
=
0
;
j
<
2
;
j
++
)
{
c
<<=
4
;
c
=
static_cast
<
Ch
>
(
c
<<
4
)
;
Ch
h
=
*
src_
;
if
(
h
>=
'0'
&&
h
<=
'9'
)
c
+=
h
-
'0'
;
else
if
(
h
>=
'A'
&&
h
<=
'F'
)
c
+=
h
-
'A'
+
10
;
else
if
(
h
>=
'a'
&&
h
<=
'f'
)
c
+=
h
-
'a'
+
10
;
if
(
h
>=
'0'
&&
h
<=
'9'
)
c
=
static_cast
<
Ch
>
(
c
+
h
-
'0'
)
;
else
if
(
h
>=
'A'
&&
h
<=
'F'
)
c
=
static_cast
<
Ch
>
(
c
+
h
-
'A'
+
10
)
;
else
if
(
h
>=
'a'
&&
h
<=
'f'
)
c
=
static_cast
<
Ch
>
(
c
+
h
-
'a'
+
10
)
;
else
{
valid_
=
false
;
return
0
;
...
...
test/unittest/itoatest.cpp
View file @
30588248
...
...
@@ -93,7 +93,7 @@ static void u32toa_naive(uint32_t value, char* buffer) {
char
temp
[
10
];
char
*
p
=
temp
;
do
{
*
p
++
=
char
(
value
%
10
)
+
'0'
;
*
p
++
=
static_cast
<
char
>
(
char
(
value
%
10
)
+
'0'
)
;
value
/=
10
;
}
while
(
value
>
0
);
...
...
@@ -117,7 +117,7 @@ static void u64toa_naive(uint64_t value, char* buffer) {
char
temp
[
20
];
char
*
p
=
temp
;
do
{
*
p
++
=
char
(
value
%
10
)
+
'0'
;
*
p
++
=
static_cast
<
char
>
(
char
(
value
%
10
)
+
'0'
)
;
value
/=
10
;
}
while
(
value
>
0
);
...
...
test/unittest/strtodtest.cpp
View file @
30588248
...
...
@@ -42,7 +42,7 @@ TEST(Strtod, CheckApproximationCase) {
u
.
u
=
0x465a72e467d88
|
((
static_cast
<
uint64_t
>
(
-
149
+
kExponentBias
))
<<
kSignificandSize
);
const
double
b
=
u
.
d
;
const
uint64_t
bInt
=
(
u
.
u
&
kSignificandMask
)
|
kHiddenBit
;
const
int
bExp
=
((
u
.
u
&
kExponentMask
)
>>
kSignificandSize
)
-
kExponentBias
-
kSignificandSize
;
const
int
bExp
=
static_cast
<
int
>
(((
u
.
u
&
kExponentMask
)
>>
kSignificandSize
)
-
kExponentBias
-
kSignificandSize
)
;
EXPECT_DOUBLE_EQ
(
1.7864e-45
,
b
);
EXPECT_EQ
(
RAPIDJSON_UINT64_C2
(
0x001465a7
,
0x2e467d88
),
bInt
);
EXPECT_EQ
(
-
201
,
bExp
);
...
...
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