mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-04-19 08:09:36 +08:00
Workaround clang/llvm bug in code generation.
This commit is contained in:
parent
e68e165a23
commit
0fd953c217
@ -18,6 +18,10 @@ Matrix<T,2,1> angleToVec(T a)
|
|||||||
return Matrix<T,2,1>(std::cos(a), std::sin(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()
|
template<typename Scalar, int Mode, int Options> void non_projective_only()
|
||||||
{
|
{
|
||||||
/* this test covers the following files:
|
/* this test covers the following files:
|
||||||
@ -224,12 +228,13 @@ template<typename Scalar, int Mode, int Options> void transformations()
|
|||||||
|
|
||||||
do {
|
do {
|
||||||
v3 = Vector3::Random();
|
v3 = Vector3::Random();
|
||||||
|
dont_over_optimize(&v3);
|
||||||
} while (v3.cwiseAbs().minCoeff()<NumTraits<Scalar>::epsilon());
|
} while (v3.cwiseAbs().minCoeff()<NumTraits<Scalar>::epsilon());
|
||||||
Translation3 tv3(v3);
|
Translation3 tv3(v3);
|
||||||
Transform3 t5(tv3);
|
Transform3 t5(tv3);
|
||||||
t4 = tv3;
|
t4 = tv3;
|
||||||
VERIFY_IS_APPROX(t5.matrix(), t4.matrix());
|
VERIFY_IS_APPROX(t5.matrix(), t4.matrix());
|
||||||
t4.translate(-v3);
|
t4.translate((-v3).eval());
|
||||||
VERIFY_IS_APPROX(t4.matrix(), MatrixType::Identity());
|
VERIFY_IS_APPROX(t4.matrix(), MatrixType::Identity());
|
||||||
t4 *= tv3;
|
t4 *= tv3;
|
||||||
VERIFY_IS_APPROX(t5.matrix(), t4.matrix());
|
VERIFY_IS_APPROX(t5.matrix(), t4.matrix());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user