Skip to content

Commit a93e69a

Browse files
committed
Change frexp10 overloads
1 parent 6899538 commit a93e69a

File tree

5 files changed

+9
-42
lines changed

5 files changed

+9
-42
lines changed

include/boost/decimal/decimal128.hpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -575,10 +575,7 @@ BOOST_DECIMAL_EXPORT class decimal128 final
575575

576576
// <cmath> functions that need to be friends
577577
template <BOOST_DECIMAL_DECIMAL_FLOATING_TYPE T>
578-
friend constexpr auto frexp10(T num, int* expptr) noexcept
579-
-> std::enable_if_t<detail::is_decimal_floating_point_v<T>,
580-
std::conditional_t<std::is_same<T, decimal32>::value, std::uint32_t,
581-
std::conditional_t<std::is_same<T, decimal64>::value, std::uint64_t, detail::uint128>>>;
578+
friend constexpr auto frexp10(T num, int* expptr) noexcept;
582579

583580
friend constexpr auto copysignd128(decimal128 mag, decimal128 sgn) noexcept -> decimal128;
584581
friend constexpr auto scalblnd128(decimal128 num, long exp) noexcept -> decimal128;

include/boost/decimal/decimal32.hpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -561,10 +561,7 @@ BOOST_DECIMAL_EXPORT class decimal32 final // NOLINT(cppcoreguidelines-special-m
561561

562562
// Related to <cmath>
563563
template <BOOST_DECIMAL_DECIMAL_FLOATING_TYPE T>
564-
friend constexpr auto frexp10(T num, int* expptr) noexcept
565-
-> std::enable_if_t<detail::is_decimal_floating_point_v<T>,
566-
std::conditional_t<std::is_same<T, decimal32>::value, std::uint32_t,
567-
std::conditional_t<std::is_same<T, decimal64>::value, std::uint64_t, detail::uint128>>>;
564+
friend constexpr auto frexp10(T num, int* expptr) noexcept;
568565

569566
friend constexpr auto scalbnd32(decimal32 num, int exp) noexcept -> decimal32;
570567
friend constexpr auto scalblnd32(decimal32 num, long exp) noexcept -> decimal32;

include/boost/decimal/decimal32_fast.hpp

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ class decimal32_fast final
6464
friend constexpr auto to_integral(Decimal val) noexcept
6565
BOOST_DECIMAL_REQUIRES_TWO_RETURN(detail::is_decimal_floating_point_v, Decimal, detail::is_integral_v, TargetType, TargetType);
6666

67+
template <BOOST_DECIMAL_DECIMAL_FLOATING_TYPE T>
68+
friend constexpr auto frexp10(T num, int* expptr) noexcept;
69+
6770
public:
6871
constexpr decimal32_fast() noexcept : significand_{}, exponent_{}, sign_ {} {}
6972

@@ -135,31 +138,7 @@ class decimal32_fast final
135138
explicit constexpr operator detail::int128_t() const noexcept;
136139
explicit constexpr operator detail::uint128_t() const noexcept;
137140
#endif
138-
139-
#if !defined(BOOST_DECIMAL_DISABLE_CLIB)
140-
141-
// TODO(mborland): Remove and use the base implementation in io.hpp
142-
template <typename charT, typename traits>
143-
friend auto operator<<(std::basic_ostream<charT, traits>& os, const decimal32_fast& d) -> std::basic_ostream<charT, traits>&
144-
{
145-
if (d.sign_)
146-
{
147-
os << '-';
148-
}
149-
150-
os << d.significand_ << "e";
151-
const auto biased_exp {d.biased_exponent()};
152-
if (biased_exp > 0)
153-
{
154-
os << '+';
155-
}
156-
os << biased_exp;
157-
158-
return os;
159-
}
160-
161-
#endif
162-
141+
163142
friend constexpr auto direct_init(std::uint32_t significand, std::uint8_t exponent, bool sign) noexcept -> decimal32_fast;
164143
};
165144

include/boost/decimal/decimal64.hpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -563,10 +563,7 @@ BOOST_DECIMAL_EXPORT class decimal64 final
563563

564564
// <cmath> functions that need to be friends
565565
template <BOOST_DECIMAL_DECIMAL_FLOATING_TYPE T>
566-
friend constexpr auto frexp10(T num, int* expptr) noexcept
567-
-> std::enable_if_t<detail::is_decimal_floating_point_v<T>,
568-
std::conditional_t<std::is_same<T, decimal32>::value, std::uint32_t,
569-
std::conditional_t<std::is_same<T, decimal64>::value, std::uint64_t, detail::uint128>>>;
566+
friend constexpr auto frexp10(T num, int* expptr) noexcept;
570567

571568
friend constexpr auto copysignd64(decimal64 mag, decimal64 sgn) noexcept -> decimal64;
572569
friend constexpr auto fmad64(decimal64 x, decimal64 y, decimal64 z) noexcept -> decimal64;

include/boost/decimal/detail/cmath/frexp10.hpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,9 @@ namespace decimal {
2626
// If the conversion can not be performed returns UINT32_MAX and exp = 0
2727
BOOST_DECIMAL_EXPORT template <BOOST_DECIMAL_DECIMAL_FLOATING_TYPE T>
2828
constexpr auto frexp10(T num, int* expptr) noexcept
29-
-> std::enable_if_t<detail::is_decimal_floating_point_v<T>,
30-
std::conditional_t<std::is_same<T, decimal32>::value, std::uint32_t,
31-
std::conditional_t<std::is_same<T, decimal64>::value, std::uint64_t, detail::uint128>>>
3229
{
33-
using ReturnType = std::conditional_t<std::is_same<T, decimal32>::value, std::uint32_t,
34-
std::conditional_t<std::is_same<T, decimal64>::value, std::uint64_t, detail::uint128>>;
30+
using ReturnType = std::conditional_t<std::is_same<T, decimal32>::value || std::is_same<T, decimal32_fast>::value, std::uint32_t,
31+
std::conditional_t<std::is_same<T, decimal64>::value, std::uint64_t, detail::uint128>>;
3532

3633
constexpr T zero {0, 0};
3734

0 commit comments

Comments
 (0)