[eigen] Fix for precedence bug in SparseLU.h on 2.0 branch

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


Found by your friendly neighbourhood clang compiler:

./eigen/Eigen/src/Sparse/SparseLU.h:99:7: error: & has lower precedence than ==; == will be evaluated first [-Wparentheses] 
ei_assert(m&~OrderingMask == 0 && m!=0 && "invalid ordering method"); 
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Keir
diff -r e7ef4e06dad3 Eigen/src/Sparse/SparseLU.h
--- a/Eigen/src/Sparse/SparseLU.h	Thu Jul 22 21:26:09 2010 +0200
+++ b/Eigen/src/Sparse/SparseLU.h	Mon Aug 23 15:30:17 2010 -0700
@@ -96,8 +96,8 @@
 
     void setOrderingMethod(int m)
     {
-      ei_assert(m&~OrderingMask == 0 && m!=0 && "invalid ordering method");
-      m_flags = m_flags&~OrderingMask | m&OrderingMask;
+      ei_assert((m&~OrderingMask) == 0 && m!=0 && "invalid ordering method");
+      m_flags = (m_flags&~OrderingMask) | (m&OrderingMask);
     }
 
     int orderingMethod() const


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/