Skip to content

Commit 2a2c8f9

Browse files
committed
Cast to correct addition type
1 parent d8f5dbf commit 2a2c8f9

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

include/boost/decimal/detail/add_impl.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,11 @@ BOOST_DECIMAL_FORCE_INLINE constexpr auto d32_add_impl(T lhs_sig, U lhs_exp, boo
2222
T rhs_sig, U rhs_exp, bool rhs_sign,
2323
bool abs_lhs_bigger) noexcept -> ReturnType
2424
{
25+
using add_type = std::int_fast32_t;
26+
2527
auto delta_exp {lhs_exp > rhs_exp ? lhs_exp - rhs_exp : rhs_exp - lhs_exp};
26-
auto signed_sig_lhs {detail::make_signed_value(lhs_sig, lhs_sign)};
27-
auto signed_sig_rhs {detail::make_signed_value(rhs_sig, rhs_sign)};
28+
auto signed_sig_lhs {static_cast<add_type>(detail::make_signed_value(lhs_sig, lhs_sign))};
29+
auto signed_sig_rhs {static_cast<add_type>(detail::make_signed_value(rhs_sig, rhs_sign))};
2830

2931
#ifdef BOOST_DECIMAL_DEBUG_ADD
3032
std::cerr << "Starting sig lhs: " << lhs_sig

0 commit comments

Comments
 (0)