aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/Core/Swap.h
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2015-03-31 20:16:02 +0200
committerGravatar Gael Guennebaud <g.gael@free.fr>2015-03-31 20:16:02 +0200
commit20d030f207a8f92d75e8e4aca9d515b9939aa58a (patch)
treedd25a1fcb1b5820814f0a788f80da2682a360270 /Eigen/src/Core/Swap.h
parent678207e02a35e32f2098fcb2cb8a510c9ee191e1 (diff)
Fix vectorization of swap for non trivial expressions
Diffstat (limited to 'Eigen/src/Core/Swap.h')
-rw-r--r--Eigen/src/Core/Swap.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/Eigen/src/Core/Swap.h b/Eigen/src/Core/Swap.h
index dcb42821f..3880f7b78 100644
--- a/Eigen/src/Core/Swap.h
+++ b/Eigen/src/Core/Swap.h
@@ -38,13 +38,17 @@ public:
template<int StoreMode, int LoadMode>
void assignPacket(Index row, Index col)
{
- m_functor.template swapPacket<StoreMode,LoadMode,PacketScalar>(&m_dst.coeffRef(row,col), &const_cast<SrcEvaluatorTypeT&>(m_src).coeffRef(row,col));
+ PacketScalar tmp = m_src.template packet<LoadMode>(row,col);
+ const_cast<SrcEvaluatorTypeT&>(m_src).template writePacket<LoadMode>(row,col, m_dst.template packet<StoreMode>(row,col));
+ m_dst.template writePacket<StoreMode>(row,col,tmp);
}
template<int StoreMode, int LoadMode>
void assignPacket(Index index)
{
- m_functor.template swapPacket<StoreMode,LoadMode,PacketScalar>(&m_dst.coeffRef(index), &const_cast<SrcEvaluatorTypeT&>(m_src).coeffRef(index));
+ PacketScalar tmp = m_src.template packet<LoadMode>(index);
+ const_cast<SrcEvaluatorTypeT&>(m_src).template writePacket<LoadMode>(index, m_dst.template packet<StoreMode>(index));
+ m_dst.template writePacket<StoreMode>(index,tmp);
}
// TODO find a simple way not to have to copy/paste this function from generic_dense_assignment_kernel, by simple I mean no CRTP (Gael)