Remove usages of the <-> operator

This commit is contained in:
Brendan Zabarauskas 2013-05-22 15:44:54 +10:00
parent ebf6a9529d
commit 0c1af624a7
2 changed files with 28 additions and 26 deletions

View file

@ -1,6 +1,7 @@
use core::cmp::ApproxEq; use core::cmp::ApproxEq;
use core::num::Zero::zero; use core::num::Zero::zero;
use core::num::One::one; use core::num::One::one;
use core::util;
use vec::*; use vec::*;
use quat::Quat; use quat::Quat;
@ -449,7 +450,7 @@ impl<T:Copy + Float + NumAssign> BaseMat<T, Vec2<T>> for Mat2<T> {
#[inline(always)] #[inline(always)]
fn swap_cols(&mut self, a: uint, b: uint) { fn swap_cols(&mut self, a: uint, b: uint) {
*self.col_mut(a) <-> *self.col_mut(b); util::swap(self.col_mut(a), self.col_mut(b));
} }
#[inline(always)] #[inline(always)]
@ -501,8 +502,8 @@ impl<T:Copy + Float + NumAssign> BaseMat<T, Vec2<T>> for Mat2<T> {
#[inline(always)] #[inline(always)]
fn transpose_self(&mut self) { fn transpose_self(&mut self) {
*self.x.index_mut(1) <-> *self.y.index_mut(0); util::swap(self.x.index_mut(1), self.y.index_mut(0));
*self.y.index_mut(0) <-> *self.x.index_mut(1); util::swap(self.y.index_mut(0), self.x.index_mut(1));
} }
#[inline(always)] #[inline(always)]
@ -849,7 +850,7 @@ impl<T:Copy + Float + NumAssign> BaseMat<T, Vec3<T>> for Mat3<T> {
#[inline(always)] #[inline(always)]
fn swap_cols(&mut self, a: uint, b: uint) { fn swap_cols(&mut self, a: uint, b: uint) {
*self.col_mut(a) <-> *self.col_mut(b); util::swap(self.col_mut(a), self.col_mut(b));
} }
#[inline(always)] #[inline(always)]
@ -905,14 +906,14 @@ impl<T:Copy + Float + NumAssign> BaseMat<T, Vec3<T>> for Mat3<T> {
#[inline(always)] #[inline(always)]
fn transpose_self(&mut self) { fn transpose_self(&mut self) {
*self.col_mut(0).index_mut(1) <-> *self.col_mut(1).index_mut(0); util::swap(self.col_mut(0).index_mut(1), self.col_mut(1).index_mut(0));
*self.col_mut(0).index_mut(2) <-> *self.col_mut(2).index_mut(0); util::swap(self.col_mut(0).index_mut(2), self.col_mut(2).index_mut(0));
*self.col_mut(1).index_mut(0) <-> *self.col_mut(0).index_mut(1); util::swap(self.col_mut(1).index_mut(0), self.col_mut(0).index_mut(1));
*self.col_mut(1).index_mut(2) <-> *self.col_mut(2).index_mut(1); util::swap(self.col_mut(1).index_mut(2), self.col_mut(2).index_mut(1));
*self.col_mut(2).index_mut(0) <-> *self.col_mut(0).index_mut(2); util::swap(self.col_mut(2).index_mut(0), self.col_mut(0).index_mut(2));
*self.col_mut(2).index_mut(1) <-> *self.col_mut(1).index_mut(2); util::swap(self.col_mut(2).index_mut(1), self.col_mut(1).index_mut(2));
} }
#[inline(always)] #[inline(always)]
@ -1470,7 +1471,7 @@ impl<T:Copy + Float + NumAssign> BaseMat<T, Vec4<T>> for Mat4<T> {
#[inline(always)] #[inline(always)]
fn swap_cols(&mut self, a: uint, b: uint) { fn swap_cols(&mut self, a: uint, b: uint) {
*self.col_mut(a) <-> *self.col_mut(b); util::swap(self.col_mut(a), self.col_mut(b));
} }
#[inline(always)] #[inline(always)]
@ -1530,21 +1531,21 @@ impl<T:Copy + Float + NumAssign> BaseMat<T, Vec4<T>> for Mat4<T> {
#[inline(always)] #[inline(always)]
fn transpose_self(&mut self) { fn transpose_self(&mut self) {
*self.col_mut(0).index_mut(1) <-> *self.col_mut(1).index_mut(0); util::swap(self.col_mut(0).index_mut(1), self.col_mut(1).index_mut(0));
*self.col_mut(0).index_mut(2) <-> *self.col_mut(2).index_mut(0); util::swap(self.col_mut(0).index_mut(2), self.col_mut(2).index_mut(0));
*self.col_mut(0).index_mut(3) <-> *self.col_mut(3).index_mut(0); util::swap(self.col_mut(0).index_mut(3), self.col_mut(3).index_mut(0));
*self.col_mut(1).index_mut(0) <-> *self.col_mut(0).index_mut(1); util::swap(self.col_mut(1).index_mut(0), self.col_mut(0).index_mut(1));
*self.col_mut(1).index_mut(2) <-> *self.col_mut(2).index_mut(1); util::swap(self.col_mut(1).index_mut(2), self.col_mut(2).index_mut(1));
*self.col_mut(1).index_mut(3) <-> *self.col_mut(3).index_mut(1); util::swap(self.col_mut(1).index_mut(3), self.col_mut(3).index_mut(1));
*self.col_mut(2).index_mut(0) <-> *self.col_mut(0).index_mut(2); util::swap(self.col_mut(2).index_mut(0), self.col_mut(0).index_mut(2));
*self.col_mut(2).index_mut(1) <-> *self.col_mut(1).index_mut(2); util::swap(self.col_mut(2).index_mut(1), self.col_mut(1).index_mut(2));
*self.col_mut(2).index_mut(3) <-> *self.col_mut(3).index_mut(2); util::swap(self.col_mut(2).index_mut(3), self.col_mut(3).index_mut(2));
*self.col_mut(3).index_mut(0) <-> *self.col_mut(0).index_mut(3); util::swap(self.col_mut(3).index_mut(0), self.col_mut(0).index_mut(3));
*self.col_mut(3).index_mut(1) <-> *self.col_mut(1).index_mut(3); util::swap(self.col_mut(3).index_mut(1), self.col_mut(1).index_mut(3));
*self.col_mut(3).index_mut(2) <-> *self.col_mut(2).index_mut(3); util::swap(self.col_mut(3).index_mut(2), self.col_mut(2).index_mut(3));
} }
#[inline(always)] #[inline(always)]

View file

@ -1,6 +1,7 @@
use core::cmp::ApproxEq; use core::cmp::ApproxEq;
use core::num::Zero::zero; use core::num::Zero::zero;
use core::num::One::one; use core::num::One::one;
use core::util;
use num::NumAssign; use num::NumAssign;
@ -544,7 +545,7 @@ impl<T:Copy + Eq> BaseVec<T> for Vec2<T> {
#[inline(always)] #[inline(always)]
fn swap(&mut self, a: uint, b: uint) { fn swap(&mut self, a: uint, b: uint) {
*self.index_mut(a) <-> *self.index_mut(b); util::swap(self.index_mut(a), self.index_mut(b));
} }
} }
@ -851,7 +852,7 @@ impl<T:Copy + Eq> BaseVec<T> for Vec3<T> {
#[inline(always)] #[inline(always)]
fn swap(&mut self, a: uint, b: uint) { fn swap(&mut self, a: uint, b: uint) {
*self.index_mut(a) <-> *self.index_mut(b); util::swap(self.index_mut(a), self.index_mut(b));
} }
} }
@ -1176,7 +1177,7 @@ impl<T:Copy + Eq> BaseVec<T> for Vec4<T> {
#[inline(always)] #[inline(always)]
fn swap(&mut self, a: uint, b: uint) { fn swap(&mut self, a: uint, b: uint) {
*self.index_mut(a) <-> *self.index_mut(b); util::swap(self.index_mut(a), self.index_mut(b));
} }
} }