Update for Rustc

This commit is contained in:
Pierre Krieger 2015-01-05 15:12:06 +01:00
parent e94061ed10
commit 89edd64204
5 changed files with 15 additions and 15 deletions

View File

@ -16,7 +16,7 @@ macro_rules! bench_binop(
i = (i + 1) & (LEN - 1); i = (i + 1) & (LEN - 1);
unsafe { unsafe {
test::black_box(elems1.unsafe_get(i).$binop(*elems2.unsafe_get(i))) test::black_box(elems1.get_unchecked(i).$binop(*elems2.get_unchecked(i)))
} }
}) })
} }
@ -39,7 +39,7 @@ macro_rules! bench_binop_na(
i = (i + 1) & (LEN - 1); i = (i + 1) & (LEN - 1);
unsafe { unsafe {
test::black_box(na::$binop(elems1.unsafe_get(i), elems2.unsafe_get(i))) test::black_box(na::$binop(elems1.get_unchecked(i), elems2.get_unchecked(i)))
} }
}) })
} }
@ -61,7 +61,7 @@ macro_rules! bench_unop(
i = (i + 1) & (LEN - 1); i = (i + 1) & (LEN - 1);
unsafe { unsafe {
test::black_box(na::$unop(elems.unsafe_get(i))) test::black_box(na::$unop(elems.get_unchecked(i)))
} }
}) })
} }
@ -105,7 +105,7 @@ macro_rules! bench_construction(
i = (i + 1) & (LEN - 1); i = (i + 1) & (LEN - 1);
unsafe { unsafe {
let res = $constructor($(*$args.unsafe_get(i),)*); let res = $constructor($(*$args.get_unchecked(i),)*);
test::black_box(res) test::black_box(res)
} }
}) })

View File

@ -67,7 +67,7 @@ macro_rules! dvec_impl(
#[inline] #[inline]
unsafe fn unsafe_at(&self, i: uint) -> N { unsafe fn unsafe_at(&self, i: uint) -> N {
*self.at.as_slice().unsafe_get(i) *self.at.as_slice().get_unchecked(i)
} }
#[inline] #[inline]

View File

@ -63,7 +63,7 @@ macro_rules! at_fast_impl(
#[inline] #[inline]
pub unsafe fn at_fast(&self, (i, j): (uint, uint)) -> N { pub unsafe fn at_fast(&self, (i, j): (uint, uint)) -> N {
(*mem::transmute::<&$t<N>, &[N; $dim * $dim]>(self) (*mem::transmute::<&$t<N>, &[N; $dim * $dim]>(self)
.unsafe_get(i + j * $dim)) .get_unchecked(i + j * $dim))
} }
#[inline] #[inline]
@ -290,7 +290,7 @@ macro_rules! indexable_impl(
#[inline] #[inline]
unsafe fn unsafe_at(&self, (i, j): (uint, uint)) -> N { unsafe fn unsafe_at(&self, (i, j): (uint, uint)) -> N {
(*mem::transmute::<&$t<N>, &[N; $dim * $dim]>(self).unsafe_get(i + j * $dim)) (*mem::transmute::<&$t<N>, &[N; $dim * $dim]>(self).get_unchecked(i + j * $dim))
} }
#[inline] #[inline]

View File

@ -16,7 +16,7 @@ use structs::pnt::{Pnt1, Pnt2, Pnt3, Pnt4, Pnt5, Pnt6};
/// Vector of dimension 0. /// Vector of dimension 0.
#[derive(Eq, PartialEq, RustcDecodable, Clone, Rand, Zero, Show, Copy)] #[derive(Eq, PartialEq, RustcDecodable, Clone, Rand, Show, Copy)]
pub struct Vec0<N>; pub struct Vec0<N>;
impl<N> Vec0<N> { impl<N> Vec0<N> {
@ -83,7 +83,7 @@ num_float_vec_impl!(Vec1);
absolute_vec_impl!(Vec1, x); absolute_vec_impl!(Vec1, x);
/// Vector of dimension 2. /// Vector of dimension 2.
#[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Rand, Zero, Show, Copy)] #[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Rand, Show, Copy)]
pub struct Vec2<N> { pub struct Vec2<N> {
/// First component of the vector. /// First component of the vector.
pub x: N, pub x: N,
@ -134,7 +134,7 @@ num_float_vec_impl!(Vec2);
absolute_vec_impl!(Vec2, x, y); absolute_vec_impl!(Vec2, x, y);
/// Vector of dimension 3. /// Vector of dimension 3.
#[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Rand, Zero, Show, Copy)] #[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Rand, Show, Copy)]
pub struct Vec3<N> { pub struct Vec3<N> {
/// First component of the vector. /// First component of the vector.
pub x: N, pub x: N,
@ -188,7 +188,7 @@ absolute_vec_impl!(Vec3, x, y, z);
/// Vector of dimension 4. /// Vector of dimension 4.
#[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Rand, Zero, Show, Copy)] #[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Rand, Show, Copy)]
pub struct Vec4<N> { pub struct Vec4<N> {
/// First component of the vector. /// First component of the vector.
pub x: N, pub x: N,
@ -243,7 +243,7 @@ num_float_vec_impl!(Vec4);
absolute_vec_impl!(Vec4, x, y, z, w); absolute_vec_impl!(Vec4, x, y, z, w);
/// Vector of dimension 5. /// Vector of dimension 5.
#[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Rand, Zero, Show, Copy)] #[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Rand, Show, Copy)]
pub struct Vec5<N> { pub struct Vec5<N> {
/// First component of the vector. /// First component of the vector.
pub x: N, pub x: N,
@ -300,7 +300,7 @@ num_float_vec_impl!(Vec5);
absolute_vec_impl!(Vec5, x, y, z, w, a); absolute_vec_impl!(Vec5, x, y, z, w, a);
/// Vector of dimension 6. /// Vector of dimension 6.
#[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Rand, Zero, Show, Copy)] #[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Rand, Show, Copy)]
pub struct Vec6<N> { pub struct Vec6<N> {
/// First component of the vector. /// First component of the vector.
pub x: N, pub x: N,

View File

@ -64,7 +64,7 @@ macro_rules! at_fast_impl(
/// Unsafe read access to a vector element by index. /// Unsafe read access to a vector element by index.
#[inline] #[inline]
pub unsafe fn at_fast(&self, i: uint) -> N { pub unsafe fn at_fast(&self, i: uint) -> N {
(*self.as_array().unsafe_get(i)) (*self.as_array().get_unchecked(i))
} }
/// Unsafe write access to a vector element by index. /// Unsafe write access to a vector element by index.
@ -223,7 +223,7 @@ macro_rules! indexable_impl(
#[inline] #[inline]
unsafe fn unsafe_at(&self, i: uint) -> N { unsafe fn unsafe_at(&self, i: uint) -> N {
(*mem::transmute::<&$t<N>, &[N; $dim]>(self).unsafe_get(i)) (*mem::transmute::<&$t<N>, &[N; $dim]>(self).get_unchecked(i))
} }
#[inline] #[inline]