[PPL-devel] [GIT] ppl/ppl(master): Fixed a missing initialization bug in Box:: concatenate_assign.

Enea Zaffanella zaffanella at cs.unipr.it
Fri Apr 3 16:13:21 CEST 2009


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

Author: Enea Zaffanella <zaffanella at cs.unipr.it>
Date:   Fri Apr  3 16:09:25 2009 +0200

Fixed a missing initialization bug in Box::concatenate_assign.
Also improved methods add_space_dimensions*: instead of adding new
uninitialized intervals and later initialize them, we now directly add
properly initialized intervals.

---

 src/Box.templates.hh |   15 ++++-----------
 1 files changed, 4 insertions(+), 11 deletions(-)

diff --git a/src/Box.templates.hh b/src/Box.templates.hh
index 51578f4..fa27d0d 100644
--- a/src/Box.templates.hh
+++ b/src/Box.templates.hh
@@ -505,12 +505,9 @@ Box<ITV>::add_space_dimensions_and_embed(const dimension_type m) {
   // Adding no dimensions is a no-op.
   if (m == 0)
     return;
-
   // To embed an n-dimension space box in a (n+m)-dimension space,
   // we just add `m' new universe elements to the sequence.
-  seq.insert(seq.end(), m, ITV());
-  for (dimension_type sz = seq.size(), i = sz - m; i < sz; ++i)
-    seq[i].assign(UNIVERSE);
+  seq.insert(seq.end(), m, ITV(UNIVERSE));
   assert(OK());
 }
 
@@ -520,12 +517,8 @@ Box<ITV>::add_space_dimensions_and_project(const dimension_type m) {
   // Adding no dimensions is a no-op.
   if (m == 0)
     return;
-
-  // A add `m' new zero elements to the sequence.
-  seq.insert(seq.end(), m, ITV());
-  for (dimension_type sz = seq.size(), i = sz - m; i < sz; ++i)
-    seq[i].assign(0);
-
+  // Add `m' new zero elements to the sequence.
+  seq.insert(seq.end(), m, ITV(0));
   assert(OK());
 }
 
@@ -1491,7 +1484,7 @@ Box<ITV>::concatenate_assign(const Box& y) {
   // If `x' is marked empty, then it is sufficient to adjust
   // the dimension of the vector space.
   if (x.marked_empty()) {
-    x.seq.insert(x.seq.end(), y_space_dim, ITV());
+    x.seq.insert(x.seq.end(), y_space_dim, ITV(EMPTY));
     assert(x.OK());
     return;
   }




More information about the PPL-devel mailing list