aboutsummaryrefslogtreecommitdiff
path: root/src/i32/ivec2.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/i32/ivec2.rs')
-rw-r--r--src/i32/ivec2.rs12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/i32/ivec2.rs b/src/i32/ivec2.rs
index 87b5122..0a78305 100644
--- a/src/i32/ivec2.rs
+++ b/src/i32/ivec2.rs
@@ -247,9 +247,9 @@ impl IVec2 {
/// Returns a vector with elements representing the sign of `self`.
///
- /// - `1.0` if the number is positive, `+0.0` or `INFINITY`
- /// - `-1.0` if the number is negative, `-0.0` or `NEG_INFINITY`
- /// - `NAN` if the number is `NAN`
+ /// - `0` if the number is zero
+ /// - `1` if the number is positive
+ /// - `-1` if the number is negative
#[inline]
pub fn signum(self) -> Self {
Self {
@@ -258,6 +258,12 @@ impl IVec2 {
}
}
+ /// Returns a vector with signs of `rhs` and the magnitudes of `self`.
+ #[inline]
+ pub fn copysign(self, rhs: Self) -> Self {
+ Self::select(rhs.cmpge(Self::ZERO), self, -self)
+ }
+
/// Returns a bitmask with the lowest 2 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