Merge pull request #150 from Connorcpu/macro-fix

Fixed macros with missing semicolons
This commit is contained in:
Brendan Zabarauskas 2014-12-20 11:57:29 +11:00
commit 0375cc3a6d
11 changed files with 123 additions and 123 deletions

View file

@ -36,7 +36,7 @@ macro_rules! bench_binop(
})
}
}
)
);
macro_rules! bench_binop_deref(
($name: ident, $t1: ty, $t2: ty, $binop: ident) => {
@ -59,7 +59,7 @@ macro_rules! bench_binop_deref(
})
}
}
)
);
macro_rules! bench_unop(
($name: ident, $t: ty, $unop: ident) => {
@ -81,7 +81,7 @@ macro_rules! bench_unop(
})
}
}
)
);
macro_rules! bench_construction(
($name: ident, $t: ty, $constructor: path $(, $args: ident: $types: ty)*) => {
@ -104,4 +104,4 @@ macro_rules! bench_construction(
})
}
}
)
);

View file

@ -54,7 +54,7 @@ fn _bench_rot3_from_axisangle(bh: &mut Bencher) {
bench_from_axis_angle::<Basis3<f32>>(bh)
}
bench_construction!(_bench_rot2_from_axisangle, Basis2<f32>, Rotation2::from_angle, angle: Rad<f32>)
bench_construction!(_bench_rot2_from_axisangle, Basis2<f32>, Rotation2::from_angle, angle: Rad<f32>);
bench_construction!(_bench_quat_from_euler_angles, Quaternion<f32>, Rotation3::from_euler, roll: Rad<f32>, pitch: Rad<f32>, yaw: Rad<f32>)
bench_construction!(_bench_rot3_from_euler_angles, Basis3<f32>, Rotation3::from_euler, roll: Rad<f32>, pitch: Rad<f32>, yaw: Rad<f32>)
bench_construction!(_bench_quat_from_euler_angles, Quaternion<f32>, Rotation3::from_euler, roll: Rad<f32>, pitch: Rad<f32>, yaw: Rad<f32>);
bench_construction!(_bench_rot3_from_euler_angles, Basis3<f32>, Rotation3::from_euler, roll: Rad<f32>, pitch: Rad<f32>, yaw: Rad<f32>);

View file

