Update index impls.

This commit is contained in:
Luqman Aden 2013-03-28 17:33:39 -07:00
parent fbb484408b
commit a467bf7032
7 changed files with 14 additions and 14 deletions

View file

@ -381,10 +381,10 @@ impl<T:Copy + Float + FuzzyEq<T> + Add<T,T> + Sub<T,T> + Mul<T,T> + Div<T,T> + N
impl<T:Copy> Index<uint, Vec2<T>> for Mat2<T> {
#[inline(always)]
fn index(&self, i: &uint) -> Vec2<T> {
fn index(&self, i: uint) -> Vec2<T> {
unsafe { do buf_as_slice(
transmute::<*Mat2<T>, *Vec2<T>>(
to_unsafe_ptr(self)), 2) |slice| { slice[*i] }
to_unsafe_ptr(self)), 2) |slice| { slice[i] }
}
}
}

View file

@ -558,10 +558,10 @@ impl<T:Copy + Float + FuzzyEq<T> + Add<T,T> + Sub<T,T> + Mul<T,T> + Div<T,T> + N
impl<T:Copy> Index<uint, Vec3<T>> for Mat3<T> {
#[inline(always)]
fn index(&self, i: &uint) -> Vec3<T> {
fn index(&self, i: uint) -> Vec3<T> {
unsafe { do buf_as_slice(
transmute::<*Mat3<T>, *Vec3<T>>(
to_unsafe_ptr(self)), 3) |slice| { slice[*i] }
to_unsafe_ptr(self)), 3) |slice| { slice[i] }
}
}
}

View file

@ -501,10 +501,10 @@ impl<T:Copy + Float + FuzzyEq<T> + Add<T,T> + Sub<T,T> + Mul<T,T> + Div<T,T> + N
impl<T:Copy> Index<uint, Vec4<T>> for Mat4<T> {
#[inline(always)]
fn index(&self, i: &uint) -> Vec4<T> {
fn index(&self, i: uint) -> Vec4<T> {
unsafe { do buf_as_slice(
transmute::<*Mat4<T>, *Vec4<T>>(
to_unsafe_ptr(self)), 4) |slice| { slice[*i] }
to_unsafe_ptr(self)), 4) |slice| { slice[i] }
}
}
}

View file

@ -391,10 +391,10 @@ pub impl<T:Copy + Float + FuzzyEq<T> + Add<T,T> + Sub<T,T> + Mul<T,T> + Div<T,T>
impl<T:Copy> Index<uint, T> for Quat<T> {
#[inline(always)]
fn index(&self, i: &uint) -> T {
fn index(&self, i: uint) -> T {
unsafe { do buf_as_slice(
transmute::<*Quat<T>, *T>(
to_unsafe_ptr(self)), 4) |slice| { slice[*i] }
to_unsafe_ptr(self)), 4) |slice| { slice[i] }
}
}
}

View file

@ -68,8 +68,8 @@ impl<T> Vector2<T> for Vec2<T> {
impl<T:Copy + Eq> Index<uint, T> for Vec2<T> {
#[inline(always)]
fn index(&self, i: &uint) -> T {
unsafe { do buf_as_slice(self.to_ptr(), 2) |slice| { slice[*i] } }
fn index(&self, i: uint) -> T {
unsafe { do buf_as_slice(self.to_ptr(), 2) |slice| { slice[i] } }
}
}

View file

@ -70,8 +70,8 @@ impl<T> Vector3<T> for Vec3<T> {
impl<T:Copy + Eq> Index<uint, T> for Vec3<T> {
#[inline(always)]
fn index(&self, i: &uint) -> T {
unsafe { do buf_as_slice(self.to_ptr(), 3) |slice| { slice[*i] } }
fn index(&self, i: uint) -> T {
unsafe { do buf_as_slice(self.to_ptr(), 3) |slice| { slice[i] } }
}
}

View file

@ -68,8 +68,8 @@ impl<T> Vector4<T> for Vec4<T> {
impl<T:Copy + Eq> Index<uint, T> for Vec4<T> {
#[inline(always)]
fn index(&self, i: &uint) -> T {
unsafe { do buf_as_slice(self.to_ptr(), 4) |slice| { slice[*i] } }
fn index(&self, i: uint) -> T {
unsafe { do buf_as_slice(self.to_ptr(), 4) |slice| { slice[i] } }
}
}