From e87b330123de68f19198a6d1647e567456766290 Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Tue, 7 Apr 2020 12:42:28 -0400 Subject: [PATCH] Add min/max to i32x2. --- simd/src/arm/mod.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/simd/src/arm/mod.rs b/simd/src/arm/mod.rs index 8a111ccf..f9db6674 100644 --- a/simd/src/arm/mod.rs +++ b/simd/src/arm/mod.rs @@ -445,6 +445,18 @@ impl I32x2 { unsafe { U32x2(simd_eq(self.0, other.0)) } } + // Basic operations + + #[inline] + pub fn max(self, other: I32x2) -> I32x2 { + self.to_i32x4().max(other.to_i32x4()).xy() + } + + #[inline] + pub fn min(self, other: I32x2) -> I32x2 { + self.to_i32x4().min(other.to_i32x4()).xy() + } + // Concatenations #[inline] @@ -459,6 +471,11 @@ impl I32x2 { pub fn to_f32x2(self) -> F32x2 { unsafe { F32x2(simd_cast(self.0)) } } + + #[inline] + pub fn to_i32x4(self) -> I32x4 { + self.concat_xy_xy(I32x2::default()) + } } impl Default for I32x2 {