- saturating_mul wrong branch
Disclaimer: Not a math guy, but from my understanding:
saturating_mul(a, b); // == a * b, whenever a * b fits
saturating_mul(a, b); // == BOOST_INT128_UINT128_MAX, otherwise
Demo: https://godbolt.org/z/Y6TW9458e
constexpr auto value = boost::int128::uint128_t{1} << 127;
static_assert(BOOST_INT128_UINT128_MAX == boost::int128::saturating_mul(value, boost::int128::uint128_t{1}));
// expected: BOOST_INT128_UINT128_MAX == value
Disclaimer: Not a math guy, but from my understanding:
saturating_mul(a, b); // == a * b, whenever a * b fits
saturating_mul(a, b); // == BOOST_INT128_UINT128_MAX, otherwise
Demo: https://godbolt.org/z/Y6TW9458e
constexpr auto value = boost::int128::uint128_t{1} << 127;
static_assert(BOOST_INT128_UINT128_MAX == boost::int128::saturating_mul(value, boost::int128::uint128_t{1}));
// expected: BOOST_INT128_UINT128_MAX == value