[PPL-devel] [GIT] ppl/ppl(master): Prefer using logical (wrt bitwise) operators on Boolean values.

Enea Zaffanella zaffanella at cs.unipr.it
Wed Feb 15 08:28:00 CET 2012


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

Author: Enea Zaffanella <zaffanella at cs.unipr.it>
Date:   Wed Feb 15 08:25:15 2012 +0100

Prefer using logical (wrt bitwise) operators on Boolean values.
Detected by ECLAIR service utypflag.

---

 src/Box.templates.hh               |    4 ++--
 src/Pointset_Powerset.templates.hh |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/Box.templates.hh b/src/Box.templates.hh
index 13e51f5..1e59a3d 100644
--- a/src/Box.templates.hh
+++ b/src/Box.templates.hh
@@ -3125,7 +3125,7 @@ Box<ITV>
         assign_r(q.get_num(), numer_lower, ROUND_NOT_NEEDED);
         assign_r(q.get_den(), denom_lower, ROUND_NOT_NEEDED);
         q.canonicalize();
-        open_lower |= !included;
+        open_lower = (open_lower || !included);
         if ((ub_var_coeff >= 0) ? !negative_denom : negative_denom)
           seq_var.add_constraint(i_constraint(open_lower ? GREATER_THAN : GREATER_OR_EQUAL, q));
         else
@@ -3158,7 +3158,7 @@ Box<ITV>
         assign_r(q.get_num(), numer_upper, ROUND_NOT_NEEDED);
         assign_r(q.get_den(), denom_upper, ROUND_NOT_NEEDED);
         q.canonicalize();
-        open_upper |= !included;
+        open_upper = (open_upper || !included);
         if ((lb_var_coeff >= 0) ? !negative_denom : negative_denom)
           seq_var.add_constraint(i_constraint(open_upper ? LESS_THAN : LESS_OR_EQUAL, q));
         else
diff --git a/src/Pointset_Powerset.templates.hh b/src/Pointset_Powerset.templates.hh
index f1b1ade..76c1b9b 100644
--- a/src/Pointset_Powerset.templates.hh
+++ b/src/Pointset_Powerset.templates.hh
@@ -674,8 +674,8 @@ Pointset_Powerset<PSET>
     PSET context_i(si->pointset());
     context_i.intersection_assign(enlarged);
     PSET enlarged_i(dest);
-    nonempty_intersection
-      |= enlarged_i.simplify_using_context_assign(context_i);
+    if (enlarged_i.simplify_using_context_assign(context_i))
+      nonempty_intersection = true;
     // TODO: merge the sorted constraints of `enlarged' and `enlarged_i'?
     enlarged.intersection_assign(enlarged_i);
   }




More information about the PPL-devel mailing list