Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
fmt
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
fmt
Commits
6649b8e0
Commit
6649b8e0
authored
Sep 07, 2019
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
value -> bigit
parent
56b5c192
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
7 deletions
+14
-7
include/fmt/format-inl.h
include/fmt/format-inl.h
+14
-7
No files found.
include/fmt/format-inl.h
View file @
6649b8e0
...
@@ -468,16 +468,23 @@ FMT_FUNC fp get_cached_power(int min_exponent, int& pow10_exponent) {
...
@@ -468,16 +468,23 @@ FMT_FUNC fp get_cached_power(int min_exponent, int& pow10_exponent) {
class
bigint
{
class
bigint
{
private:
private:
basic_memory_buffer
<
uint32_t
>
value_
;
// A bigint is stored as an array of bigits (big digits), with bigit at index
static
FMT_CONSTEXPR_DECL
const
int
radix
=
32
;
// 0 being the least significant one.
using
bigit
=
uint32_t
;
basic_memory_buffer
<
bigit
>
bigits_
;
static
FMT_CONSTEXPR_DECL
const
int
bigit_bits
=
bits
<
bigit
>::
value
;
friend
struct
formatter
<
bigint
>
;
friend
struct
formatter
<
bigint
>
;
public:
public:
explicit
bigint
(
uint64_t
n
)
{
explicit
bigint
(
uint64_t
n
)
{
value_
.
resize
(
2
);
int
num_bigits
=
bits
<
uint64_t
>::
value
/
bigit_bits
;
value_
[
0
]
=
n
&
~
uint32_t
(
0
);
bigits_
.
resize
(
num_bigits
);
value_
[
1
]
=
static_cast
<
uint32_t
>
(
n
>>
32
);
for
(
int
i
=
0
;
i
<
num_bigits
;
++
i
)
{
bigits_
[
i
]
=
n
&
~
bigit
(
0
);
n
>>=
bigit_bits
;
}
}
}
bigint
(
const
bigint
&
)
=
delete
;
bigint
(
const
bigint
&
)
=
delete
;
...
@@ -862,8 +869,8 @@ template <> struct formatter<internal::bigint> {
...
@@ -862,8 +869,8 @@ template <> struct formatter<internal::bigint> {
format_context
&
ctx
)
{
format_context
&
ctx
)
{
auto
out
=
ctx
.
out
();
auto
out
=
ctx
.
out
();
bool
first
=
true
;
bool
first
=
true
;
for
(
auto
i
=
n
.
value
_
.
size
();
i
>
0
;
--
i
)
{
for
(
auto
i
=
n
.
bigits
_
.
size
();
i
>
0
;
--
i
)
{
auto
value
=
n
.
value
_
[
i
-
1
];
auto
value
=
n
.
bigits
_
[
i
-
1
];
if
(
first
)
{
if
(
first
)
{
if
(
value
==
0
&&
i
>
1
)
continue
;
if
(
value
==
0
&&
i
>
1
)
continue
;
out
=
format_to
(
out
,
"{:x}"
,
value
);
out
=
format_to
(
out
,
"{:x}"
,
value
);
...
...
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