@ -26,34 +26,34 @@ use cgmath::*;
#[path="common/macros.rs"]
mod macros;
bench_binop!(_bench_matrix2_mul_m, Matrix2<f32>, Matrix2<f32>, mul_m)
bench_binop!(_bench_matrix3_mul_m, Matrix3<f32>, Matrix3<f32>, mul_m)
bench_binop!(_bench_matrix4_mul_m, Matrix4<f32>, Matrix4<f32>, mul_m)
bench_binop!(_bench_matrix2_mul_m, Matrix2<f32>, Matrix2<f32>, mul_m);
bench_binop!(_bench_matrix3_mul_m, Matrix3<f32>, Matrix3<f32>, mul_m);
bench_binop!(_bench_matrix4_mul_m, Matrix4<f32>, Matrix4<f32>, mul_m);
bench_binop!(_bench_matrix2_add_m, Matrix2<f32>, Matrix2<f32>, add_m)
bench_binop!(_bench_matrix3_add_m, Matrix3<f32>, Matrix3<f32>, add_m)
bench_binop!(_bench_matrix4_add_m, Matrix4<f32>, Matrix4<f32>, add_m)
bench_binop!(_bench_matrix2_add_m, Matrix2<f32>, Matrix2<f32>, add_m);
bench_binop!(_bench_matrix3_add_m, Matrix3<f32>, Matrix3<f32>, add_m);
bench_binop!(_bench_matrix4_add_m, Matrix4<f32>, Matrix4<f32>, add_m);
bench_binop!(_bench_matrix2_sub_m, Matrix2<f32>, Matrix2<f32>, sub_m)
bench_binop!(_bench_matrix3_sub_m, Matrix3<f32>, Matrix3<f32>, sub_m)
bench_binop!(_bench_matrix4_sub_m, Matrix4<f32>, Matrix4<f32>, sub_m)
bench_binop!(_bench_matrix2_sub_m, Matrix2<f32>, Matrix2<f32>, sub_m);
bench_binop!(_bench_matrix3_sub_m, Matrix3<f32>, Matrix3<f32>, sub_m);
bench_binop!(_bench_matrix4_sub_m, Matrix4<f32>, Matrix4<f32>, sub_m);
bench_binop!(_bench_matrix2_mul_v, Matrix2<f32>, Vector2<f32>, mul_v)
bench_binop!(_bench_matrix3_mul_v, Matrix3<f32>, Vector3<f32>, mul_v)
bench_binop!(_bench_matrix4_mul_v, Matrix4<f32>, Vector4<f32>, mul_v)
bench_binop!(_bench_matrix2_mul_v, Matrix2<f32>, Vector2<f32>, mul_v);
bench_binop!(_bench_matrix3_mul_v, Matrix3<f32>, Vector3<f32>, mul_v);
bench_binop!(_bench_matrix4_mul_v, Matrix4<f32>, Vector4<f32>, mul_v);
bench_binop_deref!(_bench_matrix2_mul_s, Matrix2<f32>, f32, mul_s)
bench_binop_deref!(_bench_matrix3_mul_s, Matrix3<f32>, f32, mul_s)
bench_binop_deref!(_bench_matrix4_mul_s, Matrix4<f32>, f32, mul_s)
bench_binop_deref!(_bench_matrix2_mul_s, Matrix2<f32>, f32, mul_s);
bench_binop_deref!(_bench_matrix3_mul_s, Matrix3<f32>, f32, mul_s);
bench_binop_deref!(_bench_matrix4_mul_s, Matrix4<f32>, f32, mul_s);
bench_binop_deref!(_bench_matrix2_div_s, Matrix2<f32>, f32, div_s)
bench_binop_deref!(_bench_matrix3_div_s, Matrix3<f32>, f32, div_s)
bench_binop_deref!(_bench_matrix4_div_s, Matrix4<f32>, f32, div_s)
bench_binop_deref!(_bench_matrix2_div_s, Matrix2<f32>, f32, div_s);
bench_binop_deref!(_bench_matrix3_div_s, Matrix3<f32>, f32, div_s);
bench_binop_deref!(_bench_matrix4_div_s, Matrix4<f32>, f32, div_s);
bench_unop!(_bench_matrix2_invert, Matrix2<f32>, invert)
bench_unop!(_bench_matrix3_invert, Matrix3<f32>, invert)
bench_unop!(_bench_matrix4_invert, Matrix4<f32>, invert)
bench_unop!(_bench_matrix2_invert, Matrix2<f32>, invert);
bench_unop!(_bench_matrix3_invert, Matrix3<f32>, invert);
bench_unop!(_bench_matrix4_invert, Matrix4<f32>, invert);
bench_unop!(_bench_matrix2_transpose, Matrix2<f32>, transpose)
bench_unop!(_bench_matrix3_transpose, Matrix3<f32>, transpose)
bench_unop!(_bench_matrix4_transpose, Matrix4<f32>, transpose)
bench_unop!(_bench_matrix2_transpose, Matrix2<f32>, transpose);
bench_unop!(_bench_matrix3_transpose, Matrix3<f32>, transpose);
bench_unop!(_bench_matrix4_transpose, Matrix4<f32>, transpose);

View file

