Function lexical_util::div128::u128_divrem
source ยท pub fn u128_divrem(n: u128, radix: u32) -> (u128, u64)
Expand description
Calculate the div/remainder of a value based on the radix.
This uses the largest divisor possible for the given size, and uses various fast-path approximations for different types.
- Powers-of-two can be cleanly split into 2 64-bit products.
- Division that can be simulated as if by multiplication by a constant.
- Cases of 2. with a power-of-two divisor.
- Fallback cases.
This returns the quotient and the remainder.
For the number of digits processed, see
min_step
.