From 89edd642043a53bc74b0d026103cdab3ea7df2c6 Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Mon, 5 Jan 2015 15:12:06 +0100 Subject: [PATCH] Update for Rustc --- benches/common/macros.rs | 8 ++++---- src/structs/dvec_macros.rs | 2 +- src/structs/mat_macros.rs | 4 ++-- src/structs/vec.rs | 12 ++++++------ src/structs/vec_macros.rs | 4 ++-- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/benches/common/macros.rs b/benches/common/macros.rs index 66b3897d..b6e693d7 100644 --- a/benches/common/macros.rs +++ b/benches/common/macros.rs @@ -16,7 +16,7 @@ macro_rules! bench_binop( i = (i + 1) & (LEN - 1); 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); 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); 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); unsafe { - let res = $constructor($(*$args.unsafe_get(i),)*); + let res = $constructor($(*$args.get_unchecked(i),)*); test::black_box(res) } }) diff --git a/src/structs/dvec_macros.rs b/src/structs/dvec_macros.rs index ebdac68f..6fd01ec0 100644 --- a/src/structs/dvec_macros.rs +++ b/src/structs/dvec_macros.rs @@ -67,7 +67,7 @@ macro_rules! dvec_impl( #[inline] unsafe fn unsafe_at(&self, i: uint) -> N { - *self.at.as_slice().unsafe_get(i) + *self.at.as_slice().get_unchecked(i) } #[inline] diff --git a/src/structs/mat_macros.rs b/src/structs/mat_macros.rs index c3726c1a..71e77c5d 100644 --- a/src/structs/mat_macros.rs +++ b/src/structs/mat_macros.rs @@ -63,7 +63,7 @@ macro_rules! at_fast_impl( #[inline] pub unsafe fn at_fast(&self, (i, j): (uint, uint)) -> N { (*mem::transmute::<&$t, &[N; $dim * $dim]>(self) - .unsafe_get(i + j * $dim)) + .get_unchecked(i + j * $dim)) } #[inline] @@ -290,7 +290,7 @@ macro_rules! indexable_impl( #[inline] unsafe fn unsafe_at(&self, (i, j): (uint, uint)) -> N { - (*mem::transmute::<&$t, &[N; $dim * $dim]>(self).unsafe_get(i + j * $dim)) + (*mem::transmute::<&$t, &[N; $dim * $dim]>(self).get_unchecked(i + j * $dim)) } #[inline] diff --git a/src/structs/vec.rs b/src/structs/vec.rs index e7e75fd0..927799da 100644 --- a/src/structs/vec.rs +++ b/src/structs/vec.rs @@ -16,7 +16,7 @@ use structs::pnt::{Pnt1, Pnt2, Pnt3, Pnt4, Pnt5, Pnt6}; /// Vector of dimension 0. -#[derive(Eq, PartialEq, RustcDecodable, Clone, Rand, Zero, Show, Copy)] +#[derive(Eq, PartialEq, RustcDecodable, Clone, Rand, Show, Copy)] pub struct Vec0; impl Vec0 { @@ -83,7 +83,7 @@ num_float_vec_impl!(Vec1); absolute_vec_impl!(Vec1, x); /// 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 { /// First component of the vector. pub x: N, @@ -134,7 +134,7 @@ num_float_vec_impl!(Vec2); absolute_vec_impl!(Vec2, x, y); /// 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 { /// First component of the vector. pub x: N, @@ -188,7 +188,7 @@ absolute_vec_impl!(Vec3, x, y, z); /// 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 { /// First component of the vector. pub x: N, @@ -243,7 +243,7 @@ num_float_vec_impl!(Vec4); absolute_vec_impl!(Vec4, x, y, z, w); /// 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 { /// First component of the vector. pub x: N, @@ -300,7 +300,7 @@ num_float_vec_impl!(Vec5); absolute_vec_impl!(Vec5, x, y, z, w, a); /// 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 { /// First component of the vector. pub x: N, diff --git a/src/structs/vec_macros.rs b/src/structs/vec_macros.rs index 910c4e2a..9801ef95 100644 --- a/src/structs/vec_macros.rs +++ b/src/structs/vec_macros.rs @@ -64,7 +64,7 @@ macro_rules! at_fast_impl( /// Unsafe read access to a vector element by index. #[inline] 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. @@ -223,7 +223,7 @@ macro_rules! indexable_impl( #[inline] unsafe fn unsafe_at(&self, i: uint) -> N { - (*mem::transmute::<&$t, &[N; $dim]>(self).unsafe_get(i)) + (*mem::transmute::<&$t, &[N; $dim]>(self).get_unchecked(i)) } #[inline]