pub fn mul_shr_trunc_i32(a: i32, b: i32, shift: u32) -> i32Expand description
a * b / 2^shift, truncated toward zero, through the full 64-bit product.
Identical to (i64::from(a) * i64::from(b) / (1i64 << shift)) as i32
(and, for shift < 31, to mul_div_i32(a, b, 1 << shift)) for every input
(wrapping the same way where the quotient does not fit i32), but costs
one mult, a bias add and a two-word shift instead of a divide: a
negative product is biased by 2^shift - 1 before the arithmetic shift.
This is the Q-format multiply of code that truncates (Hollow Knight’s
Q16 mulq). Requires shift < 32.