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
4c212881
Commit
4c212881
authored
Sep 14, 2014
by
Milo Yip
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add 32-bit support for custom strtod
parent
855da06d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
4 deletions
+23
-4
strtod.h
include/rapidjson/internal/strtod.h
+23
-4
No files found.
include/rapidjson/internal/strtod.h
View file @
4c212881
...
...
@@ -299,17 +299,36 @@ private:
static
uint64_t
MulAdd64
(
uint64_t
a
,
uint64_t
b
,
uint64_t
k
,
uint64_t
*
outHigh
)
{
#if defined(_MSC_VER) && defined(_M_AMD64)
uint64_t
low
=
_umul128
(
a
,
b
,
outHigh
);
uint64_t
outLow
=
low
+
k
;
if
(
outLow
<
low
)
low
+=
k
;
if
(
low
<
k
)
(
*
outHigh
)
++
;
return
outL
ow
;
return
l
ow
;
#elif (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) && defined(__x86_64__)
unsigned
__int128
p
=
static_cast
<
unsigned
__int128
>
(
a
)
*
static_cast
<
unsigned
__int128
>
(
b
);
p
+=
k
;
*
outHigh
=
p
>>
64
;
return
static_cast
<
uint64_t
>
(
p
);
#else
// TODO
const
uint64_t
a0
=
a
&
0xFFFFFFFF
;
const
uint64_t
a1
=
a
>>
32
;
const
uint64_t
b0
=
b
&
0xFFFFFFFF
;
const
uint64_t
b1
=
b
>>
32
;
uint64_t
x0
=
a0
*
b0
;
uint64_t
x1
=
a0
*
b1
;
uint64_t
x2
=
a1
*
b0
;
uint64_t
x3
=
a1
*
b1
;
x1
+=
(
x0
>>
32
);
// can't give carry
x1
+=
x2
;
if
(
x1
<
x2
)
x3
+=
(
static_cast
<
uint64_t
>
(
1
)
<<
32
);
uint64_t
lo
=
(
x1
<<
32
)
+
(
x0
&
0xFFFFFFFF
);
uint64_t
hi
=
x3
+
(
x1
>>
32
);
lo
+=
k
;
if
(
lo
<
k
)
hi
++
;
*
outHigh
=
hi
;
return
lo
;
#endif
}
...
...
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