Commit 57c22524 authored by Aske Simon Christensen's avatar Aske Simon Christensen
Browse files

Allow overflowing rounding in quantization

parent 9a1030e6
......@@ -86,7 +86,7 @@ fn quantize(value: f32, level: f32) -> f32 {
let mask = !bit + 1;
let add = bit >> 1;
let mut bits = unsafe { transmute::<f32, u32>(value) };
bits = (bits + add) & mask;
bits = bits.wrapping_add(add) & mask;
if bits == 0x80000000 {
bits = 0x00000000;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment