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

mul_q12_i32

Function mul_q12_i32 

Source
pub fn mul_q12_i32(value: i32, q12: i32) -> i32
Expand description

Multiply an i32 by a Q1.12 factor (4096 = 1.0) without a 64-bit intermediate.

The value splits into whole sectors (value >> 12) and the Q0.12 fraction (value & 0xFFF); each part multiplies the factor separately and the partial products saturate, so the result stays exact wherever the true product fits in i32 and saturates instead of wrapping where it does not.