From ff769df97b47fa85305ee0bb5e852becb794768f Mon Sep 17 00:00:00 2001 From: Simon Gardling Date: Fri, 28 Mar 2025 10:15:36 -0400 Subject: [PATCH] replace wrap function with rem_euclid --- src/util.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/util.rs b/src/util.rs index d56f137..1bd3359 100644 --- a/src/util.rs +++ b/src/util.rs @@ -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.