Skip to content

Commit 918938a

Browse files
committed
Refactor calling functions
1 parent 428f2e6 commit 918938a

File tree

1 file changed

+21
-18
lines changed

1 file changed

+21
-18
lines changed

include/boost/decimal/dpd_conversion.hpp

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -421,16 +421,6 @@ constexpr auto to_dpd_d32(DecimalType val) noexcept
421421
return dpd;
422422
}
423423

424-
constexpr auto to_dpd(decimal32 val) noexcept -> std::uint32_t
425-
{
426-
return to_dpd_d32(val);
427-
}
428-
429-
constexpr auto to_dpd(decimal32_fast val) noexcept -> std::uint32_t
430-
{
431-
return to_dpd_d32(val);
432-
}
433-
434424
template <typename DecimalType = decimal32_fast>
435425
constexpr auto from_dpd_d32(std::uint32_t dpd) noexcept
436426
BOOST_DECIMAL_REQUIRES(detail::is_decimal_floating_point_v, DecimalType)
@@ -513,14 +503,6 @@ constexpr auto from_dpd_d32(std::uint32_t dpd) noexcept
513503
return DecimalType{significand, exp, sign};
514504
}
515505

516-
template <typename DecimalType = decimal32_fast>
517-
constexpr auto from_dpd(std::uint32_t bits) noexcept
518-
BOOST_DECIMAL_REQUIRES(detail::is_decimal_floating_point_v, DecimalType)
519-
{
520-
return from_dpd_d32<DecimalType>(bits);
521-
}
522-
523-
524506
template <typename DecimalType>
525507
constexpr auto to_dpd_d64(DecimalType val) noexcept
526508
BOOST_DECIMAL_REQUIRES_RETURN(detail::is_decimal_floating_point_v, DecimalType, std::uint64_t)
@@ -734,6 +716,27 @@ constexpr auto to_dpd(decimal64_fast val) -> std::uint64_t
734716
return to_dpd_d64(val);
735717
}
736718

719+
template <typename DecimalType>
720+
constexpr auto to_dpd(DecimalType val) noexcept
721+
{
722+
static_assert(detail::is_decimal_floating_point_v<DecimalType>, "Must be a decimal floating point type.");
723+
return to_dpd(val);
724+
}
725+
726+
template <typename DecimalType = decimal32_fast>
727+
constexpr auto from_dpd(std::uint32_t bits) noexcept
728+
BOOST_DECIMAL_REQUIRES(detail::is_decimal_floating_point_v, DecimalType)
729+
{
730+
return from_dpd_d32<DecimalType>(bits);
731+
}
732+
733+
template <typename DecimalType = decimal64_fast>
734+
constexpr auto from_dpd(std::uint64_t bits) noexcept
735+
BOOST_DECIMAL_REQUIRES(detail::is_decimal_floating_point_v, DecimalType)
736+
{
737+
return from_dpd_d64<DecimalType>(bits);
738+
}
739+
737740
} // namespace decimal
738741
} // namespace boost
739742

0 commit comments

Comments
 (0)