Skip to main content

wrap_simd

Function wrap_simd 

Source
pub fn wrap_simd<F, const N: usize>(x: Simd<F, N>) -> Simd<F, N>
where F: SimdElement + SimdCast, Simd<F, N>: Div<Output = Simd<F, N>> + Add<Output = Simd<F, N>> + Mul<Output = Simd<F, N>> + Sub<Output = Simd<F, N>> + SimdPartialOrd<Mask = Mask<<F as SimdElement>::Mask, N>> + StdFloat,
Expand description

Wrap N coordinates to prevent precision loss (N-lane SIMD version of wrap).

Fast path: at normal game coordinates all lanes are within [-HALF_ROUND_OFF, HALF_ROUND_OFF), so the expensive div + floor + mul is skipped almost always.