Skip to content

Commit f7f8328

Browse files
committed
Add 128x64 and 128x32 mul
1 parent dabfb9b commit f7f8328

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

include/boost/int128/detail/uint128_imp.hpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2334,7 +2334,17 @@ BOOST_INT128_FORCE_INLINE uint128_t msvc_mul(const uint128_t lhs, const uint128_
23342334
BOOST_INT128_FORCE_INLINE uint128_t msvc_mul(const uint128_t lhs, const std::uint64_t rhs) noexcept
23352335
{
23362336
const auto low{lhs.low * rhs};
2337+
const auto high{__umulh(lhs.low, rhs) + (lhs.high * rhs)};
23372338

2339+
return {high, low};
2340+
}
2341+
2342+
BOOST_INT128_FORCE_INLINE uint128_t msvc_mul(const uint128_t lhs, const std::uint32_t rhs) noexcept
2343+
{
2344+
const auto low{lhs.low * rhs};
2345+
const auto high{__umulh(lhs.low, static_cast<std::uint64_t>(rhs)) + (lhs.high * rhs)};
2346+
2347+
return {high, low};
23382348
}
23392349

23402350
#endif // MSVC implementations

0 commit comments

Comments
 (0)