Skip to content

Commit 58cddc9

Browse files
committed
Use new impl in decimal32_fast
1 parent 0b94018 commit 58cddc9

File tree

1 file changed

+4
-21
lines changed

1 file changed

+4
-21
lines changed

include/boost/decimal/decimal32_fast.hpp

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -820,17 +820,10 @@ constexpr auto operator-(decimal32_fast lhs, decimal32_fast rhs) noexcept -> dec
820820
}
821821
#endif
822822

823-
if (!lhs.isneg() && rhs.isneg())
824-
{
825-
return lhs + (-rhs);
826-
}
827-
828-
const bool abs_lhs_bigger {abs(lhs) > abs(rhs)};
829-
830-
return detail::sub_impl<decimal32_fast>(
823+
return detail::new_sub_impl<decimal32_fast>(
831824
lhs.significand_, lhs.biased_exponent(), lhs.sign_,
832825
rhs.significand_, rhs.biased_exponent(), rhs.sign_,
833-
abs_lhs_bigger
826+
abs(lhs) > abs(rhs)
834827
);
835828
}
836829

@@ -850,18 +843,13 @@ constexpr auto operator-(decimal32_fast lhs, Integer rhs) noexcept
850843

851844
auto sig_rhs {static_cast<promoted_significand_type>(detail::make_positive_unsigned(rhs))};
852845

853-
if (!lhs.isneg() && (rhs < 0))
854-
{
855-
return lhs + sig_rhs;
856-
}
857-
858846
const bool abs_lhs_bigger {abs(lhs) > sig_rhs};
859847

860848
exp_type exp_rhs {0};
861849
detail::normalize(sig_rhs, exp_rhs);
862850
auto final_sig_rhs {static_cast<decimal32_fast::significand_type>(detail::make_positive_unsigned(sig_rhs))};
863851

864-
return detail::sub_impl<decimal32_fast>(
852+
return detail::new_sub_impl<decimal32_fast>(
865853
lhs.significand_, lhs.biased_exponent(), lhs.sign_,
866854
final_sig_rhs, exp_rhs, (rhs < 0),
867855
abs_lhs_bigger);
@@ -881,19 +869,14 @@ constexpr auto operator-(Integer lhs, decimal32_fast rhs) noexcept
881869
}
882870
#endif
883871

884-
if (lhs >= 0 && rhs.isneg())
885-
{
886-
return lhs + (-rhs);
887-
}
888-
889872
auto sig_lhs {static_cast<promoted_significand_type>(detail::make_positive_unsigned(lhs))};
890873
const bool abs_lhs_bigger {sig_lhs > abs(rhs)};
891874

892875
exp_type exp_lhs {0};
893876
detail::normalize(sig_lhs, exp_lhs);
894877
auto final_sig_lhs {static_cast<decimal32_fast::significand_type>(detail::make_positive_unsigned(sig_lhs))};
895878

896-
return detail::sub_impl<decimal32_fast>(
879+
return detail::new_sub_impl<decimal32_fast>(
897880
final_sig_lhs, exp_lhs, (lhs < 0),
898881
rhs.significand_, rhs.biased_exponent(), rhs.sign_,
899882
abs_lhs_bigger

0 commit comments

Comments
 (0)