diff options
Diffstat (limited to 'src/f32/wasm32/vec4.rs')
-rw-r--r-- | src/f32/wasm32/vec4.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/f32/wasm32/vec4.rs b/src/f32/wasm32/vec4.rs index ab53d7a..10f3927 100644 --- a/src/f32/wasm32/vec4.rs +++ b/src/f32/wasm32/vec4.rs @@ -282,6 +282,18 @@ impl Vec4 { } } + /// Returns a vector with signs of `rhs` and the magnitudes of `self`. + #[inline] + pub fn copysign(self, rhs: Self) -> Self { + unsafe { + let mask = Self::splat(-0.0); + Self(v128_or( + v128_and(rhs.0, mask.0), + v128_andnot(self.0, mask.0), + )) + } + } + /// Returns a bitmask with the lowest 4 bits set to the sign bits from the elements of `self`. /// /// A negative element results in a `1` bit and a positive element in a `0` bit. Element `x` goes |