Home / list of functions / fwnbi::fullmul
template <size_t B, class D, bool S>
constexpr basic_integer<B * 2, D, S> fullmul(
    const basic_integer<B, D, S>& lhs,
    const basic_integer<B, D, S>& rhs
) noexcept;
constexpr since C++14

Calculates result of product two integers and not truncates it.

Example
#include "fwnbi.hpp"
#include <iostream>
#include <iomanip>

int main() {
    const auto max = fwnbi::uint128_t::max();

    std::cout << std::hex;
    std::cout << std::setw(64) <<                      max << '\n';
    std::cout << std::setw(64) <<                max * max << '\n';
    std::cout << std::setw(64) << fwnbi::fullmul(max, max) << '\n';
}
Output
                                ffffffffffffffffffffffffffffffff
                                                               1
fffffffffffffffffffffffffffffffe00000000000000000000000000000001