diff options
Diffstat (limited to 'src/f32/wasm32/vec3a.rs')
-rw-r--r-- | src/f32/wasm32/vec3a.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/f32/wasm32/vec3a.rs b/src/f32/wasm32/vec3a.rs index 85b3fe4..33df7cf 100644 --- a/src/f32/wasm32/vec3a.rs +++ b/src/f32/wasm32/vec3a.rs @@ -300,6 +300,18 @@ impl Vec3A { } } + /// 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 3 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 |