diff --git a/.travis.yml b/.travis.yml index 030d05f3..612f820a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,7 @@ language: rust +rust: + - nightly + - stable addons: apt: packages: @@ -7,6 +10,12 @@ addons: - libsdl2-dev - cmake script: + - rustup target add aarch64-unknown-linux-gnu + - cd simd + - cargo build --target aarch64-unknown-linux-gnu + - cd ../geometry + - cargo build --target aarch64-unknown-linux-gnu + - cd .. - cargo build - cargo test env: diff --git a/geometry/src/vector.rs b/geometry/src/vector.rs index a2031e25..6bd754c2 100644 --- a/geometry/src/vector.rs +++ b/geometry/src/vector.rs @@ -246,6 +246,14 @@ impl Div for Vector2F { } } +impl Div for Vector2F { + type Output = Vector2F; + #[inline] + fn div(self, other: f32) -> Vector2F { + self / Vector2F::splat(other) + } +} + impl Neg for Vector2F { type Output = Vector2F; #[inline] diff --git a/simd/src/arm/mod.rs b/simd/src/arm/mod.rs index 28699d57..3fa5c7da 100644 --- a/simd/src/arm/mod.rs +++ b/simd/src/arm/mod.rs @@ -13,7 +13,7 @@ use std::arch::aarch64::{uint32x2_t, uint32x4_t}; use std::f32; use std::fmt::{self, Debug, Formatter}; use std::mem; -use std::ops::{Add, BitAnd, BitOr, Index, IndexMut, Mul, Shr, Sub}; +use std::ops::{Add, BitAnd, BitOr, Div, Index, IndexMut, Mul, Shr, Sub}; mod swizzle_f32x4; mod swizzle_i32x4; @@ -332,7 +332,7 @@ impl F32x4 { /// Converts these packed floats to integers via rounding. #[inline] pub fn to_i32x4(self) -> I32x4 { - unsafe { I32x4(round_v4f32(simd_cast(self.0))) } + unsafe { I32x4(simd_cast(round_v4f32(self.0))) } } } @@ -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 { @@ -542,12 +559,12 @@ impl I32x4 { #[inline] pub fn max(self, other: I32x4) -> I32x4 { - unsafe { I32x4(simd_fmax(self.0, other.0)) } + unsafe { I32x4(simd_cast(simd_fmax(self.to_f32x4().0, other.to_f32x4().0))) } } #[inline] pub fn min(self, other: I32x4) -> I32x4 { - unsafe { I32x4(simd_fmin(self.0, other.0)) } + unsafe { I32x4(simd_cast(simd_fmin(self.to_f32x4().0, other.to_f32x4().0))) } } // Packed comparisons