pub fn quantize_multiplier(ratio: f64) -> (i32, i32)Expand description
Decompose a positive real scale ratio into a Q0.31 multiplier and a shift
(C++ quantizeMultiplier). Returns (multiplier, shift): shift < 0 for a
ratio above 1, shift > 0 below 1. A zero ratio gives (0, 0).
The shift always lies in -31..=31, the Requantizer’s contract. A ratio
below 2^-32 rounds every i32 accumulator to 0 and comes back as (0, 0);
a ratio of 2^31 or more gets shift -31, which already saturates every
non-zero accumulator.