[][src]Function specialized_div_rem::i32_div_rem_trifecta

pub fn i32_div_rem_trifecta(duo: i32, div: i32) -> (i32, i32)

Computes the quotient and remainder of duo divided by div and returns them as a tuple.

This is optimized for division of two integers with bit widths twice as large as the largest hardware integer division supported. Note that some architectures supply a division of an integer larger than register size by a regular sized integer (e.x. x86_64 has a divq instruction which can divide a 128 bit integer by a 64 bit integer). In that case, the _asymmetric algorithm should be used instead of this one.

This is called the trifecta algorithm because it uses three main algorithms: short division for small divisors, the "mul or mul - 1" algorithm for when the divisor is large enough for the quotient to be determined to be one of two values via only one small division, and an underguessing long division algorithm for middle cases.

Panics

When attempting to divide by zero, this function will panic.