pub fn quantize_unorm(v: f32, n: i32) -> i32
Expand description

Quantize a float in [0..1] range into an N-bit fixed point unorm value.

Assumes reconstruction function (q / (2^N-1)), which is the case for fixed-function normalized fixed point conversion.

Maximum reconstruction error: 1/2^(N+1).