replace wrap function with rem_euclid

This commit is contained in:
Simon Gardling 2025-03-28 10:15:36 -04:00
parent 4330101b68
commit ff769df97b
Signed by: titaniumtown
GPG Key ID: 9AB28AC10ECE533D

View File

@ -1,6 +1,7 @@
#[inline]
pub fn wrap(x: f32, max: f32) -> f32 {
x - max * ((x > max) as i32 - x.is_sign_negative() as i32) as f32
// x - max * ((x > max) as i32 - x.is_sign_negative() as i32) as f32
x.rem_euclid(max)
}
/// Truncate x and y and return a corresponding index into the data slice.