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
4678192c
Commit
4678192c
authored
Jun 04, 2021
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove bsr2log10
parent
7c3d3dfa
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
12 deletions
+7
-12
include/fmt/format.h
include/fmt/format.h
+7
-12
No files found.
include/fmt/format.h
View file @
4678192c
...
@@ -926,17 +926,6 @@ extern template struct basic_data<void>;
...
@@ -926,17 +926,6 @@ extern template struct basic_data<void>;
// This is a struct rather than an alias to avoid shadowing warnings in gcc.
// This is a struct rather than an alias to avoid shadowing warnings in gcc.
struct
data
:
basic_data
<>
{};
struct
data
:
basic_data
<>
{};
// Maps bsr(n) to ceil(log10(pow(2, bsr(n) + 1) - 1)).
// This is a function instead of an array to workaround a bug in GCC10 (#1810).
FMT_INLINE
auto
bsr2log10
(
int
bsr
)
->
uint16_t
{
static
constexpr
uint16_t
data
[]
=
{
1
,
1
,
1
,
2
,
2
,
2
,
3
,
3
,
3
,
4
,
4
,
4
,
4
,
5
,
5
,
5
,
6
,
6
,
6
,
7
,
7
,
7
,
7
,
8
,
8
,
8
,
9
,
9
,
9
,
10
,
10
,
10
,
10
,
11
,
11
,
11
,
12
,
12
,
12
,
13
,
13
,
13
,
13
,
14
,
14
,
14
,
15
,
15
,
15
,
16
,
16
,
16
,
16
,
17
,
17
,
17
,
18
,
18
,
18
,
19
,
19
,
19
,
19
,
20
};
return
data
[
bsr
];
}
template
<
typename
T
>
FMT_CONSTEXPR
auto
count_digits_fallback
(
T
n
)
->
int
{
template
<
typename
T
>
FMT_CONSTEXPR
auto
count_digits_fallback
(
T
n
)
->
int
{
int
count
=
1
;
int
count
=
1
;
for
(;;)
{
for
(;;)
{
...
@@ -965,7 +954,13 @@ FMT_CONSTEXPR20 inline auto count_digits(uint64_t n) -> int {
...
@@ -965,7 +954,13 @@ FMT_CONSTEXPR20 inline auto count_digits(uint64_t n) -> int {
}
}
#ifdef FMT_BUILTIN_CLZLL
#ifdef FMT_BUILTIN_CLZLL
// https://github.com/fmtlib/format-benchmark/blob/master/digits10
// https://github.com/fmtlib/format-benchmark/blob/master/digits10
auto
t
=
bsr2log10
(
FMT_BUILTIN_CLZLL
(
n
|
1
)
^
63
);
// Maps bsr(n) to ceil(log10(pow(2, bsr(n) + 1) - 1)).
FMT_STATIC_CONSTEXPR
uint16_t
bsr2log10
[]
=
{
1
,
1
,
1
,
2
,
2
,
2
,
3
,
3
,
3
,
4
,
4
,
4
,
4
,
5
,
5
,
5
,
6
,
6
,
6
,
7
,
7
,
7
,
7
,
8
,
8
,
8
,
9
,
9
,
9
,
10
,
10
,
10
,
10
,
11
,
11
,
11
,
12
,
12
,
12
,
13
,
13
,
13
,
13
,
14
,
14
,
14
,
15
,
15
,
15
,
16
,
16
,
16
,
16
,
17
,
17
,
17
,
18
,
18
,
18
,
19
,
19
,
19
,
19
,
20
};
auto
t
=
bsr2log10
[
FMT_BUILTIN_CLZLL
(
n
|
1
)
^
63
];
constexpr
const
uint64_t
zero_or_powers_of_10
[]
=
{
constexpr
const
uint64_t
zero_or_powers_of_10
[]
=
{
0
,
0
,
FMT_POWERS_OF_10
(
1U
),
FMT_POWERS_OF_10
(
1000000000ULL
),
0
,
0
,
FMT_POWERS_OF_10
(
1U
),
FMT_POWERS_OF_10
(
1000000000ULL
),
10000000000000000000ULL
};
10000000000000000000ULL
};
...
...
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