From b61d6210905b10f15037fb982c583a95333d4878 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Crozet?= Date: Thu, 26 Sep 2013 17:05:11 +0200 Subject: [PATCH] Update to the last Rust. --- src/dvec.rs | 6 +++--- src/traits/geometry.rs | 3 ++- src/traits/structure.rs | 14 +++++++------- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/dvec.rs b/src/dvec.rs index 30d33fc8..5518b666 100644 --- a/src/dvec.rs +++ b/src/dvec.rs @@ -241,7 +241,7 @@ impl> Neg> for DVec { } } -impl Dot for DVec { +impl Dot for DVec { #[inline] fn dot(&self, other: &DVec) -> N { assert!(self.at.len() == other.at.len()); @@ -249,7 +249,7 @@ impl Dot for DVec { let mut res: N = Zero::zero(); for i in range(0u, self.at.len()) { - res = res + self.at[i] * other.at[i]; + res = res + unsafe { self.at_fast(i) * other.at_fast(i) }; } res @@ -260,7 +260,7 @@ impl Dot for DVec { let mut res: N = Zero::zero(); for i in range(0u, self.at.len()) { - res = res + (self.at[i] - a.at[i]) * b.at[i]; + res = res + unsafe { (self.at_fast(i) - a.at_fast(i)) * b.at_fast(i) }; } res diff --git a/src/traits/geometry.rs b/src/traits/geometry.rs index 8ca293bc..7a80ec59 100644 --- a/src/traits/geometry.rs +++ b/src/traits/geometry.rs @@ -254,4 +254,5 @@ pub trait RotationWithTranslation, AV>: Rotation + Translation, AV, M: Rotation + Translation> RotationWithTranslation for M; +impl, AV, M: Rotation + Translation> RotationWithTranslation for M { +} diff --git a/src/traits/structure.rs b/src/traits/structure.rs index 7e105272..77c04979 100644 --- a/src/traits/structure.rs +++ b/src/traits/structure.rs @@ -8,7 +8,8 @@ use traits::geometry::{Dot, Norm, UniformSphereSample}; /// A matrix has rows and columns and are able to multiply them. pub trait Mat : Row + Col + RMul + LMul { } -impl + Col + RMul + LMul, R, C> Mat for M; +impl + Col + RMul + LMul, R, C> Mat for M { +} /// Trait of matrices which can be converted to another matrix. /// @@ -39,20 +40,19 @@ pub trait VecExt: Vec + Basis + Indexable + Iterable + Round + /// Trait grouping uncommon, low-level and borderline (from the mathematical point of view) /// operations on vectors. -pub trait AlgebraicVecExt: AlgebraicVec + VecExt -{ } +pub trait AlgebraicVecExt: AlgebraicVec + VecExt { } impl + Add + Neg + Zero + Eq + Mul + Div + Dot> -Vec for V; +Vec for V { } -impl + Norm> AlgebraicVec for V; +impl + Norm> AlgebraicVec for V { } impl + Basis + Indexable + Iterable + Round + UniformSphereSample + ScalarAdd + ScalarSub + Bounded + Orderable> -VecExt for V; +VecExt for V { } -impl + VecExt> AlgebraicVecExt for V; +impl + VecExt> AlgebraicVecExt for V { } /// Trait of vectors which can be converted to another vector. Used to change the type of a vector /// components.