fast float to integer conversions

In Rust, the standard way of converting floating point values to integers is with the as operator . This conversion has various guarantees as listed in the reference. One of them is that it saturates: Input values out of range of the output type convert to the minimal&#x2F;maximal value of the output type. assert_eq!(300f32 as u8, 255); assert_eq!(-5f32 as u8, 0); Saturation comes with a downside.…