From f2c86384f447057377ac5ae0e0261a4486862d88 Mon Sep 17 00:00:00 2001 From: Christoph Hertzberg Date: Fri, 27 May 2016 11:13:38 +0200 Subject: Cleaner implementation of dont_over_optimize. --- test/geo_transformations.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'test/geo_transformations.cpp') diff --git a/test/geo_transformations.cpp b/test/geo_transformations.cpp index cc82f6607..12a9aece1 100644 --- a/test/geo_transformations.cpp +++ b/test/geo_transformations.cpp @@ -19,8 +19,9 @@ Matrix angleToVec(T a) } // This permits to workaround a bug in clang/llvm code generation. +template EIGEN_DONT_INLINE -void dont_over_optimize(void* x) { *(int*)(x) = ((*(int*)(x))&0xFFFF0000) | ((*(int*)(x))&0x0000FFFF); } +void dont_over_optimize(T& x) { volatile typename T::Scalar tmp = x(0); x(0) = tmp; } template void non_projective_only() { @@ -228,7 +229,7 @@ template void transformations() do { v3 = Vector3::Random(); - dont_over_optimize(&v3); + dont_over_optimize(v3); } while (v3.cwiseAbs().minCoeff()::epsilon()); Translation3 tv3(v3); Transform3 t5(tv3); -- cgit v1.2.3