@ -26,12 +26,12 @@ use cgmath::*;
#[path="common/macros.rs"]
mod macros;
bench_binop!(_bench_quat_add_q, Quaternion<f32>, Quaternion<f32>, add_q)
bench_binop!(_bench_quat_sub_q, Quaternion<f32>, Quaternion<f32>, sub_q)
bench_binop!(_bench_quat_mul_q, Quaternion<f32>, Quaternion<f32>, mul_q)
bench_binop!(_bench_quat_mul_v, Quaternion<f32>, Vector3<f32>, mul_v)
bench_binop_deref!(_bench_quat_mul_s, Quaternion<f32>, f32, mul_s)
bench_binop_deref!(_bench_quat_div_s, Quaternion<f32>, f32, div_s)
bench_unop!(_bench_quat_invert, Quaternion<f32>, invert)
bench_unop!(_bench_quat_conjugate, Quaternion<f32>, conjugate)
bench_unop!(_bench_quat_normalize, Quaternion<f32>, normalize)
bench_binop!(_bench_quat_add_q, Quaternion<f32>, Quaternion<f32>, add_q);
bench_binop!(_bench_quat_sub_q, Quaternion<f32>, Quaternion<f32>, sub_q);
bench_binop!(_bench_quat_mul_q, Quaternion<f32>, Quaternion<f32>, mul_q);
bench_binop!(_bench_quat_mul_v, Quaternion<f32>, Vector3<f32>, mul_v);
bench_binop_deref!(_bench_quat_mul_s, Quaternion<f32>, f32, mul_s);
bench_binop_deref!(_bench_quat_div_s, Quaternion<f32>, f32, div_s);
bench_unop!(_bench_quat_invert, Quaternion<f32>, invert);
bench_unop!(_bench_quat_conjugate, Quaternion<f32>, conjugate);
bench_unop!(_bench_quat_normalize, Quaternion<f32>, normalize);

View file

