Function idsp::saturating_scale
source ยท pub fn saturating_scale(lo: i32, hi: i32, shift: u32) -> i32
Expand description
Combine high and low i32 into a single downscaled i32, saturating monotonically.
Args:
lo
: LSB i32 to scale down by shift
and range-extend with hi
hi
: MSB i32 to scale up and extend lo
with. Output will be clipped if
hi
exceeds the output i32 range.
shift
: Downscale lo
by that many bits. Values from 1 to 32 inclusive
are valid.