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
9d603959
Commit
9d603959
authored
May 31, 2022
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix compilation on ppc64
parent
a2681aab
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
17 deletions
+12
-17
include/fmt/format.h
include/fmt/format.h
+6
-11
test/format-impl-test.cc
test/format-impl-test.cc
+5
-5
test/format-test.cc
test/format-test.cc
+1
-1
No files found.
include/fmt/format.h
View file @
9d603959
...
@@ -755,6 +755,9 @@ struct is_fast_float : bool_constant<std::numeric_limits<T>::is_iec559 &&
...
@@ -755,6 +755,9 @@ struct is_fast_float : bool_constant<std::numeric_limits<T>::is_iec559 &&
sizeof
(
T
)
<=
sizeof
(
double
)
>
{};
sizeof
(
T
)
<=
sizeof
(
double
)
>
{};
template
<
typename
T
>
struct
is_fast_float
<
T
,
false
>
:
std
::
false_type
{};
template
<
typename
T
>
struct
is_fast_float
<
T
,
false
>
:
std
::
false_type
{};
template
<
typename
T
>
using
is_double_double
=
bool_constant
<
std
::
numeric_limits
<
T
>::
digits
==
106
>
;
#ifndef FMT_USE_FULL_CACHE_DRAGONBOX
#ifndef FMT_USE_FULL_CACHE_DRAGONBOX
# define FMT_USE_FULL_CACHE_DRAGONBOX 0
# define FMT_USE_FULL_CACHE_DRAGONBOX 0
#endif
#endif
...
@@ -1314,15 +1317,9 @@ struct float_info<T, enable_if_t<std::numeric_limits<T>::digits == 64 ||
...
@@ -1314,15 +1317,9 @@ struct float_info<T, enable_if_t<std::numeric_limits<T>::digits == 64 ||
static
const
int
exponent_bits
=
15
;
static
const
int
exponent_bits
=
15
;
};
};
template
<
int
>
constexpr
int
check_digits
();
// A double-double floating point number.
// A double-double floating point number.
template
<
typename
T
>
template
<
typename
T
>
struct
float_info
<
T
,
enable_if_t
<!
(
std
::
numeric_limits
<
T
>::
digits
==
64
||
struct
float_info
<
T
,
enable_if_t
<
is_double_double
<
T
>::
value
>>
{
std
::
numeric_limits
<
T
>::
digits
==
113
||
is_float128
<
T
>::
value
)
&&
std
::
is_same
<
T
,
long
double
>::
value
>>
{
static
constexpr
int
check
=
check_digits
<
std
::
numeric_limits
<
T
>::
digits
>
();
using
carrier_uint
=
detail
::
uint128_t
;
using
carrier_uint
=
detail
::
uint128_t
;
};
};
...
@@ -1400,8 +1397,7 @@ template <typename F> struct basic_fp {
...
@@ -1400,8 +1397,7 @@ template <typename F> struct basic_fp {
template
<
typename
Float
>
FMT_CONSTEXPR
basic_fp
(
Float
n
)
{
assign
(
n
);
}
template
<
typename
Float
>
FMT_CONSTEXPR
basic_fp
(
Float
n
)
{
assign
(
n
);
}
// Assigns n to this and return true iff predecessor is closer than successor.
// Assigns n to this and return true iff predecessor is closer than successor.
template
<
typename
Float
,
template
<
typename
Float
,
FMT_ENABLE_IF
(
!
is_double_double
<
Float
>
::
value
)
>
FMT_ENABLE_IF
(
std
::
numeric_limits
<
Float
>
::
is_iec559
)
>
FMT_CONSTEXPR
auto
assign
(
Float
n
)
->
bool
{
FMT_CONSTEXPR
auto
assign
(
Float
n
)
->
bool
{
static_assert
(
std
::
numeric_limits
<
Float
>::
digits
<=
113
,
"unsupported FP"
);
static_assert
(
std
::
numeric_limits
<
Float
>::
digits
<=
113
,
"unsupported FP"
);
// Assume Float is in the format [sign][exponent][significand].
// Assume Float is in the format [sign][exponent][significand].
...
@@ -1426,8 +1422,7 @@ template <typename F> struct basic_fp {
...
@@ -1426,8 +1422,7 @@ template <typename F> struct basic_fp {
return
is_predecessor_closer
;
return
is_predecessor_closer
;
}
}
template
<
typename
Float
,
template
<
typename
Float
,
FMT_ENABLE_IF
(
is_double_double
<
Float
>
::
value
)
>
FMT_ENABLE_IF
(
!
std
::
numeric_limits
<
Float
>
::
is_iec559
)
>
FMT_CONSTEXPR
auto
assign
(
Float
n
)
->
bool
{
FMT_CONSTEXPR
auto
assign
(
Float
n
)
->
bool
{
static_assert
(
std
::
numeric_limits
<
double
>::
is_iec559
,
"unsupported FP"
);
static_assert
(
std
::
numeric_limits
<
double
>::
is_iec559
,
"unsupported FP"
);
return
assign
(
static_cast
<
double
>
(
n
));
return
assign
(
static_cast
<
double
>
(
n
));
...
...
test/format-impl-test.cc
View file @
9d603959
...
@@ -379,17 +379,17 @@ bool operator>=(const double_double& lhs, const double_double& rhs) {
...
@@ -379,17 +379,17 @@ bool operator>=(const double_double& lhs, const double_double& rhs) {
namespace
std
{
namespace
std
{
template
<
>
struct
is_floating_point
<
double_double
>
:
std
::
true_type
{};
template
<
>
struct
is_floating_point
<
double_double
>
:
std
::
true_type
{};
template
<
>
struct
numeric_limits
<
double_double
>
{
template
<
>
struct
numeric_limits
<
double_double
>
{
static
constexpr
bool
is_iec559
=
false
;
// is_iec559 is true for double-double in libstdc++.
static
constexpr
bool
is_iec559
=
true
;
static
constexpr
int
digits
=
106
;
static
constexpr
int
digits
=
106
;
};
};
}
// namespace std
}
// namespace std
TEST
(
format_impl_test
,
write_double_double
)
{
TEST
(
format_impl_test
,
write_double_double
)
{
// TODO: restore
auto
s
=
std
::
string
();
// auto s = std::string();
fmt
::
detail
::
write
<
char
>
(
std
::
back_inserter
(
s
),
double_double
(
42
),
{});
// fmt::detail::write<char>(std::back_inserter(s), double_double(42), {});
#ifndef _MSC_VER // MSVC has an issue with specializing is_floating_point.
#ifndef _MSC_VER // MSVC has an issue with specializing is_floating_point.
//
EXPECT_EQ(s, "42");
EXPECT_EQ
(
s
,
"42"
);
#endif
#endif
}
}
...
...
test/format-test.cc
View file @
9d603959
...
@@ -1984,7 +1984,7 @@ TEST(format_test, to_string) {
...
@@ -1984,7 +1984,7 @@ TEST(format_test, to_string) {
EXPECT_EQ
(
fmt
::
to_string
(
zero
),
"0"
);
EXPECT_EQ
(
fmt
::
to_string
(
zero
),
"0"
);
#if FMT_USE_FLOAT128
#if FMT_USE_FLOAT128
EXPECT_EQ
(
fmt
::
to_string
(
__float128
(
0.
42
)),
"0.42
"
);
EXPECT_EQ
(
fmt
::
to_string
(
__float128
(
0.
5
)),
"0.5
"
);
#endif
#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