We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 311a631 commit e61b2cbCopy full SHA for e61b2cb
cidre/src/simd.rs
@@ -334,6 +334,11 @@ impl Default for f32x4 {
334
335
#[cfg(target_arch = "aarch64")]
336
impl f32x4 {
337
+ #[inline]
338
+ pub fn xyz(&self) -> f32x3 {
339
+ f32x3(unsafe { std::arch::aarch64::vsetq_lane_f32::<3>(0.0, self.0) })
340
+ }
341
+
342
pub fn x(&self) -> f32 {
343
unsafe { std::arch::aarch64::vgetq_lane_f32::<0>(self.0) }
344
}
@@ -1879,6 +1884,12 @@ mod tests {
1879
1884
assert_eq!(a.dot(&b), 70.0);
1880
1885
1881
1886
1887
+ #[test]
1888
+ fn f32x4_xyz() {
1889
+ let v = f32x4::with_xyzw(1.0, 2.0, 3.0, 4.0);
1890
+ assert_eq!(v.xyz(), f32x3::with_xyz(1.0, 2.0, 3.0));
1891
1892
1882
1893
#[test]
1883
1894
fn f32x4_len_sq() {
1895
let a = f32x4::with_xyzw(1.0, 2.0, 3.0, 4.0);
0 commit comments