Skip to content

Commit ba77d62

Browse files
committed
Triple speed of decimal64_fast operator*
1 parent 58037a9 commit ba77d62

File tree

1 file changed

+2
-28
lines changed

1 file changed

+2
-28
lines changed

include/boost/decimal/decimal64_fast.hpp

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1073,34 +1073,8 @@ constexpr auto operator*(decimal64_fast lhs, decimal64_fast rhs) noexcept -> dec
10731073
}
10741074
#endif
10751075

1076-
1077-
#if defined(__clang_major__) && __clang_major__ < 13
1078-
1079-
const auto result {detail::d64_mul_impl<detail::decimal64_components>(
1080-
lhs.significand_, lhs.biased_exponent(), lhs.isneg(),
1081-
rhs.significand_, rhs.biased_exponent(), rhs.isneg()
1082-
)};
1083-
1084-
return {result.sig, result.exp, result.sign};
1085-
1086-
#else
1087-
1088-
#ifdef BOOST_DECIMAL_HAS_INT128
1089-
using unsigned_int128_type = boost::decimal::detail::uint128_t;
1090-
#else
1091-
using unsigned_int128_type = boost::decimal::detail::uint128;
1092-
#endif
1093-
1094-
auto res_sig {static_cast<unsigned_int128_type>(lhs.significand_) * static_cast<unsigned_int128_type>(rhs.significand_)};
1095-
1096-
// TODO(mborland): Insert division trick to get this into uint_fast64_t rather than u128 of sorts
1097-
1098-
auto res_exp {lhs.biased_exponent() + rhs.biased_exponent()};
1099-
bool sign {lhs.sign_ != rhs.sign_};
1100-
1101-
return {res_sig, res_exp, sign};
1102-
1103-
#endif
1076+
return detail::d64_mul_impl<decimal64_fast>(lhs.significand_, lhs.biased_exponent(), lhs.sign_,
1077+
rhs.significand_, rhs.biased_exponent(), rhs.sign_);
11041078
}
11051079

11061080
template <typename Integer>

0 commit comments

Comments
 (0)