This bugzilla service is closed. All entries have been migrated to https://gitlab.com/libeigen/eigen
View | Details | Raw Unified | Return to bug 363 | Differences between
and this patch

Collapse All | Expand All

(-)a/Eigen/src/Core/PlainObjectBase.h (-1 / +1 lines)
Lines 30-46 Link Here
30
# define EIGEN_INITIALIZE_BY_ZERO_IF_THAT_OPTION_IS_ENABLED for(int i=0;i<base().size();++i) coeffRef(i)=Scalar(0);
30
# define EIGEN_INITIALIZE_BY_ZERO_IF_THAT_OPTION_IS_ENABLED for(int i=0;i<base().size();++i) coeffRef(i)=Scalar(0);
31
#else
31
#else
32
# define EIGEN_INITIALIZE_BY_ZERO_IF_THAT_OPTION_IS_ENABLED
32
# define EIGEN_INITIALIZE_BY_ZERO_IF_THAT_OPTION_IS_ENABLED
33
#endif
33
#endif
34
34
35
namespace internal {
35
namespace internal {
36
36
37
template<typename Index>
37
template<typename Index>
38
inline void check_rows_cols_for_overflow(Index rows, Index cols)
38
EIGEN_ALWAYS_INLINE void check_rows_cols_for_overflow(Index rows, Index cols)
39
{
39
{
40
  // http://hg.mozilla.org/mozilla-central/file/6c8a909977d3/xpcom/ds/CheckedInt.h#l242
40
  // http://hg.mozilla.org/mozilla-central/file/6c8a909977d3/xpcom/ds/CheckedInt.h#l242
41
  // we assume Index is signed
41
  // we assume Index is signed
42
  Index max_index = (size_t(1) << (8 * sizeof(Index) - 1)) - 1; // assume Index is signed
42
  Index max_index = (size_t(1) << (8 * sizeof(Index) - 1)) - 1; // assume Index is signed
43
  bool error = (rows < 0  || cols < 0)  ? true
43
  bool error = (rows < 0  || cols < 0)  ? true
44
             : (rows == 0 || cols == 0) ? false
44
             : (rows == 0 || cols == 0) ? false
45
                                        : (rows > max_index / cols);
45
                                        : (rows > max_index / cols);
46
  if (error)
46
  if (error)
(-)a/Eigen/src/Core/products/GeneralBlockPanelKernel.h (-2 / +2 lines)
Lines 113-136 inline void computeProductBlockingSizes( Link Here
113
113
114
#ifdef EIGEN_HAS_FUSE_CJMADD
114
#ifdef EIGEN_HAS_FUSE_CJMADD
115
  #define MADD(CJ,A,B,C,T)  C = CJ.pmadd(A,B,C);
115
  #define MADD(CJ,A,B,C,T)  C = CJ.pmadd(A,B,C);
116
#else
116
#else
117
117
118
  // FIXME (a bit overkill maybe ?)
118
  // FIXME (a bit overkill maybe ?)
119
119
120
  template<typename CJ, typename A, typename B, typename C, typename T> struct gebp_madd_selector {
120
  template<typename CJ, typename A, typename B, typename C, typename T> struct gebp_madd_selector {
121
    EIGEN_STRONG_INLINE EIGEN_ALWAYS_INLINE_ATTRIB static void run(const CJ& cj, A& a, B& b, C& c, T& /*t*/)
121
    EIGEN_ALWAYS_INLINE static void run(const CJ& cj, A& a, B& b, C& c, T& /*t*/)
122
    {
122
    {
123
      c = cj.pmadd(a,b,c);
123
      c = cj.pmadd(a,b,c);
124
    }
124
    }
125
  };
125
  };
126
126
127
  template<typename CJ, typename T> struct gebp_madd_selector<CJ,T,T,T,T> {
127
  template<typename CJ, typename T> struct gebp_madd_selector<CJ,T,T,T,T> {
128
    EIGEN_STRONG_INLINE EIGEN_ALWAYS_INLINE_ATTRIB static void run(const CJ& cj, T& a, T& b, T& c, T& t)
128
    EIGEN_ALWAYS_INLINE static void run(const CJ& cj, T& a, T& b, T& c, T& t)
129
    {
129
    {
130
      t = b; t = cj.pmul(a,t); c = padd(c,t);
130
      t = b; t = cj.pmul(a,t); c = padd(c,t);
131
    }
131
    }
132
  };
132
  };
133
133
134
  template<typename CJ, typename A, typename B, typename C, typename T>
134
  template<typename CJ, typename A, typename B, typename C, typename T>
135
  EIGEN_STRONG_INLINE void gebp_madd(const CJ& cj, A& a, B& b, C& c, T& t)
135
  EIGEN_STRONG_INLINE void gebp_madd(const CJ& cj, A& a, B& b, C& c, T& t)
136
  {
136
  {
(-)a/Eigen/src/Core/util/Macros.h (-13 / +16 lines)
Lines 125-165 Link Here
125
// concatenate two tokens
125
// concatenate two tokens
126
#define EIGEN_CAT2(a,b) a ## b
126
#define EIGEN_CAT2(a,b) a ## b
127
#define EIGEN_CAT(a,b) EIGEN_CAT2(a,b)
127
#define EIGEN_CAT(a,b) EIGEN_CAT2(a,b)
128
128
129
// convert a token to a string
129
// convert a token to a string
130
#define EIGEN_MAKESTRING2(a) #a
130
#define EIGEN_MAKESTRING2(a) #a
131
#define EIGEN_MAKESTRING(a) EIGEN_MAKESTRING2(a)
131
#define EIGEN_MAKESTRING(a) EIGEN_MAKESTRING2(a)
132
132
133
// EIGEN_ALWAYS_INLINE_ATTRIB should be use in the declaration of function
134
// which should be inlined even in debug mode.
135
// FIXME with the always_inline attribute,
136
// gcc 3.4.x reports the following compilation error:
137
//   Eval.h:91: sorry, unimplemented: inlining failed in call to 'const Eigen::Eval<Derived> Eigen::MatrixBase<Scalar, Derived>::eval() const'
138
//    : function body not available
139
#if EIGEN_GNUC_AT_LEAST(4,0)
140
#define EIGEN_ALWAYS_INLINE_ATTRIB __attribute__((always_inline))
141
#else
142
#define EIGEN_ALWAYS_INLINE_ATTRIB
143
#endif
144
145
#if EIGEN_GNUC_AT_LEAST(4,1) && !defined(__clang__) && !defined(__INTEL_COMPILER)
133
#if EIGEN_GNUC_AT_LEAST(4,1) && !defined(__clang__) && !defined(__INTEL_COMPILER)
146
#define EIGEN_FLATTEN_ATTRIB __attribute__((flatten))
134
#define EIGEN_FLATTEN_ATTRIB __attribute__((flatten))
147
#else
135
#else
148
#define EIGEN_FLATTEN_ATTRIB
136
#define EIGEN_FLATTEN_ATTRIB
149
#endif
137
#endif
150
138
151
// EIGEN_FORCE_INLINE means "inline as much as possible"
139
// EIGEN_STRONG_INLINE is a stronger version of the inline, using __forceinline on MSVC,
140
// but it still doesn't use GCC's always_inline. This is useful in (common) situations where MSVC needs forceinline
141
// but GCC is still doing fine with just inline.
152
#if (defined _MSC_VER) || (defined __INTEL_COMPILER)
142
#if (defined _MSC_VER) || (defined __INTEL_COMPILER)
153
#define EIGEN_STRONG_INLINE __forceinline
143
#define EIGEN_STRONG_INLINE __forceinline
154
#else
144
#else
155
#define EIGEN_STRONG_INLINE inline
145
#define EIGEN_STRONG_INLINE inline
156
#endif
146
#endif
157
147
148
// EIGEN_ALWAYS_INLINE is the stronget, it has the effect of making the function inline and adding every possible
149
// attribute to maximize inlining. This should only be used when really necessary: in particular,
150
// it uses __attribute__((always_inline)) on GCC, which most of the time is useless and can severely harm compile times.
151
// FIXME with the always_inline attribute,
152
// gcc 3.4.x reports the following compilation error:
153
//   Eval.h:91: sorry, unimplemented: inlining failed in call to 'const Eigen::Eval<Derived> Eigen::MatrixBase<Scalar, Derived>::eval() const'
154
//    : function body not available
155
#if EIGEN_GNUC_AT_LEAST(4,0)
156
#define EIGEN_ALWAYS_INLINE __attribute__((always_inline)) inline
157
#else
158
#define EIGEN_ALWAYS_INLINE EIGEN_STRONG_INLINE
159
#endif
160
158
#if (defined __GNUC__)
161
#if (defined __GNUC__)
159
#define EIGEN_DONT_INLINE __attribute__((noinline))
162
#define EIGEN_DONT_INLINE __attribute__((noinline))
160
#elif (defined _MSC_VER)
163
#elif (defined _MSC_VER)
161
#define EIGEN_DONT_INLINE __declspec(noinline)
164
#define EIGEN_DONT_INLINE __declspec(noinline)
162
#else
165
#else
163
#define EIGEN_DONT_INLINE
166
#define EIGEN_DONT_INLINE
164
#endif
167
#endif
165
168
(-)a/Eigen/src/Core/util/Memory.h (-1 / +1 lines)
Lines 349-365 template<typename T> inline void destruc Link Here
349
    while(size) ptr[--size].~T();
349
    while(size) ptr[--size].~T();
350
}
350
}
351
351
352
/*****************************************************************************
352
/*****************************************************************************
353
*** Implementation of aligned new/delete-like functions                    ***
353
*** Implementation of aligned new/delete-like functions                    ***
354
*****************************************************************************/
354
*****************************************************************************/
355
355
356
template<typename T>
356
template<typename T>
357
inline void check_size_for_overflow(size_t size)
357
EIGEN_ALWAYS_INLINE void check_size_for_overflow(size_t size)
358
{
358
{
359
  if(size > size_t(-1) / sizeof(T))
359
  if(size > size_t(-1) / sizeof(T))
360
    throw_std_bad_alloc();
360
    throw_std_bad_alloc();
361
}
361
}
362
362
363
/** \internal Allocates \a size objects of type T. The returned pointer is guaranteed to have 16 bytes alignment.
363
/** \internal Allocates \a size objects of type T. The returned pointer is guaranteed to have 16 bytes alignment.
364
  * On allocation error, the returned pointer is undefined, but a std::bad_alloc is thrown.
364
  * On allocation error, the returned pointer is undefined, but a std::bad_alloc is thrown.
365
  * The default constructor of T is called.
365
  * The default constructor of T is called.

Return to bug 363