aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/geo_transformations.cpp
diff options
context:
space:
mode:
authorGravatar Christoph Hertzberg <chtz@informatik.uni-bremen.de>2016-05-27 11:13:38 +0200
committerGravatar Christoph Hertzberg <chtz@informatik.uni-bremen.de>2016-05-27 11:13:38 +0200
commitf2c86384f447057377ac5ae0e0261a4486862d88 (patch)
tree198aa88a0075d837b341f1db6e929194aaf6d96b /test/geo_transformations.cpp
parent22a035db9583a84c0b9be885e54cac847dbaa654 (diff)
Cleaner implementation of dont_over_optimize.
Diffstat (limited to 'test/geo_transformations.cpp')
-rw-r--r--test/geo_transformations.cpp5
1 files changed, 3 insertions, 2 deletions
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<T,2,1> angleToVec(T a)
}
// This permits to workaround a bug in clang/llvm code generation.
+template<typename T>
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<typename Scalar, int Mode, int Options> void non_projective_only()
{
@@ -228,7 +229,7 @@ template<typename Scalar, int Mode, int Options> void transformations()
do {
v3 = Vector3::Random();
- dont_over_optimize(&v3);
+ dont_over_optimize(v3);
} while (v3.cwiseAbs().minCoeff()<NumTraits<Scalar>::epsilon());
Translation3 tv3(v3);
Transform3 t5(tv3);