rapier2d_f64/utils/
simd_select.rs1use crate::math::SimdReal;
4use crate::math::{Real, Vector};
5use simba::simd::SimdValue;
6
7pub trait SimdSelect<N: SimdValue> {
9 fn select(self, condition: N::SimdBool, if_false: Self) -> Self;
11}
12
13impl SimdSelect<Real> for Vector {
14 #[inline]
15 fn select(self, condition: bool, if_false: Self) -> Self {
16 if condition { self } else { if_false }
17 }
18}
19
20#[cfg(not(target_arch = "spirv"))]
21impl SimdSelect<SimdReal> for na::Vector3<SimdReal> {
22 #[inline]
23 fn select(self, condition: <SimdReal as SimdValue>::SimdBool, if_false: Self) -> Self {
24 SimdValue::select(self, condition, if_false)
25 }
26}