Remove imports from top of files

This commit is contained in:
Brendan Zabarauskas 2013-03-30 23:36:34 +11:00
parent dfa4339912
commit a1f0980688
7 changed files with 37 additions and 65 deletions

View file

@ -1,8 +1,3 @@
use core::cast::transmute;
use core::sys::size_of;
use core::util::swap;
use core::vec::raw::buf_as_slice;
use std::cmp::{FuzzyEq, FUZZY_EPSILON}; use std::cmp::{FuzzyEq, FUZZY_EPSILON};
use numeric::*; use numeric::*;
use numeric::number::Number; use numeric::number::Number;
@ -230,8 +225,8 @@ impl<T:Copy + Float + FuzzyEq<T> + Add<T,T> + Sub<T,T> + Mul<T,T> + Div<T,T> + N
#[inline(always)] #[inline(always)]
fn transpose_self(&mut self) { fn transpose_self(&mut self) {
swap(self.x.index_mut(1), self.y.index_mut(0)); *self.x.index_mut(1) <-> *self.y.index_mut(0);
swap(self.y.index_mut(0), self.x.index_mut(1)); *self.y.index_mut(0) <-> *self.x.index_mut(1);
} }
#[inline(always)] #[inline(always)]
@ -263,7 +258,7 @@ impl<T:Copy + Float + FuzzyEq<T> + Add<T,T> + Sub<T,T> + Mul<T,T> + Div<T,T> + N
#[inline(always)] #[inline(always)]
fn to_ptr(&self) -> *T { fn to_ptr(&self) -> *T {
unsafe { transmute(self) } unsafe { cast::transmute(self) }
} }
} }
@ -371,7 +366,7 @@ 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> { impl<T:Copy> Index<uint, Vec2<T>> for Mat2<T> {
#[inline(always)] #[inline(always)]
fn index(&self, i: &uint) -> Vec2<T> { fn index(&self, i: &uint) -> Vec2<T> {
unsafe { do buf_as_slice(transmute(self), 2) |slice| { slice[*i] } } unsafe { do vec::raw::buf_as_slice(cast::transmute(self), 2) |slice| { slice[*i] } }
} }
} }
@ -420,7 +415,7 @@ pub impl mat2 {
#[inline(always)] fn dim() -> uint { 2 } #[inline(always)] fn dim() -> uint { 2 }
#[inline(always)] fn rows() -> uint { 2 } #[inline(always)] fn rows() -> uint { 2 }
#[inline(always)] fn cols() -> uint { 2 } #[inline(always)] fn cols() -> uint { 2 }
#[inline(always)] fn size_of() -> uint { size_of::<mat2>() } #[inline(always)] fn size_of() -> uint { sys::size_of::<mat2>() }
} }
pub impl dmat2 { pub impl dmat2 {
@ -438,5 +433,5 @@ pub impl dmat2 {
#[inline(always)] fn dim() -> uint { 2 } #[inline(always)] fn dim() -> uint { 2 }
#[inline(always)] fn rows() -> uint { 2 } #[inline(always)] fn rows() -> uint { 2 }
#[inline(always)] fn cols() -> uint { 2 } #[inline(always)] fn cols() -> uint { 2 }
#[inline(always)] fn size_of() -> uint { size_of::<dmat2>() } #[inline(always)] fn size_of() -> uint { sys::size_of::<dmat2>() }
} }

View file

@ -1,7 +1,3 @@
use core::cast::transmute;
use core::sys::size_of;
use core::vec::raw::buf_as_slice;
use std::cmp::{FuzzyEq, FUZZY_EPSILON}; use std::cmp::{FuzzyEq, FUZZY_EPSILON};
use numeric::*; use numeric::*;
use numeric::number::Number; use numeric::number::Number;
@ -313,7 +309,7 @@ impl<T:Copy + Float + FuzzyEq<T> + Add<T,T> + Sub<T,T> + Mul<T,T> + Div<T,T> + N
#[inline(always)] #[inline(always)]
fn to_ptr(&self) -> *T { fn to_ptr(&self) -> *T {
unsafe { transmute(self) } unsafe { cast::transmute(self) }
} }
} }
@ -547,7 +543,7 @@ 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> { impl<T:Copy> Index<uint, Vec3<T>> for Mat3<T> {
#[inline(always)] #[inline(always)]
fn index(&self, i: &uint) -> Vec3<T> { fn index(&self, i: &uint) -> Vec3<T> {
unsafe { do buf_as_slice(transmute(self), 3) |slice| { slice[*i] } } unsafe { do vec::raw::buf_as_slice(cast::transmute(self), 3) |slice| { slice[*i] } }
} }
} }
@ -603,7 +599,7 @@ pub impl mat3 {
#[inline(always)] fn dim() -> uint { 3 } #[inline(always)] fn dim() -> uint { 3 }
#[inline(always)] fn rows() -> uint { 3 } #[inline(always)] fn rows() -> uint { 3 }
#[inline(always)] fn cols() -> uint { 3 } #[inline(always)] fn cols() -> uint { 3 }
#[inline(always)] fn size_of() -> uint { size_of::<mat3>() } #[inline(always)] fn size_of() -> uint { sys::size_of::<mat3>() }
} }
@ -620,5 +616,5 @@ pub impl dmat3 {
#[inline(always)] fn dim() -> uint { 3 } #[inline(always)] fn dim() -> uint { 3 }
#[inline(always)] fn rows() -> uint { 3 } #[inline(always)] fn rows() -> uint { 3 }
#[inline(always)] fn cols() -> uint { 3 } #[inline(always)] fn cols() -> uint { 3 }
#[inline(always)] fn size_of() -> uint { size_of::<dmat3>() } #[inline(always)] fn size_of() -> uint { sys::size_of::<dmat3>() }
} }

