Skip to content

Commit

Permalink
Merge 9300c95 into 31d7bb5
Browse files Browse the repository at this point in the history
  • Loading branch information
cessen committed Jul 23, 2019
2 parents 31d7bb5 + 9300c95 commit 94bc97f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
8 changes: 4 additions & 4 deletions src/f32/vec4_f32.rs
Expand Up @@ -122,25 +122,25 @@ impl Vec4 {

/// Returns a `Vec4` with all elements set to the value of element `x`.
#[inline]
pub(crate) fn dup_x(self) -> Self {
pub fn dup_x(self) -> Self {
Self(self.0, self.0, self.0, self.0)
}

/// Returns a `Vec4` with all elements set to the value of element `y`.
#[inline]
pub(crate) fn dup_y(self) -> Self {
pub fn dup_y(self) -> Self {
Self(self.1, self.1, self.1, self.1)
}

/// Returns a `Vec4` with all elements set to the value of element `z`.
#[inline]
pub(crate) fn dup_z(self) -> Self {
pub fn dup_z(self) -> Self {
Self(self.2, self.2, self.2, self.2)
}

/// Returns a `Vec4` with all elements set to the value of element `w`.
#[inline]
pub(crate) fn dup_w(self) -> Self {
pub fn dup_w(self) -> Self {
Self(self.3, self.3, self.3, self.3)
}

Expand Down
8 changes: 4 additions & 4 deletions src/f32/vec4_sse2.rs
Expand Up @@ -175,25 +175,25 @@ impl Vec4 {

/// Returns a `Vec4` with all elements set to the value of element `x`.
#[inline]
pub(crate) fn dup_x(self) -> Self {
pub fn dup_x(self) -> Self {
unsafe { Self(_mm_shuffle_ps(self.0, self.0, 0b00_00_00_00)) }
}

/// Returns a `Vec4` with all elements set to the value of element `y`.
#[inline]
pub(crate) fn dup_y(self) -> Self {
pub fn dup_y(self) -> Self {
unsafe { Self(_mm_shuffle_ps(self.0, self.0, 0b01_01_01_01)) }
}

/// Returns a `Vec4` with all elements set to the value of element `z`.
#[inline]
pub(crate) fn dup_z(self) -> Self {
pub fn dup_z(self) -> Self {
unsafe { Self(_mm_shuffle_ps(self.0, self.0, 0b10_10_10_10)) }
}

/// Returns a `Vec4` with all elements set to the value of element `w`.
#[inline]
pub(crate) fn dup_w(self) -> Self {
pub fn dup_w(self) -> Self {
unsafe { Self(_mm_shuffle_ps(self.0, self.0, 0b11_11_11_11)) }
}

Expand Down
16 changes: 8 additions & 8 deletions tests/vec4.rs
Expand Up @@ -248,14 +248,14 @@ fn test_vec4_sign() {
assert_eq!((-Vec4::one()).sign(), -Vec4::one());
}

// #[test]
// fn dup_element() {
// let a = vec4(1.0, 2.0, 3.0, 4.0);
// assert_eq!(vec4(1.0, 1.0, 1.0, 1.0), a.dup_x());
// assert_eq!(vec4(2.0, 2.0, 2.0, 2.0), a.dup_y());
// assert_eq!(vec4(3.0, 3.0, 3.0, 3.0), a.dup_z());
// assert_eq!(vec4(4.0, 4.0, 4.0, 4.0), a.dup_w());
// }
#[test]
fn dup_element() {
let a = vec4(1.0, 2.0, 3.0, 4.0);
assert_eq!(vec4(1.0, 1.0, 1.0, 1.0), a.dup_x());
assert_eq!(vec4(2.0, 2.0, 2.0, 2.0), a.dup_y());
assert_eq!(vec4(3.0, 3.0, 3.0, 3.0), a.dup_z());
assert_eq!(vec4(4.0, 4.0, 4.0, 4.0), a.dup_w());
}

#[test]
fn test_vec4mask_bitmask() {
Expand Down

0 comments on commit 94bc97f

Please sign in to comment.