From 326b22ac3392c888a898b959d947c6e6a7ba8f3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Crozet?= Date: Tue, 16 Aug 2016 13:35:17 +0200 Subject: [PATCH] Fix benchmarks. --- benches/construction.rs | 6 +++--- src/structs/vectorn_macros.rs | 9 +++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/benches/construction.rs b/benches/construction.rs index 8afef416..cc4179d0 100644 --- a/benches/construction.rs +++ b/benches/construction.rs @@ -11,9 +11,9 @@ use na::{UnitQuaternion, Rotation2, Rotation3, Vector1, Vector3}; #[path="common/macros.rs"] mod macros; -bench_construction!(_bench_quaternion_from_axisangle, UnitQuaternion::new, axisangle: Vector3); +bench_construction!(_bench_quaternion_from_axisangle, UnitQuaternion::from_scaled_axis, axisangle: Vector3); bench_construction!(_bench_rot2_from_axisangle, Rotation2::new, axisangle: Vector1); bench_construction!(_bench_rot3_from_axisangle, Rotation3::new, axisangle: Vector3); -bench_construction!(_bench_quaternion_from_euler_angles, UnitQuaternion::new_with_euler_angles, roll: f32, pitch: f32, yaw: f32); -bench_construction!(_bench_rot3_from_euler_angles, Rotation3::new_with_euler_angles, roll: f32, pitch: f32, yaw: f32); +bench_construction!(_bench_quaternion_from_euler_angles, UnitQuaternion::from_euler_angles, roll: f32, pitch: f32, yaw: f32); +bench_construction!(_bench_rot3_from_euler_angles, Rotation3::from_euler_angles, roll: f32, pitch: f32, yaw: f32); diff --git a/src/structs/vectorn_macros.rs b/src/structs/vectorn_macros.rs index f6f81188..74749375 100644 --- a/src/structs/vectorn_macros.rs +++ b/src/structs/vectorn_macros.rs @@ -253,6 +253,15 @@ macro_rules! vecn_dvec_common_impl( } } + impl<'a, N: Copy + Div + Zero $(, $param : ArrayLength)*> Div<$vecn> for &'a $vecn { + type Output = $vecn; + + #[inline] + fn div(self, right: $vecn) -> $vecn { + self.clone() / right + } + } + impl<'a, N: Copy + Div + Zero $(, $param : ArrayLength)*> Div for &'a $vecn { type Output = $vecn;