@ -26,49 +26,49 @@ use cgmath::*;
#[path="common/macros.rs"]
mod macros;
bench_binop!(_bench_vector2_add_v, Vector2<f32>, Vector2<f32>, add_v)
bench_binop!(_bench_vector3_add_v, Vector3<f32>, Vector3<f32>, add_v)
bench_binop!(_bench_vector4_add_v, Vector4<f32>, Vector4<f32>, add_v)
bench_binop!(_bench_vector2_add_v, Vector2<f32>, Vector2<f32>, add_v);
bench_binop!(_bench_vector3_add_v, Vector3<f32>, Vector3<f32>, add_v);
bench_binop!(_bench_vector4_add_v, Vector4<f32>, Vector4<f32>, add_v);
bench_binop!(_bench_vector2_sub_v, Vector2<f32>, Vector2<f32>, sub_v)
bench_binop!(_bench_vector3_sub_v, Vector3<f32>, Vector3<f32>, sub_v)
bench_binop!(_bench_vector4_sub_v, Vector4<f32>, Vector4<f32>, sub_v)
bench_binop!(_bench_vector2_sub_v, Vector2<f32>, Vector2<f32>, sub_v);
bench_binop!(_bench_vector3_sub_v, Vector3<f32>, Vector3<f32>, sub_v);
bench_binop!(_bench_vector4_sub_v, Vector4<f32>, Vector4<f32>, sub_v);
bench_binop!(_bench_vector2_mul_v, Vector2<f32>, Vector2<f32>, mul_v)
bench_binop!(_bench_vector3_mul_v, Vector3<f32>, Vector3<f32>, mul_v)
bench_binop!(_bench_vector4_mul_v, Vector4<f32>, Vector4<f32>, mul_v)
bench_binop!(_bench_vector2_mul_v, Vector2<f32>, Vector2<f32>, mul_v);
bench_binop!(_bench_vector3_mul_v, Vector3<f32>, Vector3<f32>, mul_v);
bench_binop!(_bench_vector4_mul_v, Vector4<f32>, Vector4<f32>, mul_v);
bench_binop!(_bench_vector2_div_v, Vector2<f32>, Vector2<f32>, div_v)
bench_binop!(_bench_vector3_div_v, Vector3<f32>, Vector3<f32>, div_v)
bench_binop!(_bench_vector4_div_v, Vector4<f32>, Vector4<f32>, div_v)
bench_binop!(_bench_vector2_div_v, Vector2<f32>, Vector2<f32>, div_v);
bench_binop!(_bench_vector3_div_v, Vector3<f32>, Vector3<f32>, div_v);
bench_binop!(_bench_vector4_div_v, Vector4<f32>, Vector4<f32>, div_v);
bench_binop_deref!(_bench_vector2_add_s, Vector2<f32>, f32, add_s)
bench_binop_deref!(_bench_vector3_add_s, Vector3<f32>, f32, add_s)
bench_binop_deref!(_bench_vector4_add_s, Vector4<f32>, f32, add_s)
bench_binop_deref!(_bench_vector2_add_s, Vector2<f32>, f32, add_s);
bench_binop_deref!(_bench_vector3_add_s, Vector3<f32>, f32, add_s);
bench_binop_deref!(_bench_vector4_add_s, Vector4<f32>, f32, add_s);
bench_binop_deref!(_bench_vector2_sub_s, Vector2<f32>, f32, sub_s)
bench_binop_deref!(_bench_vector3_sub_s, Vector3<f32>, f32, sub_s)
bench_binop_deref!(_bench_vector4_sub_s, Vector4<f32>, f32, sub_s)
bench_binop_deref!(_bench_vector2_sub_s, Vector2<f32>, f32, sub_s);
bench_binop_deref!(_bench_vector3_sub_s, Vector3<f32>, f32, sub_s);
bench_binop_deref!(_bench_vector4_sub_s, Vector4<f32>, f32, sub_s);
bench_binop_deref!(_bench_vector2_mul_s, Vector2<f32>, f32, mul_s)
bench_binop_deref!(_bench_vector3_mul_s, Vector3<f32>, f32, mul_s)
bench_binop_deref!(_bench_vector4_mul_s, Vector4<f32>, f32, mul_s)
bench_binop_deref!(_bench_vector2_mul_s, Vector2<f32>, f32, mul_s);
bench_binop_deref!(_bench_vector3_mul_s, Vector3<f32>, f32, mul_s);
bench_binop_deref!(_bench_vector4_mul_s, Vector4<f32>, f32, mul_s);
bench_binop_deref!(_bench_vector2_div_s, Vector2<f32>, f32, div_s)
bench_binop_deref!(_bench_vector3_div_s, Vector3<f32>, f32, div_s)
bench_binop_deref!(_bench_vector4_div_s, Vector4<f32>, f32, div_s)
bench_binop_deref!(_bench_vector2_div_s, Vector2<f32>, f32, div_s);
bench_binop_deref!(_bench_vector3_div_s, Vector3<f32>, f32, div_s);
bench_binop_deref!(_bench_vector4_div_s, Vector4<f32>, f32, div_s);
bench_binop!(_bench_vector2_dot, Vector2<f32>, Vector2<f32>, dot)
bench_binop!(_bench_vector3_dot, Vector3<f32>, Vector3<f32>, dot)
bench_binop!(_bench_vector4_dot, Vector4<f32>, Vector4<f32>, dot)
bench_binop!(_bench_vector2_dot, Vector2<f32>, Vector2<f32>, dot);
bench_binop!(_bench_vector3_dot, Vector3<f32>, Vector3<f32>, dot);
bench_binop!(_bench_vector4_dot, Vector4<f32>, Vector4<f32>, dot);
bench_binop!(_bench_vector3_cross, Vector3<f32>, Vector3<f32>, cross)
bench_binop!(_bench_vector3_cross, Vector3<f32>, Vector3<f32>, cross);
bench_unop!(_bench_vector2_norm, Vector2<f32>, length)
bench_unop!(_bench_vector3_norm, Vector3<f32>, length)
bench_unop!(_bench_vector4_norm, Vector4<f32>, length)
bench_unop!(_bench_vector2_norm, Vector2<f32>, length);
bench_unop!(_bench_vector3_norm, Vector3<f32>, length);
bench_unop!(_bench_vector4_norm, Vector4<f32>, length);
bench_unop!(_bench_vector2_normalize, Vector2<f32>, normalize)
bench_unop!(_bench_vector3_normalize, Vector3<f32>, normalize)
bench_unop!(_bench_vector4_normalize, Vector4<f32>, normalize)
bench_unop!(_bench_vector2_normalize, Vector2<f32>, normalize);
bench_unop!(_bench_vector3_normalize, Vector3<f32>, normalize);
bench_unop!(_bench_vector4_normalize, Vector4<f32>, normalize);

