Workaround clang/llvm bug in code generation.

This commit is contained in:
Gael Guennebaud 2016-05-24 21:55:46 +02:00
parent e68e165a23
commit 0fd953c217

View File

@ -18,6 +18,10 @@ Matrix<T,2,1> angleToVec(T a)
return Matrix<T,2,1>(std::cos(a), std::sin(a));
}
// This permits to workaround a bug in clang/llvm code generation.
EIGEN_DONT_INLINE
void dont_over_optimize(void* x) { *(int*)(x) = (*(int*)(x))&0xFFFF000 | (*(int*)(x))&0x0000FFFF; }
template<typename Scalar, int Mode, int Options> void non_projective_only()
{
/* this test covers the following files:
@ -224,12 +228,13 @@ template<typename Scalar, int Mode, int Options> void transformations()
do {
v3 = Vector3::Random();
dont_over_optimize(&v3);
} while (v3.cwiseAbs().minCoeff()<NumTraits<Scalar>::epsilon());
Translation3 tv3(v3);
Transform3 t5(tv3);
t4 = tv3;
VERIFY_IS_APPROX(t5.matrix(), t4.matrix());
t4.translate(-v3);
t4.translate((-v3).eval());
VERIFY_IS_APPROX(t4.matrix(), MatrixType::Identity());
t4 *= tv3;
VERIFY_IS_APPROX(t5.matrix(), t4.matrix());