kdtree_simd/simd_euclidean/
f64x2.rs1use std::ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Sub, SubAssign};
2
3define_ty!(F64x2, f64, f64);
4impl_minimal!(F64x2, f64, 2, x0, x1);
5
6impl F64x2 {
7 pub fn from_slice(slice: &[f64]) -> F64x2 {
8 assert!(slice.len() >= Self::lanes());
9 unsafe { F64x2(*slice.get_unchecked(0), *slice.get_unchecked(1)) }
10 }
11
12 pub fn horizontal_add(self) -> f64 {
13 self.0 + self.1
14 }
15}
16
17impl_op2!(Mul, mul, F64x2, *);
18impl_op2!(assn MulAssign, mul_assign, F64x2, *=);
19impl_op2!(Div, div, F64x2, /);
20impl_op2!(assn DivAssign, div_assign, F64x2, /=);
21impl_op2!(Add, add, F64x2, +);
22impl_op2!(assn AddAssign, add_assign, F64x2, +=);
23impl_op2!(Sub, sub, F64x2, -);
24impl_op2!(assn SubAssign, sub_assign, F64x2, -=);
25
26impl_euclidean!(F64x2, f64);