View file

@ -39,10 +39,10 @@ macro_rules! approx_float(
}
}
)
)
);
approx_float!(f32)
approx_float!(f64)
approx_float!(f32);
approx_float!(f64);
#[macro_export]
macro_rules! assert_approx_eq_eps(
@ -52,10 +52,10 @@ macro_rules! assert_approx_eq_eps(
if !given_val.approx_eq_eps(expected_val, eps) {
panic!("assertion failed: `left ≈ right` (left: `{}`, right: `{}`, tolerance: `{}`)",
*given_val, *expected_val, *eps
)
);
}
})
)
);
#[macro_export]
macro_rules! assert_approx_eq(
@ -65,7 +65,7 @@ macro_rules! assert_approx_eq(
panic!("assertion failed: `left ≈ right` (left: `{}`, right: `{}`, tolerance: `{}`)",
*given_val, *expected_val,
ApproxEq::approx_epsilon(Some(*given_val))
)
);
}
})
)
);

View file

@ -422,7 +422,7 @@ impl<S> FixedArray<[[S, ..2], ..2]> for Matrix2<S> {
// y: FixedArray::from_fixed(y),
// },
// }
panic!("Unimplemented, pending a fix for rust-lang/rust#16418")
panic!("Unimplemented, pending a fix for rust-lang/rust#16418");
}
#[inline]
@ -925,7 +925,7 @@ macro_rules! dot_matrix4(
($A[1][$I]) * ($B[$J][1]) +
($A[2][$I]) * ($B[$J][2]) +
($A[3][$I]) * ($B[$J][3])
))
));
impl<S: BaseFloat + 'static> Matrix<S, Vector4<S>> for Matrix4<S> {
#[inline]

View file

