From 534dcbe017164c1c649e1b9cfa41433ed4fee8dd Mon Sep 17 00:00:00 2001 From: Sayed Adel Date: Fri, 2 Feb 2018 03:31:25 +0000 Subject: [PATCH] core:ppc Fix compile issue with Eigen --- .../core/include/opencv2/core/vsx_utils.hpp | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/modules/core/include/opencv2/core/vsx_utils.hpp b/modules/core/include/opencv2/core/vsx_utils.hpp index 3888cbfcdf..aca534a7c3 100644 --- a/modules/core/include/opencv2/core/vsx_utils.hpp +++ b/modules/core/include/opencv2/core/vsx_utils.hpp @@ -47,6 +47,10 @@ #include "opencv2/core/cvdef.h" +#ifndef SKIP_INCLUDES +# include +#endif + //! @addtogroup core_utils_vsx //! @{ #if CV_VSX @@ -520,6 +524,27 @@ VSX_IMPL_CONV_EVEN_2_4(vec_float4, vec_udword2, vec_ctf, vec_ctfo) VSX_IMPL_CONV_EVEN_2_4(vec_int4, vec_double2, vec_cts, vec_ctso) VSX_IMPL_CONV_EVEN_2_4(vec_uint4, vec_double2, vec_ctu, vec_ctuo) +// Only for Eigen! +/* + * changing behavior of conversion intrinsics for gcc has effect on Eigen + * so we redfine old behavior again only on gcc, clang +*/ +#if !defined(__clang__) || __clang_major__ > 4 + // ignoring second arg since Eigen only truncates toward zero +# define VSX_IMPL_CONV_2VARIANT(rt, rg, fnm, fn2) \ + VSX_FINLINE(rt) fnm(const rg& a, int only_truncate) \ + { \ + assert(only_truncate == 0); \ + (void)only_truncate; \ + return fn2(a); \ + } + VSX_IMPL_CONV_2VARIANT(vec_int4, vec_float4, vec_cts, vec_cts) + VSX_IMPL_CONV_2VARIANT(vec_float4, vec_int4, vec_ctf, vec_ctf) + // define vec_cts for converting double precision to signed doubleword + // which isn't combitable with xlc but its okay since Eigen only use it for gcc + VSX_IMPL_CONV_2VARIANT(vec_dword2, vec_double2, vec_cts, vec_ctsl) +#endif // Eigen + #endif // Common GCC, CLANG compatibility /*