Skip to content

Commit 88d0d53

Browse files
committed
Fix 64-bit conversion warnings
1 parent cbde558 commit 88d0d53

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

include/boost/decimal/decimal32.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -848,7 +848,7 @@ constexpr auto add_impl(T lhs_sig, std::int32_t lhs_exp, bool lhs_sign,
848848
<< "\nNew neg: " << lhs_sign << std::endl;
849849
#endif
850850

851-
return {lhs_sig, lhs_exp, lhs_sign};
851+
return {static_cast<std::uint32_t>(lhs_sig), lhs_exp, lhs_sign};
852852
}
853853
else if (delta_exp == detail::precision + 1)
854854
{
@@ -868,7 +868,7 @@ constexpr auto add_impl(T lhs_sig, std::int32_t lhs_exp, bool lhs_sign,
868868
<< "\nNew neg: " << lhs_sign << std::endl;
869869
#endif
870870

871-
return {lhs_sig, lhs_exp, lhs_sign};
871+
return {static_cast<std::uint32_t>(lhs_sig), lhs_exp, lhs_sign};
872872
}
873873

874874
// The two numbers can be added together without special handling
@@ -974,11 +974,11 @@ constexpr auto sub_impl(T lhs_sig, std::int32_t lhs_exp, bool lhs_sign,
974974

975975
if (rhs_sign && !lhs_sign)
976976
{
977-
new_sig = signed_sig_lhs + signed_sig_rhs;
977+
new_sig = static_cast<std::int32_t>(signed_sig_lhs) + static_cast<std::int32_t>(signed_sig_rhs);
978978
}
979979
else
980980
{
981-
new_sig = signed_sig_lhs - signed_sig_rhs;
981+
new_sig = static_cast<std::int32_t>(signed_sig_lhs) - static_cast<std::int32_t>(signed_sig_rhs);
982982
}
983983

984984
const auto new_exp {abs_lhs_bigger ? lhs_exp : rhs_exp};

include/boost/decimal/decimal32_fast.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -508,8 +508,8 @@ constexpr auto div_impl(decimal32_fast lhs, decimal32_fast rhs, decimal32_fast&
508508
<< "\nexp rhs: " << exp_rhs << std::endl;
509509
#endif
510510

511-
detail::decimal32_components lhs_components {sig_lhs, exp_lhs, lhs.isneg()};
512-
detail::decimal32_components rhs_components {sig_rhs, exp_rhs, rhs.isneg()};
511+
detail::decimal32_components lhs_components {static_cast<std::uint32_t>(sig_lhs), exp_lhs, lhs.isneg()};
512+
detail::decimal32_components rhs_components {static_cast<std::uint32_t>(sig_rhs), exp_rhs, rhs.isneg()};
513513
detail::decimal32_components q_components {};
514514

515515
generic_div_impl(lhs_components, rhs_components, q_components);

0 commit comments

Comments
 (0)