[PPL-devel] [GIT] ppl/ppl(master): When object is not used for control, declaration moved outside for statement.

Patricia Hill p.m.hill at leeds.ac.uk
Tue Feb 21 12:04:40 CET 2012


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

Author: Patricia Hill <p.m.hill at leeds.ac.uk>
Date:   Tue Feb 21 11:01:14 2012 +0000

When object is not used for control, declaration moved outside for statement.

---

 src/PIP_Tree.cc |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/PIP_Tree.cc b/src/PIP_Tree.cc
index 41ea946..77bd698 100644
--- a/src/PIP_Tree.cc
+++ b/src/PIP_Tree.cc
@@ -138,7 +138,7 @@ merge_assign(Matrix& x, const Constraint_System& y,
     if (inhomogeneous_term != 0)
       itr = x_i.insert(0, inhomogeneous_term);
     // itr may still be end() but it can still be used as a hint.
-    for ( dimension_type j = 1; pj != param_end; ++pj, ++j) {
+    for (dimension_type j = 1; pj != param_end; ++pj, ++j) {
       Variable vj(*pj);
       if (vj.space_dimension() > cs_space_dim)
         break;
@@ -1133,12 +1133,13 @@ PIP_Tree_Node
     // Needed to avoid reallocations in expr when iterating upward.
     add_mul_assign(expr, 0, Variable(*(parameters.rbegin())));
     // The number of increments of j plus one.
+    dimension_type j_index = 1;
     Row::const_iterator i = row.begin();
     Row::const_iterator i_end = row.end();
     if (i != i_end && i.index() == 0)
       ++i;
     // NOTE: iterating in [1..num_params].
-    for (dimension_type j_index = 1; i != i_end; ++i) {
+    for ( ; i != i_end; ++i) {
       PPL_ASSERT(i.index() <= parameters.size());
       std::advance(j, i.index() - j_index);
       j_index = i.index();
@@ -3200,7 +3201,8 @@ PIP_Solution_Node::generate_cut(const dimension_type index,
         // To avoid reallocations of expr.
         add_mul_assign(expr, 0, Variable(*(parameters.rbegin())));
         Variables_Set::const_iterator p_j = parameters.begin();
-        for ( dimension_type last_index = 1; j != j_end; ++j) {
+        dimension_type last_index = 1;
+        for ( ; j != j_end; ++j) {
           pos_mod_assign(mod, *j, denom);
           if (mod != 0) {
             // Optimizing computation: expr += (denom - mod) * Variable(*p_j);




More information about the PPL-devel mailing list