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
ad77331c
Commit
ad77331c
authored
Sep 11, 2021
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move log10_2_significand to format-inl.h
parent
d9ebc4e8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
+6
-6
include/fmt/format-inl.h
include/fmt/format-inl.h
+6
-3
include/fmt/format.h
include/fmt/format.h
+0
-3
No files found.
include/fmt/format-inl.h
View file @
ad77331c
...
@@ -149,6 +149,9 @@ template <> FMT_FUNC int count_digits<4>(detail::fallback_uintptr n) {
...
@@ -149,6 +149,9 @@ template <> FMT_FUNC int count_digits<4>(detail::fallback_uintptr n) {
return
i
>=
0
?
i
*
char_digits
+
count_digits
<
4
,
unsigned
>
(
n
.
value
[
i
])
:
1
;
return
i
>=
0
?
i
*
char_digits
+
count_digits
<
4
,
unsigned
>
(
n
.
value
[
i
])
:
1
;
}
}
// log10(2) = 0x0.4d104d427de7fbcc...
static
constexpr
uint64_t
log10_2_significand
=
0x4d104d427de7fbcc
;
#if __cplusplus < 201703L
#if __cplusplus < 201703L
template
<
typename
T
>
constexpr
const
char
basic_data
<
T
>::
digits
[][
2
];
template
<
typename
T
>
constexpr
const
char
basic_data
<
T
>::
digits
[][
2
];
template
<
typename
T
>
constexpr
const
char
basic_data
<
T
>::
hex_digits
[];
template
<
typename
T
>
constexpr
const
char
basic_data
<
T
>::
hex_digits
[];
...
@@ -326,7 +329,7 @@ inline fp get_cached_power(int min_exponent, int& pow10_exponent) {
...
@@ -326,7 +329,7 @@ inline fp get_cached_power(int min_exponent, int& pow10_exponent) {
827
,
853
,
880
,
907
,
933
,
960
,
986
,
1013
,
1039
,
1066
};
827
,
853
,
880
,
907
,
933
,
960
,
986
,
1013
,
1039
,
1066
};
const
int
shift
=
32
;
const
int
shift
=
32
;
const
auto
significand
=
static_cast
<
int64_t
>
(
data
::
log10_2_significand
);
const
auto
significand
=
static_cast
<
int64_t
>
(
log10_2_significand
);
int
index
=
static_cast
<
int
>
(
int
index
=
static_cast
<
int
>
(
((
min_exponent
+
fp
::
significand_size
-
1
)
*
(
significand
>>
shift
)
+
((
min_exponent
+
fp
::
significand_size
-
1
)
*
(
significand
>>
shift
)
+
((
int64_t
(
1
)
<<
shift
)
-
1
))
// ceil
((
int64_t
(
1
)
<<
shift
)
-
1
))
// ceil
...
@@ -913,7 +916,7 @@ inline uint64_t umul96_lower64(uint32_t x, uint64_t y) FMT_NOEXCEPT {
...
@@ -913,7 +916,7 @@ inline uint64_t umul96_lower64(uint32_t x, uint64_t y) FMT_NOEXCEPT {
inline
int
floor_log10_pow2
(
int
e
)
FMT_NOEXCEPT
{
inline
int
floor_log10_pow2
(
int
e
)
FMT_NOEXCEPT
{
FMT_ASSERT
(
e
<=
1700
&&
e
>=
-
1700
,
"too large exponent"
);
FMT_ASSERT
(
e
<=
1700
&&
e
>=
-
1700
,
"too large exponent"
);
const
int
shift
=
22
;
const
int
shift
=
22
;
return
(
e
*
static_cast
<
int
>
(
data
::
log10_2_significand
>>
(
64
-
shift
)))
>>
return
(
e
*
static_cast
<
int
>
(
log10_2_significand
>>
(
64
-
shift
)))
>>
shift
;
shift
;
}
}
...
@@ -932,7 +935,7 @@ inline int floor_log10_pow2_minus_log10_4_over_3(int e) FMT_NOEXCEPT {
...
@@ -932,7 +935,7 @@ inline int floor_log10_pow2_minus_log10_4_over_3(int e) FMT_NOEXCEPT {
FMT_ASSERT
(
e
<=
1700
&&
e
>=
-
1700
,
"too large exponent"
);
FMT_ASSERT
(
e
<=
1700
&&
e
>=
-
1700
,
"too large exponent"
);
const
uint64_t
log10_4_over_3_fractional_digits
=
0x1ffbfc2bbc780375
;
const
uint64_t
log10_4_over_3_fractional_digits
=
0x1ffbfc2bbc780375
;
const
int
shift_amount
=
22
;
const
int
shift_amount
=
22
;
return
(
e
*
static_cast
<
int
>
(
data
::
log10_2_significand
>>
return
(
e
*
static_cast
<
int
>
(
log10_2_significand
>>
(
64
-
shift_amount
))
-
(
64
-
shift_amount
))
-
static_cast
<
int
>
(
log10_4_over_3_fractional_digits
>>
static_cast
<
int
>
(
log10_4_over_3_fractional_digits
>>
(
64
-
shift_amount
)))
>>
(
64
-
shift_amount
)))
>>
...
...
include/fmt/format.h
View file @
ad77331c
...
@@ -885,9 +885,6 @@ using uint64_or_128_t = conditional_t<num_bits<T>() <= 64, uint64_t, uint128_t>;
...
@@ -885,9 +885,6 @@ using uint64_or_128_t = conditional_t<num_bits<T>() <= 64, uint64_t, uint128_t>;
// Static data is placed in this class template for the header-only config.
// Static data is placed in this class template for the header-only config.
template
<
typename
T
=
void
>
struct
basic_data
{
template
<
typename
T
=
void
>
struct
basic_data
{
// log10(2) = 0x0.4d104d427de7fbcc...
static
const
uint64_t
log10_2_significand
=
0x4d104d427de7fbcc
;
// GCC generates slightly better code for pairs than chars.
// GCC generates slightly better code for pairs than chars.
FMT_API
static
constexpr
const
char
digits
[
100
][
2
]
=
{
FMT_API
static
constexpr
const
char
digits
[
100
][
2
]
=
{
{
'0'
,
'0'
},
{
'0'
,
'1'
},
{
'0'
,
'2'
},
{
'0'
,
'3'
},
{
'0'
,
'4'
},
{
'0'
,
'5'
},
{
'0'
,
'0'
},
{
'0'
,
'1'
},
{
'0'
,
'2'
},
{
'0'
,
'3'
},
{
'0'
,
'4'
},
{
'0'
,
'5'
},
...
...
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