Skip to main content
← PSoXide SDK guides and examples · SDK f2fec1c301f1 · All Cargo features enabled; check feature gates before use.

mul_shr_i32

Function mul_shr_i32 

Source
pub fn mul_shr_i32(a: i32, b: i32, shift: u32) -> i32
Expand description

(a * b) >> shift through the full 64-bit product: rounds toward negative infinity like an arithmetic shift, and wraps to the low 32 bits where the shifted value does not fit i32.

Identical to ((i64::from(a) * i64::from(b)) >> shift) as i32, which is one mult and a two-word shift on MIPS; this names it so games stop spelling out the i64 cast. The Q12 case is mul_q12_i32_wide. Requires shift < 32.