Update for Rustc
This commit is contained in:
parent
e94061ed10
commit
89edd64204
|
@ -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)
|
||||
}
|
||||
})
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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>, &[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>, &[N; $dim * $dim]>(self).unsafe_get(i + j * $dim))
|
||||
(*mem::transmute::<&$t<N>, &[N; $dim * $dim]>(self).get_unchecked(i + j * $dim))
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
|
|
@ -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<N>;
|
||||
|
||||
impl<N> Vec0<N> {
|
||||
|
@ -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<N> {
|
||||
/// 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<N> {
|
||||
/// 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<N> {
|
||||
/// 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<N> {
|
||||
/// 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<N> {
|
||||
/// First component of the vector.
|
||||
pub x: N,
|
||||
|
|
|
@ -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>, &[N; $dim]>(self).unsafe_get(i))
|
||||
(*mem::transmute::<&$t<N>, &[N; $dim]>(self).get_unchecked(i))
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
|
Loading…
Reference in New Issue