Skip to content

Commit

Permalink
Use attributes in fenv
Browse files Browse the repository at this point in the history
  • Loading branch information
mborland committed Feb 17, 2025
1 parent 75737d6 commit 9696bc4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions include/boost/decimal/detail/attributes.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ constexpr auto max_significand_v() noexcept
template <BOOST_DECIMAL_DECIMAL_FLOATING_TYPE DecimalType, std::enable_if_t<decimal_val_v<DecimalType> >= 128, bool> = true>
constexpr auto max_significand_v() noexcept
{
return std::is_same<DecimalType, decimal128>::value ? uint128{UINT64_C(0b1111111111'1111111111'1111111111'1111111111'111111), UINT64_MAX} :
uint128{UINT64_C(542101086242752), UINT64_C(4003012203950112767)};
return decimal_val_v<DecimalType> == 128 ? uint128{UINT64_C(0b1111111111'1111111111'1111111111'1111111111'111111), UINT64_MAX} :
uint128{UINT64_C(542101086242752), UINT64_C(4003012203950112767)};
}

template <BOOST_DECIMAL_DECIMAL_FLOATING_TYPE DecimalType>
Expand Down
4 changes: 2 additions & 2 deletions include/boost/decimal/detail/fenv_rounding.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace detail {
template <typename TargetType = decimal32, typename T, std::enable_if_t<is_integral_v<T>, bool> = true>
constexpr auto fenv_round(T& val, bool = false) noexcept -> int
{
using significand_type = std::conditional_t<std::is_same<TargetType, decimal128>::value || std::is_same<TargetType, decimal128_fast>::value, detail::uint128, int>;
using significand_type = std::conditional_t<decimal_val_v<TargetType> >= 128, detail::uint128, std::int64_t>;

const auto trailing_num {val % 10};
int exp_delta {};
Expand All @@ -46,7 +46,7 @@ constexpr auto fenv_round(T& val, bool = false) noexcept -> int
template <typename TargetType = decimal32, typename T, std::enable_if_t<is_integral_v<T>, bool> = true>
constexpr auto fenv_round(T& val, bool is_neg = false) noexcept -> int // NOLINT(readability-function-cognitive-complexity)
{
using significand_type = std::conditional_t<std::is_same<TargetType, decimal128>::value || std::is_same<TargetType, decimal128_fast>::value, detail::uint128, int>;
using significand_type = std::conditional_t<decimal_val_v<TargetType> >= 128, detail::uint128, std::int64_t>;

if (BOOST_DECIMAL_IS_CONSTANT_EVALUATED(coeff))
{
Expand Down

0 comments on commit 9696bc4

Please sign in to comment.