diff options
author | Gael Guennebaud <g.gael@free.fr> | 2008-07-31 21:03:11 +0000 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2008-07-31 21:03:11 +0000 |
commit | b32b186c14c7c9abdde1217d9d6b5b7d7cac532b (patch) | |
tree | eb8867cb97ea3156961098ba5a5b82493b003793 /Eigen/src/Array | |
parent | 842c4f8bfa51008ab13919225f95b56e6cbcc655 (diff) |
removed the packet specializations of some functors
(GCC generates better code without those "optimizations")
Diffstat (limited to 'Eigen/src/Array')
-rw-r--r-- | Eigen/src/Array/Functors.h | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/Eigen/src/Array/Functors.h b/Eigen/src/Array/Functors.h index 3357f145d..5b53a9cee 100644 --- a/Eigen/src/Array/Functors.h +++ b/Eigen/src/Array/Functors.h @@ -25,19 +25,21 @@ #ifndef EIGEN_ARRAY_FUNCTORS_H #define EIGEN_ARRAY_FUNCTORS_H +/** \internal + * \array_module + * + * \brief Template functor to add a scalar to a fixed other one + * + * \sa class CwiseUnaryOp, Array::operator+ + */ +/* If you wonder why doing the ei_pset1() in packetOp() is an optimization check ei_scalar_multiple_op */ template<typename Scalar> -struct ei_scalar_add_op<Scalar,true> { +struct ei_scalar_add_op { typedef typename ei_packet_traits<Scalar>::type PacketScalar; - inline ei_scalar_add_op(const Scalar& other) : m_other(ei_pset1(other)) { } - inline Scalar operator() (const Scalar& a) const { return a + ei_pfirst(m_other); } - inline const PacketScalar packetOp(const PacketScalar& a) const - { return ei_padd(a, m_other); } - const PacketScalar m_other; -}; -template<typename Scalar> -struct ei_scalar_add_op<Scalar,false> { inline ei_scalar_add_op(const Scalar& other) : m_other(other) { } inline Scalar operator() (const Scalar& a) const { return a + m_other; } + inline const PacketScalar packetOp(const PacketScalar& a) const + { return ei_padd(a, ei_pset1(m_other)); } const Scalar m_other; }; template<typename Scalar> |