[PPL-devel] [GIT] ppl/ppl(master): Make comparison against zero explicit.

Enea Zaffanella zaffanella at cs.unipr.it
Wed Feb 15 23:10:27 CET 2012


Module: ppl/ppl
Branch: master
Commit: 61f5417dcdf35d4f56ba737a45eb7ebc494e2e41
URL:    http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=61f5417dcdf35d4f56ba737a45eb7ebc494e2e41

Author: Enea Zaffanella <zaffanella at cs.unipr.it>
Date:   Wed Feb 15 17:21:18 2012 +0100

Make comparison against zero explicit.
Detected by ECLAIR service utypflag.

---

 src/Bit_Row.cc |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/Bit_Row.cc b/src/Bit_Row.cc
index e0e6376..f9c73bd 100644
--- a/src/Bit_Row.cc
+++ b/src/Bit_Row.cc
@@ -141,7 +141,7 @@ PPL::Bit_Row::operator[](const unsigned long k) const {
     return false;
 
   mp_limb_t limb = *(vec->_mp_d + i);
-  return (limb >> (k % GMP_NUMB_BITS)) & 1;
+  return ((limb >> (k % GMP_NUMB_BITS)) & 1) != 0;
 }
 
 void
@@ -169,7 +169,7 @@ PPL::compare(const Bit_Row& x, const Bit_Row& y) {
       const mp_limb_t diff = xl ^ yl;
       // First bit that is different.
       const mp_limb_t mask = diff & ~(diff-1);
-      return (xl & mask) ? 1 : -1;
+      return ((xl & mask) != 0) ? 1 : -1;
     }
     ++xp;
     ++yp;
@@ -190,7 +190,7 @@ PPL::subset_or_equal(const Bit_Row& x, const Bit_Row& y) {
   mp_srcptr xp = x.vec->_mp_d;
   mp_srcptr yp = y.vec->_mp_d;
   while (x_size > 0) {
-    if (*xp & ~*yp)
+    if ((*xp & ~*yp) != 0)
       return false;
     ++xp;
     ++yp;
@@ -218,7 +218,7 @@ PPL::subset_or_equal(const Bit_Row& x, const Bit_Row& y,
     while (x_size > 0) {
       xl = *xp;
       yl = *yp;
-      if (xl & ~yl)
+      if ((xl & ~yl) != 0)
 	return false;
     strict_subset_next:
       ++xp;
@@ -231,7 +231,7 @@ PPL::subset_or_equal(const Bit_Row& x, const Bit_Row& y,
       xl = *xp;
       yl = *yp;
       if (xl != yl) {
-	if (xl & ~yl)
+	if ((xl & ~yl) != 0)
 	  return false;
 	strict_subset = true;
 	goto strict_subset_next;
@@ -259,7 +259,7 @@ PPL::strict_subset(const Bit_Row& x, const Bit_Row& y) {
   while (x_size > 0) {
     const mp_limb_t xl = *xp;
     const mp_limb_t yl = *yp;
-    if (xl & ~yl)
+    if ((xl & ~yl) != 0)
       return false;
     if (!different && xl != yl)
       different = true;




More information about the PPL-devel mailing list