From 8abcdeeedc91ad58a54abd937ff127f2045f3210 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Crozet?= Date: Thu, 27 Jun 2013 17:40:37 +0000 Subject: [PATCH] #[inline(always)] -> #[inline] --- src/adaptors/rotmat.rs | 44 +++++++++++------------ src/adaptors/transform.rs | 44 +++++++++++------------ src/dim1/mat1.rs | 40 ++++++++++----------- src/dim1/vec1.rs | 72 ++++++++++++++++++------------------- src/dim2/mat2.rs | 40 ++++++++++----------- src/dim2/vec2.rs | 74 +++++++++++++++++++-------------------- src/dim3/mat3.rs | 40 ++++++++++----------- src/dim3/vec3.rs | 74 +++++++++++++++++++-------------------- src/ndim/dmat.rs | 24 ++++++------- src/ndim/dvec.rs | 50 +++++++++++++------------- src/ndim/nmat.rs | 36 +++++++++---------- src/ndim/nvec.rs | 72 ++++++++++++++++++------------------- src/traits/rotation.rs | 2 +- 13 files changed, 306 insertions(+), 306 deletions(-) diff --git a/src/adaptors/rotmat.rs b/src/adaptors/rotmat.rs index 162eb1a9..1cca1e86 100644 --- a/src/adaptors/rotmat.rs +++ b/src/adaptors/rotmat.rs @@ -59,11 +59,11 @@ pub fn rotmat3 + One + Sub + Add + impl + Trigonometric + Neg + Mul + Add + Copy> Rotation> for Rotmat> { - #[inline(always)] + #[inline] fn rotation(&self) -> Vec1 { Vec1::new(-(self.submat.m12 / self.submat.m11).atan()) } - #[inline(always)] + #[inline] fn rotate(&mut self, rot: &Vec1) { *self = self.rotated(rot) } } @@ -71,7 +71,7 @@ Rotation> for Rotmat> impl + Trigonometric + Neg + Mul + Add + Copy> Rotatable, Rotmat>> for Rotmat> { - #[inline(always)] + #[inline] fn rotated(&self, rot: &Vec1) -> Rotmat> { rotmat2(copy rot.x) * *self } } @@ -80,11 +80,11 @@ impl + Trigonometric + Neg + Mul + Add + Copy + One + Sub> Rotation<(Vec3, N)> for Rotmat> { - #[inline(always)] + #[inline] fn rotation(&self) -> (Vec3, N) { fail!("Not yet implemented.") } - #[inline(always)] + #[inline] fn rotate(&mut self, rot: &(Vec3, N)) { *self = self.rotated(rot) } } @@ -93,14 +93,14 @@ impl + Trigonometric + Neg + Mul + Add + Copy + One + Sub> Rotatable<(Vec3, N), Rotmat>> for Rotmat> { - #[inline(always)] + #[inline] fn rotated(&self, &(axis, angle): &(Vec3, N)) -> Rotmat> { rotmat3(&axis, angle) * *self } } impl> Rand for Rotmat> { - #[inline(always)] + #[inline] fn rand(rng: &mut R) -> Rotmat> { rotmat2(rng.gen()) } } @@ -109,67 +109,67 @@ impl + One + Sub + Add + Mul> Rand for Rotmat> { - #[inline(always)] + #[inline] fn rand(rng: &mut R) -> Rotmat> { rotmat3(&rng.gen(), rng.gen()) } } impl Dim for Rotmat { - #[inline(always)] + #[inline] fn dim() -> uint { Dim::dim::() } } impl One for Rotmat { - #[inline(always)] + #[inline] fn one() -> Rotmat { Rotmat { submat: One::one() } } } impl> Mul, Rotmat> for Rotmat { - #[inline(always)] + #[inline] fn mul(&self, other: &Rotmat) -> Rotmat { Rotmat { submat: self.submat.mul(&other.submat) } } } impl> RMul for Rotmat { - #[inline(always)] + #[inline] fn rmul(&self, other: &V) -> V { self.submat.rmul(other) } } impl> LMul for Rotmat { - #[inline(always)] + #[inline] fn lmul(&self, other: &V) -> V { self.submat.lmul(other) } } impl DeltaTransform for Rotmat { - #[inline(always)] + #[inline] fn delta_transform(&self) -> M { copy self.submat } } impl, V> DeltaTransformVector for Rotmat { - #[inline(always)] + #[inline] fn delta_transform_vector(&self, v: &V) -> V { self.submat.rmul(v) } } impl Inv for Rotmat { - #[inline(always)] + #[inline] fn invert(&mut self) { self.transpose() } - #[inline(always)] + #[inline] fn inverse(&self) -> Rotmat { self.transposed() } } @@ -177,26 +177,26 @@ impl Inv for Rotmat impl Transpose for Rotmat { - #[inline(always)] + #[inline] fn transposed(&self) -> Rotmat { Rotmat { submat: self.submat.transposed() } } - #[inline(always)] + #[inline] fn transpose(&mut self) { self.submat.transpose() } } impl, M: ApproxEq> ApproxEq for Rotmat { - #[inline(always)] + #[inline] fn approx_epsilon() -> N { ApproxEq::approx_epsilon::() } - #[inline(always)] + #[inline] fn approx_eq(&self, other: &Rotmat) -> bool { self.submat.approx_eq(&other.submat) } - #[inline(always)] + #[inline] fn approx_eq_eps(&self, other: &Rotmat, epsilon: &N) -> bool { self.submat.approx_eq_eps(&other.submat, epsilon) } } diff --git a/src/adaptors/transform.rs b/src/adaptors/transform.rs index 78019a2c..32ba9ecc 100644 --- a/src/adaptors/transform.rs +++ b/src/adaptors/transform.rs @@ -19,32 +19,32 @@ pub struct Transform impl Transform { - #[inline(always)] + #[inline] pub fn new(mat: M, trans: V) -> Transform { Transform { submat: mat, subtrans: trans } } } impl Dim for Transform { - #[inline(always)] + #[inline] fn dim() -> uint { Dim::dim::() } } impl One for Transform { - #[inline(always)] + #[inline] fn one() -> Transform { Transform { submat: One::one(), subtrans: Zero::zero() } } } impl Zero for Transform { - #[inline(always)] + #[inline] fn zero() -> Transform { Transform { submat: Zero::zero(), subtrans: Zero::zero() } } - #[inline(always)] + #[inline] fn is_zero(&self) -> bool { self.submat.is_zero() && self.subtrans.is_zero() } } @@ -52,7 +52,7 @@ impl Zero for Transform impl + Mul, V: Add> Mul, Transform> for Transform { - #[inline(always)] + #[inline] fn mul(&self, other: &Transform) -> Transform { Transform { submat: self.submat * other.submat, @@ -62,25 +62,25 @@ Mul, Transform> for Transform impl, V: Add> RMul for Transform { - #[inline(always)] + #[inline] fn rmul(&self, other: &V) -> V { self.submat.rmul(other) + self.subtrans } } impl, V: Add> LMul for Transform { - #[inline(always)] + #[inline] fn lmul(&self, other: &V) -> V { self.submat.lmul(other) + self.subtrans } } impl> Translation for Transform { - #[inline(always)] + #[inline] fn translation(&self) -> V { self.subtrans.translation() } - #[inline(always)] + #[inline] fn translate(&mut self, t: &V) { self.subtrans.translate(t) } } @@ -88,7 +88,7 @@ impl> Translation for Transform impl, Res: Translation> Translatable> for Transform { - #[inline(always)] + #[inline] fn translated(&self, t: &V) -> Transform { Transform::new(copy self.submat, self.subtrans.translated(t)) } } @@ -98,11 +98,11 @@ impl + RMul + One, AV> Rotation for Transform { - #[inline(always)] + #[inline] fn rotation(&self) -> AV { self.submat.rotation() } - #[inline(always)] + #[inline] fn rotate(&mut self, rot: &AV) { // FIXME: this does not seem opitmal @@ -119,7 +119,7 @@ impl + One, AV> Rotatable> for Transform { - #[inline(always)] + #[inline] fn rotated(&self, rot: &AV) -> Transform { // FIXME: this does not seem opitmal @@ -149,14 +149,14 @@ Transformable, Transform> for Transform impl DeltaTransform for Transform { - #[inline(always)] + #[inline] fn delta_transform(&self) -> M { copy self.submat } } impl, V> DeltaTransformVector for Transform { - #[inline(always)] + #[inline] fn delta_transform_vector(&self, v: &V) -> V { self.submat.rmul(v) } } @@ -164,14 +164,14 @@ impl, V> DeltaTransformVector for Transform impl, V: Copy + Neg> Inv for Transform { - #[inline(always)] + #[inline] fn invert(&mut self) { self.submat.invert(); self.subtrans = self.submat.rmul(&-self.subtrans); } - #[inline(always)] + #[inline] fn inverse(&self) -> Transform { let mut res = copy *self; @@ -185,18 +185,18 @@ Inv for Transform impl, M:ApproxEq, V:ApproxEq> ApproxEq for Transform { - #[inline(always)] + #[inline] fn approx_epsilon() -> N { ApproxEq::approx_epsilon::() } - #[inline(always)] + #[inline] fn approx_eq(&self, other: &Transform) -> bool { self.submat.approx_eq(&other.submat) && self.subtrans.approx_eq(&other.subtrans) } - #[inline(always)] + #[inline] fn approx_eq_eps(&self, other: &Transform, epsilon: &N) -> bool { self.submat.approx_eq_eps(&other.submat, epsilon) && @@ -206,7 +206,7 @@ ApproxEq for Transform impl Rand for Transform { - #[inline(always)] + #[inline] fn rand(rng: &mut R) -> Transform { Transform::new(rng.gen(), rng.gen()) } } diff --git a/src/dim1/mat1.rs b/src/dim1/mat1.rs index 8068fae0..dff62629 100644 --- a/src/dim1/mat1.rs +++ b/src/dim1/mat1.rs @@ -14,7 +14,7 @@ pub struct Mat1 impl Mat1 { - #[inline(always)] + #[inline] pub fn new(m11: N) -> Mat1 { Mat1 @@ -24,46 +24,46 @@ impl Mat1 impl Dim for Mat1 { - #[inline(always)] + #[inline] fn dim() -> uint { 1 } } impl One for Mat1 { - #[inline(always)] + #[inline] fn one() -> Mat1 { return Mat1::new(One::one()) } } impl Zero for Mat1 { - #[inline(always)] + #[inline] fn zero() -> Mat1 { Mat1::new(Zero::zero()) } - #[inline(always)] + #[inline] fn is_zero(&self) -> bool { self.m11.is_zero() } } impl + Add> Mul, Mat1> for Mat1 { - #[inline(always)] + #[inline] fn mul(&self, other: &Mat1) -> Mat1 { Mat1::new(self.m11 * other.m11) } } impl + Mul> RMul> for Mat1 { - #[inline(always)] + #[inline] fn rmul(&self, other: &Vec1) -> Vec1 { Vec1::new(self.m11 * other.x) } } impl + Mul> LMul> for Mat1 { - #[inline(always)] + #[inline] fn lmul(&self, other: &Vec1) -> Vec1 { Vec1::new(self.m11 * other.x) } } @@ -71,7 +71,7 @@ impl + Mul> LMul> for Mat1 impl + Div + Sub + Neg + Zero + One> Inv for Mat1 { - #[inline(always)] + #[inline] fn inverse(&self) -> Mat1 { let mut res : Mat1 = copy *self; @@ -81,7 +81,7 @@ Inv for Mat1 res } - #[inline(always)] + #[inline] fn invert(&mut self) { assert!(!self.m11.is_zero()); @@ -92,52 +92,52 @@ Inv for Mat1 impl Transpose for Mat1 { - #[inline(always)] + #[inline] fn transposed(&self) -> Mat1 { copy *self } - #[inline(always)] + #[inline] fn transpose(&mut self) { } } impl> ApproxEq for Mat1 { - #[inline(always)] + #[inline] fn approx_epsilon() -> N { ApproxEq::approx_epsilon::() } - #[inline(always)] + #[inline] fn approx_eq(&self, other: &Mat1) -> bool { self.m11.approx_eq(&other.m11) } - #[inline(always)] + #[inline] fn approx_eq_eps(&self, other: &Mat1, epsilon: &N) -> bool { self.m11.approx_eq_eps(&other.m11, epsilon) } } impl Rand for Mat1 { - #[inline(always)] + #[inline] fn rand(rng: &mut R) -> Mat1 { Mat1::new(rng.gen()) } } impl Flatten for Mat1 { - #[inline(always)] + #[inline] fn flat_size() -> uint { 1 } - #[inline(always)] + #[inline] fn from_flattened(l: &[N], off: uint) -> Mat1 { Mat1::new(copy l[off]) } - #[inline(always)] + #[inline] fn flatten(&self) -> ~[N] { ~[ copy self.m11 ] } - #[inline(always)] + #[inline] fn flatten_to(&self, l: &mut [N], off: uint) { l[off] = copy self.m11 } } diff --git a/src/dim1/vec1.rs b/src/dim1/vec1.rs index 9259820c..a96a1bb9 100644 --- a/src/dim1/vec1.rs +++ b/src/dim1/vec1.rs @@ -16,28 +16,28 @@ pub struct Vec1 impl Vec1 { - #[inline(always)] + #[inline] pub fn new(x: N) -> Vec1 { Vec1 {x: x} } } impl Dim for Vec1 { - #[inline(always)] + #[inline] fn dim() -> uint { 1 } } impl> Add, Vec1> for Vec1 { - #[inline(always)] + #[inline] fn add(&self, other: &Vec1) -> Vec1 { Vec1::new(self.x + other.x) } } impl> Sub, Vec1> for Vec1 { - #[inline(always)] + #[inline] fn sub(&self, other: &Vec1) -> Vec1 { Vec1::new(self.x - other.x) } } @@ -45,11 +45,11 @@ impl> Sub, Vec1> for Vec1 impl> ScalarMul for Vec1 { - #[inline(always)] + #[inline] fn scalar_mul(&self, s: &N) -> Vec1 { Vec1 { x: self.x * *s } } - #[inline(always)] + #[inline] fn scalar_mul_inplace(&mut self, s: &N) { self.x = self.x * *s; } } @@ -58,11 +58,11 @@ ScalarMul for Vec1 impl> ScalarDiv for Vec1 { - #[inline(always)] + #[inline] fn scalar_div(&self, s: &N) -> Vec1 { Vec1 { x: self.x / *s } } - #[inline(always)] + #[inline] fn scalar_div_inplace(&mut self, s: &N) { self.x = self.x / *s; } } @@ -70,11 +70,11 @@ ScalarDiv for Vec1 impl> ScalarAdd for Vec1 { - #[inline(always)] + #[inline] fn scalar_add(&self, s: &N) -> Vec1 { Vec1 { x: self.x + *s } } - #[inline(always)] + #[inline] fn scalar_add_inplace(&mut self, s: &N) { self.x = self.x + *s; } } @@ -82,43 +82,43 @@ ScalarAdd for Vec1 impl> ScalarSub for Vec1 { - #[inline(always)] + #[inline] fn scalar_sub(&self, s: &N) -> Vec1 { Vec1 { x: self.x - *s } } - #[inline(always)] + #[inline] fn scalar_sub_inplace(&mut self, s: &N) { self.x = self.x - *s; } } impl> Translation> for Vec1 { - #[inline(always)] + #[inline] fn translation(&self) -> Vec1 { copy *self } - #[inline(always)] + #[inline] fn translate(&mut self, t: &Vec1) { *self = *self + *t } } impl> Translatable, Vec1> for Vec1 { - #[inline(always)] + #[inline] fn translated(&self, t: &Vec1) -> Vec1 { self + *t } } impl> Dot for Vec1 { - #[inline(always)] + #[inline] fn dot(&self, other : &Vec1) -> N { self.x * other.x } } impl + Sub> SubDot for Vec1 { - #[inline(always)] + #[inline] fn sub_dot(&self, a: &Vec1, b: &Vec1) -> N { (self.x - a.x) * b.x } } @@ -126,19 +126,19 @@ impl + Sub> SubDot for Vec1 impl + Add + Div + Algebraic> Norm for Vec1 { - #[inline(always)] + #[inline] fn sqnorm(&self) -> N { self.dot(self) } - #[inline(always)] + #[inline] fn norm(&self) -> N { self.sqnorm().sqrt() } - #[inline(always)] + #[inline] fn normalized(&self) -> Vec1 { Vec1::new(self.x / self.norm()) } - #[inline(always)] + #[inline] fn normalize(&mut self) -> N { let l = self.norm(); @@ -151,84 +151,84 @@ Norm for Vec1 impl> Neg> for Vec1 { - #[inline(always)] + #[inline] fn neg(&self) -> Vec1 { Vec1::new(-self.x) } } impl Zero for Vec1 { - #[inline(always)] + #[inline] fn zero() -> Vec1 { let _0 = Zero::zero(); Vec1::new(_0) } - #[inline(always)] + #[inline] fn is_zero(&self) -> bool { self.x.is_zero() } } impl Basis for Vec1 { - #[inline(always)] + #[inline] fn canonical_basis() -> ~[Vec1] { ~[ Vec1::new(One::one()) ] } // FIXME: this should be static - #[inline(always)] + #[inline] fn orthogonal_subspace_basis(&self) -> ~[Vec1] { ~[] } } impl> ApproxEq for Vec1 { - #[inline(always)] + #[inline] fn approx_epsilon() -> N { ApproxEq::approx_epsilon::() } - #[inline(always)] + #[inline] fn approx_eq(&self, other: &Vec1) -> bool { self.x.approx_eq(&other.x) } - #[inline(always)] + #[inline] fn approx_eq_eps(&self, other: &Vec1, epsilon: &N) -> bool { self.x.approx_eq_eps(&other.x, epsilon) } } impl Rand for Vec1 { - #[inline(always)] + #[inline] fn rand(rng: &mut R) -> Vec1 { Vec1::new(rng.gen()) } } impl Flatten for Vec1 { - #[inline(always)] + #[inline] fn flat_size() -> uint { 1 } - #[inline(always)] + #[inline] fn from_flattened(l: &[N], off: uint) -> Vec1 { Vec1::new(copy l[off]) } - #[inline(always)] + #[inline] fn flatten(&self) -> ~[N] { ~[ copy self.x ] } - #[inline(always)] + #[inline] fn flatten_to(&self, l: &mut [N], off: uint) { l[off] = copy self.x } } impl Bounded for Vec1 { - #[inline(always)] + #[inline] fn max_value() -> Vec1 { Vec1::new(Bounded::max_value()) } - #[inline(always)] + #[inline] fn min_value() -> Vec1 { Vec1::new(Bounded::min_value()) } } diff --git a/src/dim2/mat2.rs b/src/dim2/mat2.rs index 4fa77af6..5f46855c 100644 --- a/src/dim2/mat2.rs +++ b/src/dim2/mat2.rs @@ -18,7 +18,7 @@ pub struct Mat2 impl Mat2 { - #[inline(always)] + #[inline] pub fn new(m11: N, m12: N, m21: N, m22: N) -> Mat2 { Mat2 @@ -31,14 +31,14 @@ impl Mat2 impl Dim for Mat2 { - #[inline(always)] + #[inline] fn dim() -> uint { 2 } } impl One for Mat2 { - #[inline(always)] + #[inline] fn one() -> Mat2 { let (_0, _1) = (Zero::zero(), One::one()); @@ -49,7 +49,7 @@ impl One for Mat2 impl Zero for Mat2 { - #[inline(always)] + #[inline] fn zero() -> Mat2 { let _0 = Zero::zero(); @@ -57,7 +57,7 @@ impl Zero for Mat2 copy _0, _0) } - #[inline(always)] + #[inline] fn is_zero(&self) -> bool { self.m11.is_zero() && self.m12.is_zero() && @@ -67,7 +67,7 @@ impl Zero for Mat2 impl + Add> Mul, Mat2> for Mat2 { - #[inline(always)] + #[inline] fn mul(&self, other: &Mat2) -> Mat2 { Mat2::new( @@ -81,7 +81,7 @@ impl + Add> Mul, Mat2> for Mat2 impl + Mul> RMul> for Mat2 { - #[inline(always)] + #[inline] fn rmul(&self, other: &Vec2) -> Vec2 { Vec2::new( @@ -93,7 +93,7 @@ impl + Mul> RMul> for Mat2 impl + Mul> LMul> for Mat2 { - #[inline(always)] + #[inline] fn lmul(&self, other: &Vec2) -> Vec2 { Vec2::new( @@ -106,7 +106,7 @@ impl + Mul> LMul> for Mat2 impl + Div + Sub + Neg + Zero> Inv for Mat2 { - #[inline(always)] + #[inline] fn inverse(&self) -> Mat2 { let mut res : Mat2 = copy *self; @@ -116,7 +116,7 @@ Inv for Mat2 res } - #[inline(always)] + #[inline] fn invert(&mut self) { let det = self.m11 * self.m22 - self.m21 * self.m12; @@ -130,25 +130,25 @@ Inv for Mat2 impl Transpose for Mat2 { - #[inline(always)] + #[inline] fn transposed(&self) -> Mat2 { Mat2::new(copy self.m11, copy self.m21, copy self.m12, copy self.m22) } - #[inline(always)] + #[inline] fn transpose(&mut self) { swap(&mut self.m21, &mut self.m12); } } impl> ApproxEq for Mat2 { - #[inline(always)] + #[inline] fn approx_epsilon() -> N { ApproxEq::approx_epsilon::() } - #[inline(always)] + #[inline] fn approx_eq(&self, other: &Mat2) -> bool { self.m11.approx_eq(&other.m11) && @@ -158,7 +158,7 @@ impl> ApproxEq for Mat2 self.m22.approx_eq(&other.m22) } - #[inline(always)] + #[inline] fn approx_eq_eps(&self, other: &Mat2, epsilon: &N) -> bool { self.m11.approx_eq_eps(&other.m11, epsilon) && @@ -171,26 +171,26 @@ impl> ApproxEq for Mat2 impl Rand for Mat2 { - #[inline(always)] + #[inline] fn rand(rng: &mut R) -> Mat2 { Mat2::new(rng.gen(), rng.gen(), rng.gen(), rng.gen()) } } impl Flatten for Mat2 { - #[inline(always)] + #[inline] fn flat_size() -> uint { 4 } - #[inline(always)] + #[inline] fn from_flattened(l: &[N], off: uint) -> Mat2 { Mat2::new(copy l[off], copy l[off + 1], copy l[off + 2], copy l[off + 3]) } - #[inline(always)] + #[inline] fn flatten(&self) -> ~[N] { ~[ copy self.m11, copy self.m12, copy self.m21, copy self.m22 ] } - #[inline(always)] + #[inline] fn flatten_to(&self, l: &mut [N], off: uint) { l[off] = copy self.m11; diff --git a/src/dim2/vec2.rs b/src/dim2/vec2.rs index fbddbe23..6b7c478e 100644 --- a/src/dim2/vec2.rs +++ b/src/dim2/vec2.rs @@ -21,28 +21,28 @@ pub struct Vec2 impl Vec2 { - #[inline(always)] + #[inline] pub fn new(x: N, y: N) -> Vec2 { Vec2 {x: x, y: y} } } impl Dim for Vec2 { - #[inline(always)] + #[inline] fn dim() -> uint { 2 } } impl> Add, Vec2> for Vec2 { - #[inline(always)] + #[inline] fn add(&self, other: &Vec2) -> Vec2 { Vec2::new(self.x + other.x, self.y + other.y) } } impl> Sub, Vec2> for Vec2 { - #[inline(always)] + #[inline] fn sub(&self, other: &Vec2) -> Vec2 { Vec2::new(self.x - other.x, self.y - other.y) } } @@ -50,11 +50,11 @@ impl> Sub, Vec2> for Vec2 impl> ScalarMul for Vec2 { - #[inline(always)] + #[inline] fn scalar_mul(&self, s: &N) -> Vec2 { Vec2 { x: self.x * *s, y: self.y * *s } } - #[inline(always)] + #[inline] fn scalar_mul_inplace(&mut self, s: &N) { self.x = self.x * *s; @@ -66,11 +66,11 @@ ScalarMul for Vec2 impl> ScalarDiv for Vec2 { - #[inline(always)] + #[inline] fn scalar_div(&self, s: &N) -> Vec2 { Vec2 { x: self.x / *s, y: self.y / *s } } - #[inline(always)] + #[inline] fn scalar_div_inplace(&mut self, s: &N) { self.x = self.x / *s; @@ -81,11 +81,11 @@ ScalarDiv for Vec2 impl> ScalarAdd for Vec2 { - #[inline(always)] + #[inline] fn scalar_add(&self, s: &N) -> Vec2 { Vec2 { x: self.x + *s, y: self.y + *s } } - #[inline(always)] + #[inline] fn scalar_add_inplace(&mut self, s: &N) { self.x = self.x + *s; @@ -96,11 +96,11 @@ ScalarAdd for Vec2 impl> ScalarSub for Vec2 { - #[inline(always)] + #[inline] fn scalar_sub(&self, s: &N) -> Vec2 { Vec2 { x: self.x - *s, y: self.y - *s } } - #[inline(always)] + #[inline] fn scalar_sub_inplace(&mut self, s: &N) { self.x = self.x - *s; @@ -110,32 +110,32 @@ ScalarSub for Vec2 impl> Translation> for Vec2 { - #[inline(always)] + #[inline] fn translation(&self) -> Vec2 { copy *self } - #[inline(always)] + #[inline] fn translate(&mut self, t: &Vec2) { *self = *self + *t; } } impl> Translatable, Vec2> for Vec2 { - #[inline(always)] + #[inline] fn translated(&self, t: &Vec2) -> Vec2 { self + *t } } impl + Add> Dot for Vec2 { - #[inline(always)] + #[inline] fn dot(&self, other : &Vec2) -> N { self.x * other.x + self.y * other.y } } impl + Add + Sub> SubDot for Vec2 { - #[inline(always)] + #[inline] fn sub_dot(&self, a: &Vec2, b: &Vec2) -> N { (self.x - a.x) * b.x + (self.y - a.y) * b.y } } @@ -143,15 +143,15 @@ impl + Add + Sub> SubDot for Vec2 impl + Add + Div + Algebraic> Norm for Vec2 { - #[inline(always)] + #[inline] fn sqnorm(&self) -> N { self.dot(self) } - #[inline(always)] + #[inline] fn norm(&self) -> N { self.sqnorm().sqrt() } - #[inline(always)] + #[inline] fn normalized(&self) -> Vec2 { let l = self.norm(); @@ -159,7 +159,7 @@ Norm for Vec2 Vec2::new(self.x / l, self.y / l) } - #[inline(always)] + #[inline] fn normalize(&mut self) -> N { let l = self.norm(); @@ -173,32 +173,32 @@ Norm for Vec2 impl + Sub> Cross> for Vec2 { - #[inline(always)] + #[inline] fn cross(&self, other : &Vec2) -> Vec1 { Vec1::new(self.x * other.y - self.y * other.x) } } impl> Neg> for Vec2 { - #[inline(always)] + #[inline] fn neg(&self) -> Vec2 { Vec2::new(-self.x, -self.y) } } impl Zero for Vec2 { - #[inline(always)] + #[inline] fn zero() -> Vec2 { Vec2::new(Zero::zero(), Zero::zero()) } - #[inline(always)] + #[inline] fn is_zero(&self) -> bool { self.x.is_zero() && self.y.is_zero() } } impl> Basis for Vec2 { - #[inline(always)] + #[inline] fn canonical_basis() -> ~[Vec2] { // FIXME: this should be static @@ -206,22 +206,22 @@ impl> Basis for Vec2 Vec2::new(Zero::zero(), One::one()) ] } - #[inline(always)] + #[inline] fn orthogonal_subspace_basis(&self) -> ~[Vec2] { ~[ Vec2::new(-self.y, copy self.x) ] } } impl> ApproxEq for Vec2 { - #[inline(always)] + #[inline] fn approx_epsilon() -> N { ApproxEq::approx_epsilon::() } - #[inline(always)] + #[inline] fn approx_eq(&self, other: &Vec2) -> bool { self.x.approx_eq(&other.x) && self.y.approx_eq(&other.y) } - #[inline(always)] + #[inline] fn approx_eq_eps(&self, other: &Vec2, epsilon: &N) -> bool { self.x.approx_eq_eps(&other.x, epsilon) && @@ -231,26 +231,26 @@ impl> ApproxEq for Vec2 impl Rand for Vec2 { - #[inline(always)] + #[inline] fn rand(rng: &mut R) -> Vec2 { Vec2::new(rng.gen(), rng.gen()) } } impl Flatten for Vec2 { - #[inline(always)] + #[inline] fn flat_size() -> uint { 2 } - #[inline(always)] + #[inline] fn from_flattened(l: &[N], off: uint) -> Vec2 { Vec2::new(copy l[off], copy l[off + 1]) } - #[inline(always)] + #[inline] fn flatten(&self) -> ~[N] { ~[ copy self.x, copy self.y ] } - #[inline(always)] + #[inline] fn flatten_to(&self, l: &mut [N], off: uint) { l[off] = copy self.x; @@ -260,11 +260,11 @@ impl Flatten for Vec2 impl Bounded for Vec2 { - #[inline(always)] + #[inline] fn max_value() -> Vec2 { Vec2::new(Bounded::max_value(), Bounded::max_value()) } - #[inline(always)] + #[inline] fn min_value() -> Vec2 { Vec2::new(Bounded::min_value(), Bounded::min_value()) } } diff --git a/src/dim3/mat3.rs b/src/dim3/mat3.rs index 87bea4b1..6e105c37 100644 --- a/src/dim3/mat3.rs +++ b/src/dim3/mat3.rs @@ -19,7 +19,7 @@ pub struct Mat3 impl Mat3 { - #[inline(always)] + #[inline] pub fn new(m11: N, m12: N, m13: N, m21: N, m22: N, m23: N, m31: N, m32: N, m33: N) -> Mat3 @@ -35,14 +35,14 @@ impl Mat3 impl Dim for Mat3 { - #[inline(always)] + #[inline] fn dim() -> uint { 3 } } impl One for Mat3 { - #[inline(always)] + #[inline] fn one() -> Mat3 { let (_0, _1) = (Zero::zero(), One::one()); @@ -54,7 +54,7 @@ impl One for Mat3 impl Zero for Mat3 { - #[inline(always)] + #[inline] fn zero() -> Mat3 { let _0 = Zero::zero(); @@ -63,7 +63,7 @@ impl Zero for Mat3 copy _0, copy _0, _0) } - #[inline(always)] + #[inline] fn is_zero(&self) -> bool { self.m11.is_zero() && self.m12.is_zero() && self.m13.is_zero() && @@ -74,7 +74,7 @@ impl Zero for Mat3 impl + Add> Mul, Mat3> for Mat3 { - #[inline(always)] + #[inline] fn mul(&self, other: &Mat3) -> Mat3 { Mat3::new( @@ -95,7 +95,7 @@ impl + Add> Mul, Mat3> for Mat3 impl + Mul> RMul> for Mat3 { - #[inline(always)] + #[inline] fn rmul(&self, other: &Vec3) -> Vec3 { Vec3::new( @@ -108,7 +108,7 @@ impl + Mul> RMul> for Mat3 impl + Mul> LMul> for Mat3 { - #[inline(always)] + #[inline] fn lmul(&self, other: &Vec3) -> Vec3 { Vec3::new( @@ -122,7 +122,7 @@ impl + Mul> LMul> for Mat3 impl + Div + Sub + Add + Neg + Zero> Inv for Mat3 { - #[inline(always)] + #[inline] fn inverse(&self) -> Mat3 { let mut res = copy *self; @@ -132,7 +132,7 @@ Inv for Mat3 res } - #[inline(always)] + #[inline] fn invert(&mut self) { let minor_m22_m33 = self.m22 * self.m33 - self.m32 * self.m23; @@ -163,7 +163,7 @@ Inv for Mat3 impl Transpose for Mat3 { - #[inline(always)] + #[inline] fn transposed(&self) -> Mat3 { Mat3::new(copy self.m11, copy self.m21, copy self.m31, @@ -171,7 +171,7 @@ impl Transpose for Mat3 copy self.m13, copy self.m23, copy self.m33) } - #[inline(always)] + #[inline] fn transpose(&mut self) { swap(&mut self.m12, &mut self.m21); @@ -182,11 +182,11 @@ impl Transpose for Mat3 impl> ApproxEq for Mat3 { - #[inline(always)] + #[inline] fn approx_epsilon() -> N { ApproxEq::approx_epsilon::() } - #[inline(always)] + #[inline] fn approx_eq(&self, other: &Mat3) -> bool { self.m11.approx_eq(&other.m11) && @@ -202,7 +202,7 @@ impl> ApproxEq for Mat3 self.m33.approx_eq(&other.m33) } - #[inline(always)] + #[inline] fn approx_eq_eps(&self, other: &Mat3, epsilon: &N) -> bool { self.m11.approx_eq_eps(&other.m11, epsilon) && @@ -221,7 +221,7 @@ impl> ApproxEq for Mat3 impl Rand for Mat3 { - #[inline(always)] + #[inline] fn rand(rng: &mut R) -> Mat3 { Mat3::new(rng.gen(), rng.gen(), rng.gen(), @@ -232,17 +232,17 @@ impl Rand for Mat3 impl Flatten for Mat3 { - #[inline(always)] + #[inline] fn flat_size() -> uint { 9 } - #[inline(always)] + #[inline] fn from_flattened(l: &[N], off: uint) -> Mat3 { Mat3::new(copy l[off + 0], copy l[off + 1], copy l[off + 2], copy l[off + 3], copy l[off + 4], copy l[off + 5], copy l[off + 6], copy l[off + 7], copy l[off + 8]) } - #[inline(always)] + #[inline] fn flatten(&self) -> ~[N] { ~[ @@ -252,7 +252,7 @@ impl Flatten for Mat3 ] } - #[inline(always)] + #[inline] fn flatten_to(&self, l: &mut [N], off: uint) { l[off + 0] = copy self.m11; diff --git a/src/dim3/vec3.rs b/src/dim3/vec3.rs index 42054899..d6ded216 100644 --- a/src/dim3/vec3.rs +++ b/src/dim3/vec3.rs @@ -21,28 +21,28 @@ pub struct Vec3 impl Vec3 { - #[inline(always)] + #[inline] pub fn new(x: N, y: N, z: N) -> Vec3 { Vec3 {x: x, y: y, z: z} } } impl Dim for Vec3 { - #[inline(always)] + #[inline] fn dim() -> uint { 3 } } impl> Add, Vec3> for Vec3 { - #[inline(always)] + #[inline] fn add(&self, other: &Vec3) -> Vec3 { Vec3::new(self.x + other.x, self.y + other.y, self.z + other.z) } } impl> Sub, Vec3> for Vec3 { - #[inline(always)] + #[inline] fn sub(&self, other: &Vec3) -> Vec3 { Vec3::new(self.x - other.x, self.y - other.y, self.z - other.z) } } @@ -50,11 +50,11 @@ impl> Sub, Vec3> for Vec3 impl> ScalarMul for Vec3 { - #[inline(always)] + #[inline] fn scalar_mul(&self, s: &N) -> Vec3 { Vec3 { x: self.x * *s, y: self.y * *s, z: self.z * *s } } - #[inline(always)] + #[inline] fn scalar_mul_inplace(&mut self, s: &N) { self.x = self.x * *s; @@ -67,11 +67,11 @@ ScalarMul for Vec3 impl> ScalarDiv for Vec3 { - #[inline(always)] + #[inline] fn scalar_div(&self, s: &N) -> Vec3 { Vec3 { x: self.x / *s, y: self.y / *s, z: self.z / *s } } - #[inline(always)] + #[inline] fn scalar_div_inplace(&mut self, s: &N) { self.x = self.x / *s; @@ -83,11 +83,11 @@ ScalarDiv for Vec3 impl> ScalarAdd for Vec3 { - #[inline(always)] + #[inline] fn scalar_add(&self, s: &N) -> Vec3 { Vec3 { x: self.x + *s, y: self.y + *s, z: self.z + *s } } - #[inline(always)] + #[inline] fn scalar_add_inplace(&mut self, s: &N) { self.x = self.x + *s; @@ -99,11 +99,11 @@ ScalarAdd for Vec3 impl> ScalarSub for Vec3 { - #[inline(always)] + #[inline] fn scalar_sub(&self, s: &N) -> Vec3 { Vec3 { x: self.x - *s, y: self.y - *s, z: self.z - *s } } - #[inline(always)] + #[inline] fn scalar_sub_inplace(&mut self, s: &N) { self.x = self.x - *s; @@ -114,18 +114,18 @@ ScalarSub for Vec3 impl> Translation> for Vec3 { - #[inline(always)] + #[inline] fn translation(&self) -> Vec3 { copy *self } - #[inline(always)] + #[inline] fn translate(&mut self, t: &Vec3) { *self = *self + *t; } } impl> Translatable, Vec3> for Vec3 { - #[inline(always)] + #[inline] fn translated(&self, t: &Vec3) -> Vec3 { self + *t } } @@ -134,21 +134,21 @@ impl> Translatable, Vec3> for Vec3 impl> Neg> for Vec3 { - #[inline(always)] + #[inline] fn neg(&self) -> Vec3 { Vec3::new(-self.x, -self.y, -self.z) } } impl + Add> Dot for Vec3 { - #[inline(always)] + #[inline] fn dot(&self, other : &Vec3) -> N { self.x * other.x + self.y * other.y + self.z * other.z } } impl + Add + Sub> SubDot for Vec3 { - #[inline(always)] + #[inline] fn sub_dot(&self, a: &Vec3, b: &Vec3) -> N { (self.x - a.x) * b.x + (self.y - a.y) * b.y + (self.z - a.z) * b.z } } @@ -156,15 +156,15 @@ impl + Add + Sub> SubDot for Vec3 impl + Add + Div + Algebraic> Norm for Vec3 { - #[inline(always)] + #[inline] fn sqnorm(&self) -> N { self.dot(self) } - #[inline(always)] + #[inline] fn norm(&self) -> N { self.sqnorm().sqrt() } - #[inline(always)] + #[inline] fn normalized(&self) -> Vec3 { let l = self.norm(); @@ -172,7 +172,7 @@ Norm for Vec3 Vec3::new(self.x / l, self.y / l, self.z / l) } - #[inline(always)] + #[inline] fn normalize(&mut self) -> N { let l = self.norm(); @@ -187,7 +187,7 @@ Norm for Vec3 impl + Sub> Cross> for Vec3 { - #[inline(always)] + #[inline] fn cross(&self, other : &Vec3) -> Vec3 { Vec3::new( @@ -200,11 +200,11 @@ impl + Sub> Cross> for Vec3 impl Zero for Vec3 { - #[inline(always)] + #[inline] fn zero() -> Vec3 { Vec3::new(Zero::zero(), Zero::zero(), Zero::zero()) } - #[inline(always)] + #[inline] fn is_zero(&self) -> bool { self.x.is_zero() && self.y.is_zero() && self.z.is_zero() } } @@ -213,7 +213,7 @@ impl + Ord + Mul + Sub + Add + Div + Algebraic> Basis for Vec3 { - #[inline(always)] + #[inline] fn canonical_basis() -> ~[Vec3] { // FIXME: this should be static @@ -222,7 +222,7 @@ Basis for Vec3 Vec3::new(Zero::zero(), Zero::zero(), One::one()) ] } - #[inline(always)] + #[inline] fn orthogonal_subspace_basis(&self) -> ~[Vec3] { let a = @@ -237,11 +237,11 @@ Basis for Vec3 impl> ApproxEq for Vec3 { - #[inline(always)] + #[inline] fn approx_epsilon() -> N { ApproxEq::approx_epsilon::() } - #[inline(always)] + #[inline] fn approx_eq(&self, other: &Vec3) -> bool { self.x.approx_eq(&other.x) && @@ -249,7 +249,7 @@ impl> ApproxEq for Vec3 self.z.approx_eq(&other.z) } - #[inline(always)] + #[inline] fn approx_eq_eps(&self, other: &Vec3, epsilon: &N) -> bool { self.x.approx_eq_eps(&other.x, epsilon) && @@ -260,26 +260,26 @@ impl> ApproxEq for Vec3 impl Rand for Vec3 { - #[inline(always)] + #[inline] fn rand(rng: &mut R) -> Vec3 { Vec3::new(rng.gen(), rng.gen(), rng.gen()) } } impl Flatten for Vec3 { - #[inline(always)] + #[inline] fn flat_size() -> uint { 3 } - #[inline(always)] + #[inline] fn from_flattened(l: &[N], off: uint) -> Vec3 { Vec3::new(copy l[off], copy l[off + 1], copy l[off + 2]) } - #[inline(always)] + #[inline] fn flatten(&self) -> ~[N] { ~[ copy self.x, copy self.y, copy self.z ] } - #[inline(always)] + #[inline] fn flatten_to(&self, l: &mut [N], off: uint) { l[off] = copy self.x; @@ -290,11 +290,11 @@ impl Flatten for Vec3 impl Bounded for Vec3 { - #[inline(always)] + #[inline] fn max_value() -> Vec3 { Vec3::new(Bounded::max_value(), Bounded::max_value(), Bounded::max_value()) } - #[inline(always)] + #[inline] fn min_value() -> Vec3 { Vec3::new(Bounded::min_value(), Bounded::min_value(), Bounded::min_value()) } } diff --git a/src/ndim/dmat.rs b/src/ndim/dmat.rs index fcbb669e..fdeba343 100644 --- a/src/ndim/dmat.rs +++ b/src/ndim/dmat.rs @@ -16,15 +16,15 @@ pub struct DMat mij: ~[N] } -#[inline(always)] +#[inline] pub fn zero_mat_with_dim(dim: uint) -> DMat { DMat { dim: dim, mij: from_elem(dim * dim, Zero::zero()) } } -#[inline(always)] +#[inline] pub fn is_zero_mat(mat: &DMat) -> bool { mat.mij.iter().all(|e| e.is_zero()) } -#[inline(always)] +#[inline] pub fn one_mat_with_dim(dim: uint) -> DMat { let mut res = zero_mat_with_dim(dim); @@ -38,11 +38,11 @@ pub fn one_mat_with_dim(dim: uint) -> DMat impl DMat { - #[inline(always)] + #[inline] pub fn offset(&self, i: uint, j: uint) -> uint { i * self.dim + j } - #[inline(always)] + #[inline] pub fn set(&mut self, i: uint, j: uint, t: &N) { assert!(i < self.dim); @@ -50,7 +50,7 @@ impl DMat self.mij[self.offset(i, j)] = copy *t } - #[inline(always)] + #[inline] pub fn at(&self, i: uint, j: uint) -> N { assert!(i < self.dim); @@ -61,7 +61,7 @@ impl DMat impl Index<(uint, uint), N> for DMat { - #[inline(always)] + #[inline] fn index(&self, &(i, j): &(uint, uint)) -> N { self.at(i, j) } } @@ -136,7 +136,7 @@ LMul> for DMat impl Inv for DMat { - #[inline(always)] + #[inline] fn inverse(&self) -> DMat { let mut res : DMat = self.clone(); @@ -225,7 +225,7 @@ Inv for DMat impl Transpose for DMat { - #[inline(always)] + #[inline] fn transposed(&self) -> DMat { let mut res = copy *self; @@ -254,11 +254,11 @@ impl Transpose for DMat impl> ApproxEq for DMat { - #[inline(always)] + #[inline] fn approx_epsilon() -> N { ApproxEq::approx_epsilon::() } - #[inline(always)] + #[inline] fn approx_eq(&self, other: &DMat) -> bool { let mut zip = self.mij.iter().zip(other.mij.iter()); @@ -266,7 +266,7 @@ impl> ApproxEq for DMat do zip.all |(a, b)| { a.approx_eq(b) } } - #[inline(always)] + #[inline] fn approx_eq_eps(&self, other: &DMat, epsilon: &N) -> bool { let mut zip = self.mij.iter().zip(other.mij.iter()); diff --git a/src/ndim/dvec.rs b/src/ndim/dvec.rs index 09bb8e89..0d2c180e 100644 --- a/src/ndim/dvec.rs +++ b/src/ndim/dvec.rs @@ -17,11 +17,11 @@ pub struct DVec at: ~[N] } -#[inline(always)] +#[inline] pub fn zero_vec_with_dim(dim: uint) -> DVec { DVec { at: from_elem(dim, Zero::zero::()) } } -#[inline(always)] +#[inline] pub fn is_zero_vec(vec: &DVec) -> bool { vec.at.iter().all(|e| e.is_zero()) } @@ -79,7 +79,7 @@ impl> DVec impl> Add, DVec> for DVec { - #[inline(always)] + #[inline] fn add(&self, other: &DVec) -> DVec { assert!(self.at.len() == other.at.len()); @@ -89,7 +89,7 @@ impl> Add, DVec> for DVec impl> Sub, DVec> for DVec { - #[inline(always)] + #[inline] fn sub(&self, other: &DVec) -> DVec { assert!(self.at.len() == other.at.len()); @@ -99,7 +99,7 @@ impl> Sub, DVec> for DVec impl> Neg> for DVec { - #[inline(always)] + #[inline] fn neg(&self) -> DVec { DVec { at: map(self.at, |a| -a) } } } @@ -107,7 +107,7 @@ impl> Neg> for DVec impl Dot for DVec { - #[inline(always)] + #[inline] fn dot(&self, other: &DVec) -> N { assert!(self.at.len() == other.at.len()); @@ -123,7 +123,7 @@ Dot for DVec impl SubDot for DVec { - #[inline(always)] + #[inline] fn sub_dot(&self, a: &DVec, b: &DVec) -> N { let mut res = Zero::zero::(); @@ -138,11 +138,11 @@ impl SubDot for DVec impl> ScalarMul for DVec { - #[inline(always)] + #[inline] fn scalar_mul(&self, s: &N) -> DVec { DVec { at: map(self.at, |a| a * *s) } } - #[inline(always)] + #[inline] fn scalar_mul_inplace(&mut self, s: &N) { for iterate(0u, self.at.len()) |i| @@ -154,11 +154,11 @@ ScalarMul for DVec impl> ScalarDiv for DVec { - #[inline(always)] + #[inline] fn scalar_div(&self, s: &N) -> DVec { DVec { at: map(self.at, |a| a / *s) } } - #[inline(always)] + #[inline] fn scalar_div_inplace(&mut self, s: &N) { for iterate(0u, self.at.len()) |i| @@ -169,11 +169,11 @@ ScalarDiv for DVec impl> ScalarAdd for DVec { - #[inline(always)] + #[inline] fn scalar_add(&self, s: &N) -> DVec { DVec { at: map(self.at, |a| a + *s) } } - #[inline(always)] + #[inline] fn scalar_add_inplace(&mut self, s: &N) { for iterate(0u, self.at.len()) |i| @@ -184,11 +184,11 @@ ScalarAdd for DVec impl> ScalarSub for DVec { - #[inline(always)] + #[inline] fn scalar_sub(&self, s: &N) -> DVec { DVec { at: map(self.at, |a| a - *s) } } - #[inline(always)] + #[inline] fn scalar_sub_inplace(&mut self, s: &N) { for iterate(0u, self.at.len()) |i| @@ -198,18 +198,18 @@ ScalarSub for DVec impl> Translation> for DVec { - #[inline(always)] + #[inline] fn translation(&self) -> DVec { self.clone() } - #[inline(always)] + #[inline] fn translate(&mut self, t: &DVec) { *self = *self + *t; } } impl + Copy> Translatable, DVec> for DVec { - #[inline(always)] + #[inline] fn translated(&self, t: &DVec) -> DVec { self + *t } } @@ -217,15 +217,15 @@ impl + Copy> Translatable, DVec> for DVec impl Norm for DVec { - #[inline(always)] + #[inline] fn sqnorm(&self) -> N { self.dot(self) } - #[inline(always)] + #[inline] fn norm(&self) -> N { self.sqnorm().sqrt() } - #[inline(always)] + #[inline] fn normalized(&self) -> DVec { let mut res : DVec = self.clone(); @@ -235,7 +235,7 @@ Norm for DVec res } - #[inline(always)] + #[inline] fn normalize(&mut self) -> N { let l = self.norm(); @@ -249,11 +249,11 @@ Norm for DVec impl> ApproxEq for DVec { - #[inline(always)] + #[inline] fn approx_epsilon() -> N { ApproxEq::approx_epsilon::() } - #[inline(always)] + #[inline] fn approx_eq(&self, other: &DVec) -> bool { let mut zip = self.at.iter().zip(other.at.iter()); @@ -261,7 +261,7 @@ impl> ApproxEq for DVec do zip.all |(a, b)| { a.approx_eq(b) } } - #[inline(always)] + #[inline] fn approx_eq_eps(&self, other: &DVec, epsilon: &N) -> bool { let mut zip = self.at.iter().zip(other.at.iter()); diff --git a/src/ndim/nmat.rs b/src/ndim/nmat.rs index 1fcf5bb5..42b6b3d8 100644 --- a/src/ndim/nmat.rs +++ b/src/ndim/nmat.rs @@ -21,43 +21,43 @@ pub struct NMat impl NMat { - #[inline(always)] + #[inline] fn offset(i: uint, j: uint) -> uint { i * Dim::dim::() + j } - #[inline(always)] + #[inline] fn set(&mut self, i: uint, j: uint, t: &N) { self.mij.set(i, j, t) } } impl Dim for NMat { - #[inline(always)] + #[inline] fn dim() -> uint { Dim::dim::() } } impl Index<(uint, uint), N> for NMat { - #[inline(always)] + #[inline] fn index(&self, &idx: &(uint, uint)) -> N { self.mij[idx] } } impl One for NMat { - #[inline(always)] + #[inline] fn one() -> NMat { NMat { mij: one_mat_with_dim(Dim::dim::()) } } } impl Zero for NMat { - #[inline(always)] + #[inline] fn zero() -> NMat { NMat { mij: zero_mat_with_dim(Dim::dim::()) } } - #[inline(always)] + #[inline] fn is_zero(&self) -> bool { is_zero_mat(&self.mij) } } @@ -126,18 +126,18 @@ LMul> for NMat impl Inv for NMat { - #[inline(always)] + #[inline] fn inverse(&self) -> NMat { NMat { mij: self.mij.inverse() } } - #[inline(always)] + #[inline] fn invert(&mut self) { self.mij.invert() } } impl Transpose for NMat { - #[inline(always)] + #[inline] fn transposed(&self) -> NMat { let mut res = copy *self; @@ -147,22 +147,22 @@ impl Transpose for NMat res } - #[inline(always)] + #[inline] fn transpose(&mut self) { self.mij.transpose() } } impl> ApproxEq for NMat { - #[inline(always)] + #[inline] fn approx_epsilon() -> N { ApproxEq::approx_epsilon::() } - #[inline(always)] + #[inline] fn approx_eq(&self, other: &NMat) -> bool { self.mij.approx_eq(&other.mij) } - #[inline(always)] + #[inline] fn approx_eq_eps(&self, other: &NMat, epsilon: &N) -> bool { self.mij.approx_eq_eps(&other.mij, epsilon) } } @@ -186,11 +186,11 @@ impl Rand for NMat impl Flatten for NMat { - #[inline(always)] + #[inline] fn flat_size() -> uint { Dim::dim::() * Dim::dim::() } - #[inline(always)] + #[inline] fn from_flattened(l: &[N], off: uint) -> NMat { let dim = Dim::dim::(); @@ -202,7 +202,7 @@ impl Flatten for NMat res } - #[inline(always)] + #[inline] fn flatten(&self) -> ~[N] { let dim = Dim::dim::(); @@ -214,7 +214,7 @@ impl Flatten for NMat res } - #[inline(always)] + #[inline] fn flatten_to(&self, l: &mut [N], off: uint) { let dim = Dim::dim::(); diff --git a/src/ndim/nvec.rs b/src/ndim/nvec.rs index 93a1b309..935d0952 100644 --- a/src/ndim/nvec.rs +++ b/src/ndim/nvec.rs @@ -26,35 +26,35 @@ pub struct NVec impl Dim for NVec { - #[inline(always)] + #[inline] fn dim() -> uint { Dim::dim::() } } impl Clone for NVec { - #[inline(always)] + #[inline] fn clone(&self) -> NVec { NVec{ at: self.at.clone() } } } impl> Add, NVec> for NVec { - #[inline(always)] + #[inline] fn add(&self, other: &NVec) -> NVec { NVec { at: self.at + other.at } } } impl> Sub, NVec> for NVec { - #[inline(always)] + #[inline] fn sub(&self, other: &NVec) -> NVec { NVec { at: self.at - other.at } } } impl> Neg> for NVec { - #[inline(always)] + #[inline] fn neg(&self) -> NVec { NVec { at: -self.at } } } @@ -62,14 +62,14 @@ impl> Neg> for NVec impl Dot for NVec { - #[inline(always)] + #[inline] fn dot(&self, other: &NVec) -> N { self.at.dot(&other.at) } } impl SubDot for NVec { - #[inline(always)] + #[inline] fn sub_dot(&self, a: &NVec, b: &NVec) -> N { self.at.sub_dot(&a.at, &b.at) } } @@ -77,11 +77,11 @@ impl SubDot for NVec impl> ScalarMul for NVec { - #[inline(always)] + #[inline] fn scalar_mul(&self, s: &N) -> NVec { NVec { at: self.at.scalar_mul(s) } } - #[inline(always)] + #[inline] fn scalar_mul_inplace(&mut self, s: &N) { self.at.scalar_mul_inplace(s) } } @@ -90,11 +90,11 @@ ScalarMul for NVec impl> ScalarDiv for NVec { - #[inline(always)] + #[inline] fn scalar_div(&self, s: &N) -> NVec { NVec { at: self.at.scalar_div(s) } } - #[inline(always)] + #[inline] fn scalar_div_inplace(&mut self, s: &N) { self.at.scalar_div_inplace(s) } } @@ -102,11 +102,11 @@ ScalarDiv for NVec impl> ScalarAdd for NVec { - #[inline(always)] + #[inline] fn scalar_add(&self, s: &N) -> NVec { NVec { at: self.at.scalar_add(s) } } - #[inline(always)] + #[inline] fn scalar_add_inplace(&mut self, s: &N) { self.at.scalar_add_inplace(s) } } @@ -114,29 +114,29 @@ ScalarAdd for NVec impl> ScalarSub for NVec { - #[inline(always)] + #[inline] fn scalar_sub(&self, s: &N) -> NVec { NVec { at: self.at.scalar_sub(s) } } - #[inline(always)] + #[inline] fn scalar_sub_inplace(&mut self, s: &N) { self.at.scalar_sub_inplace(s) } } impl> Translation> for NVec { - #[inline(always)] + #[inline] fn translation(&self) -> NVec { self.clone() } - #[inline(always)] + #[inline] fn translate(&mut self, t: &NVec) { *self = *self + *t; } } impl + Copy> Translatable, NVec> for NVec { - #[inline(always)] + #[inline] fn translated(&self, t: &NVec) -> NVec { self + *t } } @@ -144,15 +144,15 @@ impl + Copy> Translatable, NVec> for NVec< impl Norm for NVec { - #[inline(always)] + #[inline] fn sqnorm(&self) -> N { self.at.sqnorm() } - #[inline(always)] + #[inline] fn norm(&self) -> N { self.at.norm() } - #[inline(always)] + #[inline] fn normalized(&self) -> NVec { let mut res : NVec = self.clone(); @@ -162,7 +162,7 @@ Norm for NVec res } - #[inline(always)] + #[inline] fn normalize(&mut self) -> N { self.at.normalize() } } @@ -171,11 +171,11 @@ impl> Basis for NVec { - #[inline(always)] + #[inline] fn canonical_basis() -> ~[NVec] { map(DVec::canonical_basis_with_dim(Dim::dim::()), |&e| NVec { at: e }) } - #[inline(always)] + #[inline] fn orthogonal_subspace_basis(&self) -> ~[NVec] { map(self.at.orthogonal_subspace_basis(), |&e| NVec { at: e }) } } @@ -190,33 +190,33 @@ Basis for NVec impl Zero for NVec { - #[inline(always)] + #[inline] fn zero() -> NVec { NVec { at: zero_vec_with_dim(Dim::dim::()) } } - #[inline(always)] + #[inline] fn is_zero(&self) -> bool { is_zero_vec(&self.at) } } impl> ApproxEq for NVec { - #[inline(always)] + #[inline] fn approx_epsilon() -> N { ApproxEq::approx_epsilon::() } - #[inline(always)] + #[inline] fn approx_eq(&self, other: &NVec) -> bool { self.at.approx_eq(&other.at) } - #[inline(always)] + #[inline] fn approx_eq_eps(&self, other: &NVec, epsilon: &N) -> bool { self.at.approx_eq_eps(&other.at, epsilon) } } impl Rand for NVec { - #[inline(always)] + #[inline] fn rand(rng: &mut R) -> NVec { let dim = Dim::dim::(); @@ -231,11 +231,11 @@ impl Rand for NVec impl Flatten for NVec { - #[inline(always)] + #[inline] fn flat_size() -> uint { Dim::dim::() } - #[inline(always)] + #[inline] fn from_flattened(l: &[N], off: uint) -> NVec { let dim = Dim::dim::(); @@ -247,7 +247,7 @@ impl Flatten for NVec res } - #[inline(always)] + #[inline] fn flatten(&self) -> ~[N] { let dim = Dim::dim::(); @@ -259,7 +259,7 @@ impl Flatten for NVec res } - #[inline(always)] + #[inline] fn flatten_to(&self, l: &mut [N], off: uint) { let dim = Dim::dim::(); @@ -271,11 +271,11 @@ impl Flatten for NVec impl + Copy> Bounded for NVec { - #[inline(always)] + #[inline] fn max_value() -> NVec { Zero::zero::>().scalar_add(&Bounded::max_value()) } - #[inline(always)] + #[inline] fn min_value() -> NVec { Zero::zero::>().scalar_add(&Bounded::min_value()) } } diff --git a/src/traits/rotation.rs b/src/traits/rotation.rs index 101da942..c8660650 100644 --- a/src/traits/rotation.rs +++ b/src/traits/rotation.rs @@ -26,7 +26,7 @@ pub trait Rotatable> * - `ammount`: the rotation to apply. * - `point`: the center of rotation. */ -#[inline(always)] +#[inline] pub fn rotate_wrt_point, M2: Rotation + Translation, LV: Neg,