We already have P3605 for isqrt and P3724 for integer division, but there are many more integer utilities that could be provided, such as:
std::ipow(base, exp) for integer expontentiation
std::ilog(base, x) for integer logarithms
- much faster versions of the above that accept a constant base
std::uabs (added to C2y, could be ported over pre-emptively or during C2y rebase in a few years)
std::max_mag and std::min_mag for picking the value with greater or lower magnitude
- modular exponentionation, modular logarithm, and other modular arithmetic utilities
- wrapping signed arithmetic operations without UB, like
std::add_wrap(x, y)
We already have P3605 for
isqrtand P3724 for integer division, but there are many more integer utilities that could be provided, such as:std::ipow(base, exp)for integer expontentiationstd::ilog(base, x)for integer logarithmsstd::uabs(added to C2y, could be ported over pre-emptively or during C2y rebase in a few years)std::max_magandstd::min_magfor picking the value with greater or lower magnitudestd::add_wrap(x, y)