mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-01-24 14:45:14 +08:00
fix linking errors with multiply defined functions
This commit is contained in:
parent
9d4b16c1d1
commit
f0a6d56f07
@ -210,19 +210,24 @@ template<typename Packet> inline Packet ei_preverse(const Packet& a)
|
||||
***************************/
|
||||
|
||||
/** \internal \returns the sin of \a a (coeff-wise) */
|
||||
template<typename Packet> inline static Packet ei_psin(const Packet& a) { return ei_sin(a); }
|
||||
template<typename Packet> EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
|
||||
Packet ei_psin(const Packet& a) { return ei_sin(a); }
|
||||
|
||||
/** \internal \returns the cos of \a a (coeff-wise) */
|
||||
template<typename Packet> inline static Packet ei_pcos(const Packet& a) { return ei_cos(a); }
|
||||
template<typename Packet> EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
|
||||
Packet ei_pcos(const Packet& a) { return ei_cos(a); }
|
||||
|
||||
/** \internal \returns the exp of \a a (coeff-wise) */
|
||||
template<typename Packet> inline static Packet ei_pexp(const Packet& a) { return ei_exp(a); }
|
||||
template<typename Packet> EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
|
||||
Packet ei_pexp(const Packet& a) { return ei_exp(a); }
|
||||
|
||||
/** \internal \returns the log of \a a (coeff-wise) */
|
||||
template<typename Packet> inline static Packet ei_plog(const Packet& a) { return ei_log(a); }
|
||||
template<typename Packet> EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
|
||||
Packet ei_plog(const Packet& a) { return ei_log(a); }
|
||||
|
||||
/** \internal \returns the square-root of \a a (coeff-wise) */
|
||||
template<typename Packet> inline static Packet ei_psqrt(const Packet& a) { return ei_sqrt(a); }
|
||||
template<typename Packet> EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
|
||||
Packet ei_psqrt(const Packet& a) { return ei_sqrt(a); }
|
||||
|
||||
/***************************************************************************
|
||||
* The following functions might not have to be overwritten for vectorized types
|
||||
|
@ -30,7 +30,7 @@
|
||||
#ifndef EIGEN_MATH_FUNCTIONS_SSE_H
|
||||
#define EIGEN_MATH_FUNCTIONS_SSE_H
|
||||
|
||||
template<> EIGEN_DONT_INLINE EIGEN_UNUSED
|
||||
template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED
|
||||
Packet4f ei_plog<Packet4f>(const Packet4f& _x)
|
||||
{
|
||||
Packet4f x = _x;
|
||||
@ -110,7 +110,7 @@ Packet4f ei_plog<Packet4f>(const Packet4f& _x)
|
||||
return _mm_or_ps(x, invalid_mask); // negative arg will be NAN
|
||||
}
|
||||
|
||||
template<> EIGEN_DONT_INLINE EIGEN_UNUSED
|
||||
template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED
|
||||
Packet4f ei_pexp<Packet4f>(const Packet4f& _x)
|
||||
{
|
||||
Packet4f x = _x;
|
||||
@ -185,7 +185,7 @@ Packet4f ei_pexp<Packet4f>(const Packet4f& _x)
|
||||
surprising but correct result.
|
||||
*/
|
||||
|
||||
template<> EIGEN_DONT_INLINE EIGEN_UNUSED
|
||||
template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED
|
||||
Packet4f ei_psin<Packet4f>(const Packet4f& _x)
|
||||
{
|
||||
Packet4f x = _x;
|
||||
@ -286,7 +286,7 @@ Packet4f ei_psin<Packet4f>(const Packet4f& _x)
|
||||
}
|
||||
|
||||
/* almost the same as ei_psin */
|
||||
template<> EIGEN_DONT_INLINE EIGEN_UNUSED
|
||||
template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED
|
||||
Packet4f ei_pcos<Packet4f>(const Packet4f& _x)
|
||||
{
|
||||
Packet4f x = _x;
|
||||
@ -375,7 +375,7 @@ Packet4f ei_pcos<Packet4f>(const Packet4f& _x)
|
||||
|
||||
// This is Quake3's fast inverse square root.
|
||||
// For detail see here: http://www.beyond3d.com/content/articles/8/
|
||||
template<> EIGEN_UNUSED
|
||||
template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED
|
||||
Packet4f ei_psqrt<Packet4f>(const Packet4f& _x)
|
||||
{
|
||||
Packet4f half = ei_pmul(_x, ei_pset1(.5f));
|
||||
|
@ -162,6 +162,13 @@
|
||||
#define EIGEN_DONT_INLINE
|
||||
#endif
|
||||
|
||||
// this macro allows to get rid of linking errors about multiply defined functions.
|
||||
// - static is not very good because it prevents definitions from different object files to be merged.
|
||||
// So static causes the resulting linked executable to be bloated with multiple copies of the same function.
|
||||
// - inline is not perfect either as it unwantedly hints the compiler toward inlining the function.
|
||||
#define EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
|
||||
#define EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS inline
|
||||
|
||||
#if (defined __GNUC__)
|
||||
#define EIGEN_DEPRECATED __attribute__((deprecated))
|
||||
#elif (defined _MSC_VER)
|
||||
|
Loading…
Reference in New Issue
Block a user