Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
json
Project
Overview
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
json
Commits
0067ea8f
Commit
0067ea8f
authored
Mar 13, 2019
by
Ferenc Nasztanovics
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change macros to numeric_limits #1483
parent
0c65ba96
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
2 deletions
+2
-2
to_chars.hpp
include/nlohmann/detail/conversions/to_chars.hpp
+1
-1
json.hpp
single_include/nlohmann/json.hpp
+1
-1
No files found.
include/nlohmann/detail/conversions/to_chars.hpp
View file @
0067ea8f
...
@@ -751,7 +751,7 @@ inline void grisu2_digit_gen(char* buffer, int& length, int& decimal_exponent,
...
@@ -751,7 +751,7 @@ inline void grisu2_digit_gen(char* buffer, int& length, int& decimal_exponent,
// = buffer * 10^-m + 10^-m * (1/10 * (10 * p2) ) * 2^e
// = buffer * 10^-m + 10^-m * (1/10 * (10 * p2) ) * 2^e
// = buffer * 10^-m + 10^-m * (1/10 * ((10*p2 div 2^-e) * 2^-e + (10*p2 mod 2^-e)) * 2^e
// = buffer * 10^-m + 10^-m * (1/10 * ((10*p2 div 2^-e) * 2^-e + (10*p2 mod 2^-e)) * 2^e
//
//
assert
(
p2
<=
UINT64_MAX
/
10
);
assert
(
p2
<=
std
::
numeric_limits
<
std
::
uint64_t
>::
max
()
/
10
);
p2
*=
10
;
p2
*=
10
;
const
uint64_t
d
=
p2
>>
-
one
.
e
;
// d = (10 * p2) div 2^-e
const
uint64_t
d
=
p2
>>
-
one
.
e
;
// d = (10 * p2) div 2^-e
const
uint64_t
r
=
p2
&
(
one
.
f
-
1
);
// r = (10 * p2) mod 2^-e
const
uint64_t
r
=
p2
&
(
one
.
f
-
1
);
// r = (10 * p2) mod 2^-e
...
...
single_include/nlohmann/json.hpp
View file @
0067ea8f
...
@@ -10579,7 +10579,7 @@ inline void grisu2_digit_gen(char* buffer, int& length, int& decimal_exponent,
...
@@ -10579,7 +10579,7 @@ inline void grisu2_digit_gen(char* buffer, int& length, int& decimal_exponent,
// = buffer * 10^-m + 10^-m * (1/10 * (10 * p2) ) * 2^e
// = buffer * 10^-m + 10^-m * (1/10 * (10 * p2) ) * 2^e
// = buffer * 10^-m + 10^-m * (1/10 * ((10*p2 div 2^-e) * 2^-e + (10*p2 mod 2^-e)) * 2^e
// = buffer * 10^-m + 10^-m * (1/10 * ((10*p2 div 2^-e) * 2^-e + (10*p2 mod 2^-e)) * 2^e
//
//
assert
(
p2
<=
UINT64_MAX
/
10
);
assert
(
p2
<=
std
::
numeric_limits
<
std
::
uint64_t
>::
max
()
/
10
);
p2
*=
10
;
p2
*=
10
;
const
uint64_t
d
=
p2
>>
-
one
.
e
;
// d = (10 * p2) div 2^-e
const
uint64_t
d
=
p2
>>
-
one
.
e
;
// d = (10 * p2) div 2^-e
const
uint64_t
r
=
p2
&
(
one
.
f
-
1
);
// r = (10 * p2) mod 2^-e
const
uint64_t
r
=
p2
&
(
one
.
f
-
1
);
// r = (10 * p2) mod 2^-e
...
...
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