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