aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/Core
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2008-04-09 18:04:26 +0000
committerGravatar Gael Guennebaud <g.gael@free.fr>2008-04-09 18:04:26 +0000
commit8f957564ec3e3657a3ff023a444a71e8903af4f3 (patch)
tree2736310d8c5ebe936cb51e26423de40278613633 /Eigen/src/Core
parentd95d952e92d5fa8612229cff9cf36b1effaa7435 (diff)
a better bugfix in ei_matrix_operator_equals_packet_unroller
Diffstat (limited to 'Eigen/src/Core')
-rw-r--r--Eigen/src/Core/OperatorEquals.h24
1 files changed, 9 insertions, 15 deletions
diff --git a/Eigen/src/Core/OperatorEquals.h b/Eigen/src/Core/OperatorEquals.h
index 4d0c4de3a..213c5f660 100644
--- a/Eigen/src/Core/OperatorEquals.h
+++ b/Eigen/src/Core/OperatorEquals.h
@@ -65,24 +65,24 @@ struct ei_matrix_operator_equals_unroller<Derived1, Derived2, Dynamic>
//----
-template<typename Derived1, typename Derived2, int UnrollCount>
+template<typename Derived1, typename Derived2, int Index>
struct ei_matrix_operator_equals_packet_unroller
{
enum {
- index = UnrollCount-ei_packet_traits<typename Derived1::Scalar>::size,
- row = Derived1::Flags&RowMajorBit ? index / Derived1::ColsAtCompileTime : index % Derived1::RowsAtCompileTime,
- col = Derived1::Flags&RowMajorBit ? index % Derived1::ColsAtCompileTime : index / Derived1::RowsAtCompileTime
+ row = Derived1::Flags&RowMajorBit ? Index / Derived1::ColsAtCompileTime : Index % Derived1::RowsAtCompileTime,
+ col = Derived1::Flags&RowMajorBit ? Index % Derived1::ColsAtCompileTime : Index / Derived1::RowsAtCompileTime
};
static void run(Derived1 &dst, const Derived2 &src)
{
- ei_matrix_operator_equals_packet_unroller<Derived1, Derived2, index>::run(dst, src);
+ ei_matrix_operator_equals_packet_unroller<Derived1, Derived2,
+ Index-ei_packet_traits<typename Derived1::Scalar>::size>::run(dst, src);
dst.writePacketCoeff(row, col, src.packetCoeff(row, col));
}
};
template<typename Derived1, typename Derived2>
-struct ei_matrix_operator_equals_packet_unroller<Derived1, Derived2, ei_packet_traits<typename Derived1::Scalar>::size >
+struct ei_matrix_operator_equals_packet_unroller<Derived1, Derived2, 0 >
{
static void run(Derived1 &dst, const Derived2 &src)
{
@@ -90,13 +90,6 @@ struct ei_matrix_operator_equals_packet_unroller<Derived1, Derived2, ei_packet_t
}
};
-// prevent buggy user code from causing an infinite recursion
-template<typename Derived1, typename Derived2>
-struct ei_matrix_operator_equals_packet_unroller<Derived1, Derived2, 0>
-{
- static void run(Derived1 &, const Derived2 &) { ei_internal_assert(false && "ei_matrix_operator_equals_packet_unroller"); }
-};
-
template<typename Derived1, typename Derived2>
struct ei_matrix_operator_equals_packet_unroller<Derived1, Derived2, Dynamic>
{
@@ -228,8 +221,9 @@ struct ei_operator_equals_impl<Derived, OtherDerived, true>
{
ei_matrix_operator_equals_packet_unroller
<Derived, OtherDerived,
- unroll ? Derived::SizeAtCompileTime : Dynamic>::run
- (dst.const_cast_derived(), src.derived());
+ unroll && int(Derived::SizeAtCompileTime)>=ei_packet_traits<typename Derived::Scalar>::size
+ ? Derived::SizeAtCompileTime-ei_packet_traits<typename Derived::Scalar>::size
+ : Dynamic>::run(dst.const_cast_derived(), src.derived());
}
else
{