diff --git a/src/mat2.rs b/src/mat2.rs index 1e4de51..a7f0d1d 100644 --- a/src/mat2.rs +++ b/src/mat2.rs @@ -380,10 +380,10 @@ impl + Add + Sub + Mul + Div + N impl Index> for Mat2 { #[inline(always)] - fn index(&self, i: uint) -> Vec2 { + fn index(&self, i: &uint) -> Vec2 { unsafe { do buf_as_slice( transmute::<*Mat2, *Vec2>( - to_unsafe_ptr(self)), 2) |slice| { slice[i] } + to_unsafe_ptr(self)), 2) |slice| { slice[*i] } } } } diff --git a/src/mat3.rs b/src/mat3.rs index 05b7ddf..ffa8939 100644 --- a/src/mat3.rs +++ b/src/mat3.rs @@ -556,10 +556,10 @@ impl + Add + Sub + Mul + Div + N impl Index> for Mat3 { #[inline(always)] - fn index(&self, i: uint) -> Vec3 { + fn index(&self, i: &uint) -> Vec3 { unsafe { do buf_as_slice( transmute::<*Mat3, *Vec3>( - to_unsafe_ptr(self)), 3) |slice| { slice[i] } + to_unsafe_ptr(self)), 3) |slice| { slice[*i] } } } } diff --git a/src/mat4.rs b/src/mat4.rs index be0bdb3..6fb6621 100644 --- a/src/mat4.rs +++ b/src/mat4.rs @@ -499,10 +499,10 @@ impl + Add + Sub + Mul + Div + N impl Index> for Mat4 { #[inline(always)] - fn index(&self, i: uint) -> Vec4 { + fn index(&self, i: &uint) -> Vec4 { unsafe { do buf_as_slice( transmute::<*Mat4, *Vec4>( - to_unsafe_ptr(self)), 4) |slice| { slice[i] } + to_unsafe_ptr(self)), 4) |slice| { slice[*i] } } } } diff --git a/src/quat.rs b/src/quat.rs index aa81537..d1da1bd 100644 --- a/src/quat.rs +++ b/src/quat.rs @@ -391,10 +391,10 @@ pub impl + Add + Sub + Mul + Div impl Index for Quat { #[inline(always)] - fn index(&self, i: uint) -> T { + fn index(&self, i: &uint) -> T { unsafe { do buf_as_slice( transmute::<*Quat, *T>( - to_unsafe_ptr(self)), 4) |slice| { slice[i] } + to_unsafe_ptr(self)), 4) |slice| { slice[*i] } } } } diff --git a/src/vec2.rs b/src/vec2.rs index 02efe4e..f893ce6 100644 --- a/src/vec2.rs +++ b/src/vec2.rs @@ -67,8 +67,8 @@ impl Vector2 for Vec2 { impl Index for Vec2 { #[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] } } } } diff --git a/src/vec3.rs b/src/vec3.rs index 42d898e..988a70d 100644 --- a/src/vec3.rs +++ b/src/vec3.rs @@ -69,8 +69,8 @@ impl Vector3 for Vec3 { impl Index for Vec3 { #[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] } } } } diff --git a/src/vec4.rs b/src/vec4.rs index a183175..ec9b68a 100644 --- a/src/vec4.rs +++ b/src/vec4.rs @@ -67,8 +67,8 @@ impl Vector4 for Vec4 { impl Index for Vec4 { #[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] } } } }