Skip to content

Commit 706e58e

Browse files
committed
Fix possible promotion issues for ancient clang toolchains
1 parent aae50cd commit 706e58e

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

include/boost/decimal/decimal32_fast.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ constexpr decimal32_fast::decimal32_fast(T1 coeff, T2 exp, bool sign) noexcept
379379
exp = 0;
380380
}
381381

382-
auto biased_exp {static_cast<std::uint64_t>(exp + detail::bias)};
382+
auto biased_exp {static_cast<std::int64_t>(exp + detail::bias)};
383383

384384
// Decimal32 exponent holds 8 bits
385385
if (biased_exp > detail::max_biased_exp_v<decimal32_fast> || exp > detail::max_biased_exp_v<decimal32_fast>)
@@ -1028,7 +1028,7 @@ constexpr auto div_impl(decimal32_fast lhs, decimal32_fast rhs, decimal32_fast&
10281028
<< "\nexp rhs: " << exp_rhs << std::endl;
10291029
#endif
10301030

1031-
using promoted_type = std::uint_fast64_t;
1031+
using promoted_type = std::uint64_t;
10321032

10331033
// We promote to uint64 since the significands are currently 32-bits
10341034
// By appending enough zeros to the LHS we end up finding what we need anyway

include/boost/decimal/detail/promote_significand.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ namespace impl {
1919
template <BOOST_DECIMAL_DECIMAL_FLOATING_TYPE DecimalType, BOOST_DECIMAL_INTEGRAL Integer>
2020
struct promote_significand
2121
{
22-
using type = std::conditional_t<std::numeric_limits<Integer>::digits10 < std::numeric_limits<typename DecimalType::significand_type>::digits10,
22+
using type = std::conditional_t<std::numeric_limits<make_unsigned_t<Integer>>::digits10 < std::numeric_limits<typename DecimalType::significand_type>::digits10,
2323
typename DecimalType::significand_type, detail::make_unsigned_t<Integer>>;
2424
};
2525

0 commit comments

Comments
 (0)