View file

@ -1,7 +1,3 @@
use core::cast::transmute;
use core::sys::size_of;
use core::vec::raw::buf_as_slice;
use std::cmp::{FuzzyEq, FUZZY_EPSILON}; use std::cmp::{FuzzyEq, FUZZY_EPSILON};
use numeric::*; use numeric::*;
use numeric::number::Number; use numeric::number::Number;
@ -409,7 +405,7 @@ impl<T:Copy + Float + FuzzyEq<T> + Add<T,T> + Sub<T,T> + Mul<T,T> + Div<T,T> + N
#[inline(always)] #[inline(always)]
fn to_ptr(&self) -> *T { fn to_ptr(&self) -> *T {
unsafe { transmute(self) } unsafe { cast::transmute(self) }
} }
} }
@ -490,7 +486,7 @@ 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> { impl<T:Copy> Index<uint, Vec4<T>> for Mat4<T> {
#[inline(always)] #[inline(always)]
fn index(&self, i: &uint) -> Vec4<T> { fn index(&self, i: &uint) -> Vec4<T> {
unsafe { do buf_as_slice(transmute(self), 4) |slice| { slice[*i] } } unsafe { do vec::raw::buf_as_slice(cast::transmute(self), 4) |slice| { slice[*i] } }
} }
} }
@ -532,7 +528,7 @@ pub impl mat4 {
#[inline(always)] fn dim() -> uint { 4 } #[inline(always)] fn dim() -> uint { 4 }
#[inline(always)] fn rows() -> uint { 4 } #[inline(always)] fn rows() -> uint { 4 }
#[inline(always)] fn cols() -> uint { 4 } #[inline(always)] fn cols() -> uint { 4 }
#[inline(always)] fn size_of() -> uint { size_of::<mat4>() } #[inline(always)] fn size_of() -> uint { sys::size_of::<mat4>() }
} }
pub impl dmat4 { pub impl dmat4 {
@ -548,5 +544,5 @@ pub impl dmat4 {
#[inline(always)] fn dim() -> uint { 4 } #[inline(always)] fn dim() -> uint { 4 }
#[inline(always)] fn rows() -> uint { 4 } #[inline(always)] fn rows() -> uint { 4 }
#[inline(always)] fn cols() -> uint { 4 } #[inline(always)] fn cols() -> uint { 4 }
#[inline(always)] fn size_of() -> uint { size_of::<dmat4>() } #[inline(always)] fn size_of() -> uint { sys::size_of::<dmat4>() }
} }

View file

@ -7,9 +7,6 @@
* Sir William Hamilton * Sir William Hamilton
*/ */
use core::cast::transmute;
use core::vec::raw::buf_as_slice;
use std::cmp::{FuzzyEq, FUZZY_EPSILON}; use std::cmp::{FuzzyEq, FUZZY_EPSILON};
use numeric::*; use numeric::*;
use numeric::number::Number; use numeric::number::Number;
@ -351,7 +348,7 @@ pub impl<T:Copy + Float + FuzzyEq<T> + Add<T,T> + Sub<T,T> + Mul<T,T> + Div<T,T>
*/ */
#[inline(always)] #[inline(always)]
fn to_ptr(&self) -> *T { fn to_ptr(&self) -> *T {
unsafe { transmute(self) } unsafe { cast::transmute(self) }
} }
/** /**
@ -386,7 +383,7 @@ 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> { impl<T:Copy> Index<uint, T> for Quat<T> {
#[inline(always)] #[inline(always)]
fn index(&self, i: &uint) -> T { fn index(&self, i: &uint) -> T {
unsafe { do buf_as_slice(transmute(self), 4) |slice| { slice[*i] } } unsafe { do vec::raw::buf_as_slice(cast::transmute(self), 4) |slice| { slice[*i] } }
} }
} }

View file

@ -1,7 +1,3 @@
use core::cast::transmute;
use core::sys::size_of;
use core::vec::raw::buf_as_slice;
use std::cmp::{FuzzyEq, FUZZY_EPSILON}; use std::cmp::{FuzzyEq, FUZZY_EPSILON};
use numeric::*; use numeric::*;
use numeric::number::Number; use numeric::number::Number;
@ -45,7 +41,7 @@ impl<T:Copy + Eq> Vector<T> for Vec2<T> {
#[inline(always)] #[inline(always)]
fn to_ptr(&self) -> *T { fn to_ptr(&self) -> *T {
unsafe { transmute(self) } unsafe { cast::transmute(self) }
} }
#[inline(always)] #[inline(always)]
@ -73,7 +69,7 @@ impl<T> Vector2<T> for Vec2<T> {
impl<T:Copy + Eq> Index<uint, T> for Vec2<T> { impl<T:Copy + Eq> Index<uint, T> for Vec2<T> {
#[inline(always)] #[inline(always)]
fn index(&self, i: &uint) -> T { fn index(&self, i: &uint) -> T {
unsafe { do buf_as_slice(self.to_ptr(), 2) |slice| { slice[*i] } } unsafe { do vec::raw::buf_as_slice(self.to_ptr(), 2) |slice| { slice[*i] } }
} }
} }
@ -365,7 +361,7 @@ pub impl vec2 {
#[inline(always)] fn unit_y() -> vec2 { NumericVector2::unit_y() } #[inline(always)] fn unit_y() -> vec2 { NumericVector2::unit_y() }
#[inline(always)] fn dim() -> uint { 2 } #[inline(always)] fn dim() -> uint { 2 }
#[inline(always)] fn size_of() -> uint { size_of::<vec2>() } #[inline(always)] fn size_of() -> uint { sys::size_of::<vec2>() }
} }
pub impl dvec2 { pub impl dvec2 {
@ -378,7 +374,7 @@ pub impl dvec2 {
#[inline(always)] fn unit_y() -> dvec2 { NumericVector2::unit_y() } #[inline(always)] fn unit_y() -> dvec2 { NumericVector2::unit_y() }
#[inline(always)] fn dim() -> uint { 2 } #[inline(always)] fn dim() -> uint { 2 }
#[inline(always)] fn size_of() -> uint { size_of::<dvec2>() } #[inline(always)] fn size_of() -> uint { sys::size_of::<dvec2>() }
} }
pub impl bvec2 { pub impl bvec2 {
@ -386,7 +382,7 @@ pub impl bvec2 {
#[inline(always)] fn from_value(v: bool) -> bvec2 { Vector::from_value(v) } #[inline(always)] fn from_value(v: bool) -> bvec2 { Vector::from_value(v) }
#[inline(always)] fn dim() -> uint { 2 } #[inline(always)] fn dim() -> uint { 2 }
#[inline(always)] fn size_of() -> uint { size_of::<bvec2>() } #[inline(always)] fn size_of() -> uint { sys::size_of::<bvec2>() }
} }
pub impl ivec2 { pub impl ivec2 {
@ -399,7 +395,7 @@ pub impl ivec2 {
#[inline(always)] fn unit_y() -> ivec2 { NumericVector2::unit_y() } #[inline(always)] fn unit_y() -> ivec2 { NumericVector2::unit_y() }
#[inline(always)] fn dim() -> uint { 2 } #[inline(always)] fn dim() -> uint { 2 }
#[inline(always)] fn size_of() -> uint { size_of::<ivec2>() } #[inline(always)] fn size_of() -> uint { sys::size_of::<ivec2>() }
} }
pub impl uvec2 { pub impl uvec2 {
@ -412,7 +408,7 @@ pub impl uvec2 {
#[inline(always)] fn unit_y() -> uvec2 { NumericVector2::unit_y() } #[inline(always)] fn unit_y() -> uvec2 { NumericVector2::unit_y() }
#[inline(always)] fn dim() -> uint { 2 } #[inline(always)] fn dim() -> uint { 2 }
#[inline(always)] fn size_of() -> uint { size_of::<uvec2>() } #[inline(always)] fn size_of() -> uint { sys::size_of::<uvec2>() }
} }
// Type aliases named in a more 'Rustic' style // Type aliases named in a more 'Rustic' style

View file

@ -1,7 +1,3 @@
use core::cast::transmute;
use core::sys::size_of;
use core::vec::raw::buf_as_slice;
use std::cmp::{FuzzyEq, FUZZY_EPSILON}; use std::cmp::{FuzzyEq, FUZZY_EPSILON};
use numeric::*; use numeric::*;
use numeric::number::Number; use numeric::number::Number;
@ -46,7 +42,7 @@ impl<T:Copy + Eq> Vector<T> for Vec3<T> {
#[inline(always)] #[inline(always)]
fn to_ptr(&self) -> *T { fn to_ptr(&self) -> *T {
unsafe { transmute(self) } unsafe { cast::transmute(self) }
} }
#[inline(always)] #[inline(always)]
@ -75,7 +71,7 @@ impl<T> Vector3<T> for Vec3<T> {
impl<T:Copy + Eq> Index<uint, T> for Vec3<T> { impl<T:Copy + Eq> Index<uint, T> for Vec3<T> {
#[inline(always)] #[inline(always)]
fn index(&self, i: &uint) -> T { fn index(&self, i: &uint) -> T {
unsafe { do buf_as_slice(self.to_ptr(), 3) |slice| { slice[*i] } } unsafe { do vec::raw::buf_as_slice(self.to_ptr(), 3) |slice| { slice[*i] } }
} }
} }
@ -402,7 +398,7 @@ pub impl vec3 {
#[inline(always)] fn unit_z() -> vec3 { NumericVector3::unit_z() } #[inline(always)] fn unit_z() -> vec3 { NumericVector3::unit_z() }
#[inline(always)] fn dim() -> uint { 3 } #[inline(always)] fn dim() -> uint { 3 }
#[inline(always)] fn size_of() -> uint { size_of::<vec3>() } #[inline(always)] fn size_of() -> uint { sys::size_of::<vec3>() }
} }
pub impl dvec3 { pub impl dvec3 {
@ -416,7 +412,7 @@ pub impl dvec3 {
#[inline(always)] fn unit_z() -> dvec3 { NumericVector3::unit_z() } #[inline(always)] fn unit_z() -> dvec3 { NumericVector3::unit_z() }
#[inline(always)] fn dim() -> uint { 3 } #[inline(always)] fn dim() -> uint { 3 }
#[inline(always)] fn size_of() -> uint { size_of::<dvec3>() } #[inline(always)] fn size_of() -> uint { sys::size_of::<dvec3>() }
} }
pub impl bvec3 { pub impl bvec3 {
@ -424,7 +420,7 @@ pub impl bvec3 {
#[inline(always)] fn from_value(v: bool) -> bvec3 { Vector::from_value(v) } #[inline(always)] fn from_value(v: bool) -> bvec3 { Vector::from_value(v) }
#[inline(always)] fn dim() -> uint { 3 } #[inline(always)] fn dim() -> uint { 3 }
#[inline(always)] fn size_of() -> uint { size_of::<bvec3>() } #[inline(always)] fn size_of() -> uint { sys::size_of::<bvec3>() }
} }
pub impl ivec3 { pub impl ivec3 {
@ -438,7 +434,7 @@ pub impl ivec3 {
#[inline(always)] fn unit_z() -> ivec3 { NumericVector3::unit_z() } #[inline(always)] fn unit_z() -> ivec3 { NumericVector3::unit_z() }
#[inline(always)] fn dim() -> uint { 3 } #[inline(always)] fn dim() -> uint { 3 }
#[inline(always)] fn size_of() -> uint { size_of::<ivec3>() } #[inline(always)] fn size_of() -> uint { sys::size_of::<ivec3>() }
} }
pub impl uvec3 { pub impl uvec3 {
@ -452,5 +448,5 @@ pub impl uvec3 {
#[inline(always)] fn unit_z() -> uvec3 { NumericVector3::unit_z() } #[inline(always)] fn unit_z() -> uvec3 { NumericVector3::unit_z() }
#[inline(always)] fn dim() -> uint { 3 } #[inline(always)] fn dim() -> uint { 3 }
#[inline(always)] fn size_of() -> uint { size_of::<uvec3>() } #[inline(always)] fn size_of() -> uint { sys::size_of::<uvec3>() }
} }

View file

@ -1,7 +1,3 @@
use core::cast::transmute;
use core::sys::size_of;
use core::vec::raw::buf_as_slice;
use std::cmp::{FuzzyEq, FUZZY_EPSILON}; use std::cmp::{FuzzyEq, FUZZY_EPSILON};
use numeric::*; use numeric::*;
use numeric::number::Number; use numeric::number::Number;
@ -44,7 +40,7 @@ impl<T:Copy + Eq> Vector<T> for Vec4<T> {
#[inline(always)] #[inline(always)]
fn to_ptr(&self) -> *T { fn to_ptr(&self) -> *T {
unsafe { transmute(self) } unsafe { cast::transmute(self) }
} }
#[inline(always)] #[inline(always)]
@ -74,7 +70,7 @@ impl<T> Vector4<T> for Vec4<T> {
impl<T:Copy + Eq> Index<uint, T> for Vec4<T> { impl<T:Copy + Eq> Index<uint, T> for Vec4<T> {
#[inline(always)] #[inline(always)]
fn index(&self, i: &uint) -> T { fn index(&self, i: &uint) -> T {
unsafe { do buf_as_slice(self.to_ptr(), 4) |slice| { slice[*i] } } unsafe { do vec::raw::buf_as_slice(self.to_ptr(), 4) |slice| { slice[*i] } }
} }
} }
@ -410,7 +406,7 @@ pub impl vec4 {
#[inline(always)] fn unit_w() -> vec4 { NumericVector4::unit_w() } #[inline(always)] fn unit_w() -> vec4 { NumericVector4::unit_w() }
#[inline(always)] fn dim() -> uint { 4 } #[inline(always)] fn dim() -> uint { 4 }
#[inline(always)] fn size_of() -> uint { size_of::<vec4>() } #[inline(always)] fn size_of() -> uint { sys::size_of::<vec4>() }
} }
pub impl dvec4 { pub impl dvec4 {
@ -425,7 +421,7 @@ pub impl dvec4 {
#[inline(always)] fn unit_w() -> dvec4 { NumericVector4::unit_w() } #[inline(always)] fn unit_w() -> dvec4 { NumericVector4::unit_w() }
#[inline(always)] fn dim() -> uint { 4 } #[inline(always)] fn dim() -> uint { 4 }
#[inline(always)] fn size_of() -> uint { size_of::<dvec4>() } #[inline(always)] fn size_of() -> uint { sys::size_of::<dvec4>() }
} }
@ -434,7 +430,7 @@ pub impl bvec4 {
#[inline(always)] fn from_value(v: bool) -> bvec4 { Vector::from_value(v) } #[inline(always)] fn from_value(v: bool) -> bvec4 { Vector::from_value(v) }
#[inline(always)] fn dim() -> uint { 4 } #[inline(always)] fn dim() -> uint { 4 }
#[inline(always)] fn size_of() -> uint { size_of::<bvec4>() } #[inline(always)] fn size_of() -> uint { sys::size_of::<bvec4>() }
} }
pub impl ivec4 { pub impl ivec4 {
@ -449,7 +445,7 @@ pub impl ivec4 {
#[inline(always)] fn unit_w() -> ivec4 { NumericVector4::unit_w() } #[inline(always)] fn unit_w() -> ivec4 { NumericVector4::unit_w() }
#[inline(always)] fn dim() -> uint { 4 } #[inline(always)] fn dim() -> uint { 4 }
#[inline(always)] fn size_of() -> uint { size_of::<ivec4>() } #[inline(always)] fn size_of() -> uint { sys::size_of::<ivec4>() }
} }
pub impl uvec4 { pub impl uvec4 {
@ -464,5 +460,5 @@ pub impl uvec4 {
#[inline(always)] fn unit_w() -> uvec4 { NumericVector4::unit_w() } #[inline(always)] fn unit_w() -> uvec4 { NumericVector4::unit_w() }
#[inline(always)] fn dim() -> uint { 4 } #[inline(always)] fn dim() -> uint { 4 }
#[inline(always)] fn size_of() -> uint { size_of::<uvec4>() } #[inline(always)] fn size_of() -> uint { sys::size_of::<uvec4>() }
} }