@ -32,18 +32,18 @@ macro_rules! partial_ord_int (
fn partial_max(self, other: $T) -> $T { cmp::max(self, other) }
}
)
)
);
partial_ord_int!(int)
partial_ord_int!(i8)
partial_ord_int!(i16)
partial_ord_int!(i32)
partial_ord_int!(i64)
partial_ord_int!(uint)
partial_ord_int!(u8)
partial_ord_int!(u16)
partial_ord_int!(u32)
partial_ord_int!(u64)
partial_ord_int!(int);
partial_ord_int!(i8);
partial_ord_int!(i16);
partial_ord_int!(i32);
partial_ord_int!(i64);
partial_ord_int!(uint);
partial_ord_int!(u8);
partial_ord_int!(u16);
partial_ord_int!(u32);
partial_ord_int!(u64);
macro_rules! partial_ord_float (
($T:ident) => (
@ -52,10 +52,10 @@ macro_rules! partial_ord_float (
fn partial_max(self, other: $T) -> $T { self.max(other) }
}
)
)
);
partial_ord_float!(f32)
partial_ord_float!(f64)
partial_ord_float!(f32);
partial_ord_float!(f64);
/// Additive neutral element
pub trait Zero {
@ -95,18 +95,18 @@ macro_rules! impl_basenum_int (
}
}
)
)
);
impl_basenum_int!(i8)
impl_basenum_int!(i16)
impl_basenum_int!(i32)
impl_basenum_int!(i64)
impl_basenum_int!(u8)
impl_basenum_int!(u16)
impl_basenum_int!(u32)
impl_basenum_int!(u64)
impl_basenum_int!(int)
impl_basenum_int!(uint)
impl_basenum_int!(i8);
impl_basenum_int!(i16);
impl_basenum_int!(i32);
impl_basenum_int!(i64);
impl_basenum_int!(u8);
impl_basenum_int!(u16);
impl_basenum_int!(u32);
impl_basenum_int!(u64);
impl_basenum_int!(int);
impl_basenum_int!(uint);
macro_rules! impl_basenum_float (
@ -128,10 +128,10 @@ macro_rules! impl_basenum_float (
}
}
)
)
);
impl_basenum_float!(f32)
impl_basenum_float!(f64)
impl_basenum_float!(f32);
impl_basenum_float!(f64);
pub fn zero<T: Zero>() -> T {
Zero::zero()

View file

@ -120,7 +120,7 @@ impl<S> FixedArray<[S, ..2]> for Point2<S> {
#[inline]
fn from_fixed(_v: [S, ..2]) -> Point2<S> {
// match v { [x, y] => Point2 { x: x, y: y } }
panic!("Unimplemented, pending a fix for rust-lang/rust#16418")
panic!("Unimplemented, pending a fix for rust-lang/rust#16418");
}
#[inline]

View file

@ -236,7 +236,7 @@ macro_rules! vec(
#[inline]
fn from_fixed(_v: [$S, ..$n]) -> $Self<$S> {
// match v { [$($field),+] => $Self { $($field: $field),+ } }
panic!("Unimplemented, pending a fix for rust-lang/rust#16418")
panic!("Unimplemented, pending a fix for rust-lang/rust#16418");
}
#[inline]
@ -335,7 +335,7 @@ macro_rules! vec(
}
}
)
)
);
macro_rules! fold {
(&$method:ident, { $x:expr, $y:expr }) => { $x.$method(&$y) };
@ -346,9 +346,9 @@ macro_rules! fold {
($method:ident, { $x:expr, $y:expr, $z:expr, $w:expr }) => { $x.$method($y).$method($z).$method($w) };
}
vec!(Vector2<S> { x, y }, 2)
vec!(Vector3<S> { x, y, z }, 3)
vec!(Vector4<S> { x, y, z, w }, 4)
vec!(Vector2<S> { x, y }, 2);
vec!(Vector3<S> { x, y, z }, 3);
vec!(Vector4<S> { x, y, z, w }, 4);
/// Operations specific to numeric two-dimensional vectors.
impl<S: BaseNum> Vector2<S> {

View file

@ -32,11 +32,11 @@ fn conv() {
#[test]
fn equiv() {
assert!(Deg::<f32>::full_turn().equiv(&-Deg::<f32>::full_turn()))
assert!(Deg::<f32>::turn_div_2().equiv(&-Deg::<f32>::turn_div_2()))
assert!(Deg::<f32>::turn_div_3().sub_a(Deg::<f32>::full_turn()).equiv(&Deg::<f32>::turn_div_3()))
assert!(Deg::<f32>::full_turn().equiv(&-Deg::<f32>::full_turn()));
assert!(Deg::<f32>::turn_div_2().equiv(&-Deg::<f32>::turn_div_2()));
assert!(Deg::<f32>::turn_div_3().sub_a(Deg::<f32>::full_turn()).equiv(&Deg::<f32>::turn_div_3()));
assert!(Rad::<f32>::full_turn().equiv(&-Rad::<f32>::full_turn()))
assert!(Rad::<f32>::turn_div_2().equiv(&-Rad::<f32>::turn_div_2()))
assert!(Rad::<f32>::turn_div_3().sub_a(Rad::<f32>::full_turn()).equiv(&Rad::<f32>::turn_div_3()))
assert!(Rad::<f32>::full_turn().equiv(&-Rad::<f32>::full_turn()));
assert!(Rad::<f32>::turn_div_2().equiv(&-Rad::<f32>::turn_div_2()));
assert!(Rad::<f32>::turn_div_3().sub_a(Rad::<f32>::full_turn()).equiv(&Rad::<f32>::turn_div_3()));
}