drop redundant copies from quaternion.rs
This commit is contained in:
parent
7290d42c04
commit
f21232a123
1 changed files with 0 additions and 86 deletions
|
@ -260,15 +260,6 @@ impl<S: NumCast + Copy> Quaternion<S> {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "simd"))]
|
||||
impl<S: BaseFloat> InnerSpace for Quaternion<S> {
|
||||
#[inline]
|
||||
fn dot(self, other: Quaternion<S>) -> S {
|
||||
self.s * other.s + self.v.dot(other.v)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "simd")]
|
||||
impl<S: BaseFloat> InnerSpace for Quaternion<S> {
|
||||
#[inline]
|
||||
default_fn!( dot(self, other: Quaternion<S>) -> S {
|
||||
|
@ -311,14 +302,6 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "simd"))]
|
||||
impl_operator!(<S: BaseFloat> Neg for Quaternion<S> {
|
||||
fn neg(quat) -> Quaternion<S> {
|
||||
Quaternion::from_sv(-quat.s, -quat.v)
|
||||
}
|
||||
});
|
||||
|
||||
#[cfg(feature = "simd")]
|
||||
impl_operator!(<S: BaseFloat> Neg for Quaternion<S> {
|
||||
fn neg(quat) -> Quaternion<S> {
|
||||
Quaternion::from_sv(-quat.s, -quat.v)
|
||||
|
@ -334,14 +317,6 @@ impl_operator_simd!{
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "simd"))]
|
||||
impl_operator!(<S: BaseFloat> Mul<S> for Quaternion<S> {
|
||||
fn mul(lhs, rhs) -> Quaternion<S> {
|
||||
Quaternion::from_sv(lhs.s * rhs, lhs.v * rhs)
|
||||
}
|
||||
});
|
||||
|
||||
#[cfg(feature = "simd")]
|
||||
impl_operator!(<S: BaseFloat> Mul<S> for Quaternion<S> {
|
||||
fn mul(lhs, rhs) -> Quaternion<S> {
|
||||
Quaternion::from_sv(lhs.s * rhs, lhs.v * rhs)
|
||||
|
@ -357,12 +332,6 @@ impl_operator_simd!{@rs
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "simd"))]
|
||||
impl_assignment_operator!(<S: BaseFloat> MulAssign<S> for Quaternion<S> {
|
||||
fn mul_assign(&mut self, scalar) { self.s *= scalar; self.v *= scalar; }
|
||||
});
|
||||
|
||||
#[cfg(feature = "simd")]
|
||||
impl_assignment_operator!(<S: BaseFloat> MulAssign<S> for Quaternion<S> {
|
||||
fn mul_assign(&mut self, scalar) { self.s *= scalar; self.v *= scalar; }
|
||||
});
|
||||
|
@ -376,14 +345,6 @@ impl MulAssign<f32> for Quaternion<f32> {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "simd"))]
|
||||
impl_operator!(<S: BaseFloat> Div<S> for Quaternion<S> {
|
||||
fn div(lhs, rhs) -> Quaternion<S> {
|
||||
Quaternion::from_sv(lhs.s / rhs, lhs.v / rhs)
|
||||
}
|
||||
});
|
||||
|
||||
#[cfg(feature = "simd")]
|
||||
impl_operator!(<S: BaseFloat> Div<S> for Quaternion<S> {
|
||||
fn div(lhs, rhs) -> Quaternion<S> {
|
||||
Quaternion::from_sv(lhs.s / rhs, lhs.v / rhs)
|
||||
|
@ -399,12 +360,6 @@ impl_operator_simd!{@rs
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "simd"))]
|
||||
impl_assignment_operator!(<S: BaseFloat> DivAssign<S> for Quaternion<S> {
|
||||
fn div_assign(&mut self, scalar) { self.s /= scalar; self.v /= scalar; }
|
||||
});
|
||||
|
||||
#[cfg(feature = "simd")]
|
||||
impl_assignment_operator!(<S: BaseFloat> DivAssign<S> for Quaternion<S> {
|
||||
fn div_assign(&mut self, scalar) { self.s /= scalar; self.v /= scalar; }
|
||||
});
|
||||
|
@ -437,14 +392,6 @@ impl_operator!(<S: BaseFloat> Mul<Vector3<S> > for Quaternion<S> {
|
|||
}}
|
||||
});
|
||||
|
||||
#[cfg(not(feature = "simd"))]
|
||||
impl_operator!(<S: BaseFloat> Add<Quaternion<S> > for Quaternion<S> {
|
||||
fn add(lhs, rhs) -> Quaternion<S> {
|
||||
Quaternion::from_sv(lhs.s + rhs.s, lhs.v + rhs.v)
|
||||
}
|
||||
});
|
||||
|
||||
#[cfg(feature = "simd")]
|
||||
impl_operator!(<S: BaseFloat> Add<Quaternion<S> > for Quaternion<S> {
|
||||
fn add(lhs, rhs) -> Quaternion<S> {
|
||||
Quaternion::from_sv(lhs.s + rhs.s, lhs.v + rhs.v)
|
||||
|
@ -460,12 +407,6 @@ impl_operator_simd!{
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "simd"))]
|
||||
impl_assignment_operator!(<S: BaseFloat> AddAssign<Quaternion<S> > for Quaternion<S> {
|
||||
fn add_assign(&mut self, other) { self.s += other.s; self.v += other.v; }
|
||||
});
|
||||
|
||||
#[cfg(feature = "simd")]
|
||||
impl_assignment_operator!(<S: BaseFloat> AddAssign<Quaternion<S> > for Quaternion<S> {
|
||||
fn add_assign(&mut self, other) { self.s += other.s; self.v += other.v; }
|
||||
});
|
||||
|
@ -480,14 +421,6 @@ impl AddAssign for Quaternion<f32> {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "simd"))]
|
||||
impl_operator!(<S: BaseFloat> Sub<Quaternion<S> > for Quaternion<S> {
|
||||
fn sub(lhs, rhs) -> Quaternion<S> {
|
||||
Quaternion::from_sv(lhs.s - rhs.s, lhs.v - rhs.v)
|
||||
}
|
||||
});
|
||||
|
||||
#[cfg(feature = "simd")]
|
||||
impl_operator!(<S: BaseFloat> Sub<Quaternion<S> > for Quaternion<S> {
|
||||
fn sub(lhs, rhs) -> Quaternion<S> {
|
||||
Quaternion::from_sv(lhs.s - rhs.s, lhs.v - rhs.v)
|
||||
|
@ -503,12 +436,6 @@ impl_operator_simd!{
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "simd"))]
|
||||
impl_assignment_operator!(<S: BaseFloat> SubAssign<Quaternion<S> > for Quaternion<S> {
|
||||
fn sub_assign(&mut self, other) { self.s -= other.s; self.v -= other.v; }
|
||||
});
|
||||
|
||||
#[cfg(feature = "simd")]
|
||||
impl_assignment_operator!(<S: BaseFloat> SubAssign<Quaternion<S> > for Quaternion<S> {
|
||||
fn sub_assign(&mut self, other) { self.s -= other.s; self.v -= other.v; }
|
||||
});
|
||||
|
@ -523,19 +450,6 @@ impl SubAssign for Quaternion<f32> {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "simd"))]
|
||||
impl_operator!(<S: BaseFloat> Mul<Quaternion<S> > for Quaternion<S> {
|
||||
fn mul(lhs, rhs) -> Quaternion<S> {
|
||||
Quaternion::new(
|
||||
lhs.s * rhs.s - lhs.v.x * rhs.v.x - lhs.v.y * rhs.v.y - lhs.v.z * rhs.v.z,
|
||||
lhs.s * rhs.v.x + lhs.v.x * rhs.s + lhs.v.y * rhs.v.z - lhs.v.z * rhs.v.y,
|
||||
lhs.s * rhs.v.y + lhs.v.y * rhs.s + lhs.v.z * rhs.v.x - lhs.v.x * rhs.v.z,
|
||||
lhs.s * rhs.v.z + lhs.v.z * rhs.s + lhs.v.x * rhs.v.y - lhs.v.y * rhs.v.x,
|
||||
)
|
||||
}
|
||||
});
|
||||
|
||||
#[cfg(feature = "simd")]
|
||||
impl_operator!(<S: BaseFloat> Mul<Quaternion<S> > for Quaternion<S> {
|
||||
fn mul(lhs, rhs) -> Quaternion<S> {
|
||||
Quaternion::new(
|
||||
|
|
Loading…
Reference in a new issue