Skip to main content

multiplier

Function multiplier 

Source
pub fn multiplier(divisor: u128, bits: u32, precision: u32) -> (u128, u32)
Expand description

The magic number for dividing by divisor a value of bits bits whose top bits - precision bits are known to be clear, and the shift that goes after the multiply.

choose_multiplier at gcc/expmed.cc:3728. The quotient is the product shifted right by bits and then by the shift. The number is the smallest that is still exact over the whole range, which is found by starting from the largest shift that can work and halving both bounds for as long as they stay apart.

ยงPanics

Panics if the divisor is zero or the working does not fit, which is a width over sixty four.