[PPL-devel] [GIT] ppl/ppl(master): Redid the intended changes for the last commit for wrap_assign().

Patricia Hill p.m.hill at leeds.ac.uk
Mon May 11 09:37:21 CEST 2009


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

Author: Patricia Hill <p.m.hill at leeds.ac.uk>
Date:   Mon May 11 08:34:11 2009 +0100

Redid the intended changes for the last commit for wrap_assign().

---

 src/Grid.defs.hh      |    4 ++--
 src/Grid_nonpublic.cc |    9 ++++++++-
 src/Grid_public.cc    |   12 +-----------
 3 files changed, 11 insertions(+), 14 deletions(-)

diff --git a/src/Grid.defs.hh b/src/Grid.defs.hh
index bd4babb..bfb6d12 100644
--- a/src/Grid.defs.hh
+++ b/src/Grid.defs.hh
@@ -2160,8 +2160,8 @@ private:
     \p val_n and \p val_d are left untouched.
 
     \warning
-    If \p expr and \p *this are dimension-incompatible, or the generators
-    are not minimized, then the behavior is undefined.
+    If \p expr and \p *this are dimension-incompatible,
+    then the behavior is undefined.
   */
   bool frequency_no_check(const Linear_Expression& expr,
 		Coefficient& freq_n, Coefficient& freq_d,
diff --git a/src/Grid_nonpublic.cc b/src/Grid_nonpublic.cc
index 12d5c6d..214948c 100644
--- a/src/Grid_nonpublic.cc
+++ b/src/Grid_nonpublic.cc
@@ -317,7 +317,14 @@ PPL::Grid::frequency_no_check(const Linear_Expression& expr,
 
   // The dimension of `expr' must be at most the dimension of *this.
   assert(space_dim >= expr.space_dimension());
-  assert(generators_are_minimized() && !is_empty());
+
+  // The frequency is undefined if the grid is empty; return false.
+  if (marked_empty())
+    return false;
+  if (!generators_are_minimized() && !minimize())
+    return false;
+
+  // The generators are up to date and minimized and the grid is non-empty.
 
   // If the grid is bounded for the expression `expr',
   // then `expr' has a constant value and the frequency is 0.
diff --git a/src/Grid_public.cc b/src/Grid_public.cc
index 68378d5..be66a1a 100644
--- a/src/Grid_public.cc
+++ b/src/Grid_public.cc
@@ -2659,11 +2659,7 @@ PPL::Grid::wrap_assign(const Variables_Set& vars,
   if (vars.empty())
     return;
 
-<<<<<<< HEAD:src/Grid_public.cc
-  const dimension_type space_dim = space_dimension();
   // Dimension-compatibility check of `vars'.
-=======
->>>>>>> Improved and corrected draft code for wrap_assign() for grids.:src/Grid_public.cc
   const dimension_type min_space_dim = vars.space_dimension();
   if (space_dim < min_space_dim)
     throw_dimension_incompatible("wrap_assign(vs, ...)", min_space_dim);
@@ -2680,7 +2676,7 @@ PPL::Grid::wrap_assign(const Variables_Set& vars,
   PPL_DIRTY_TEMP_COEFFICIENT(wrap_frequency);
   mul_2exp_assign(wrap_frequency, Coefficient_one(), w);
 
-  // Generators are up-to-date.
+  // Generators are up-to-date and minimized.
   const Grid gr = *this;
 
   // Overflow is impossible. So check if value might be constant.
@@ -2720,14 +2716,8 @@ PPL::Grid::wrap_assign(const Variables_Set& vars,
     for (Variables_Set::const_iterator i = vars.begin(),
            vars_end = vars.end(); i != vars.end(); ++i) {
       const Variable x = Variable(*i);
-<<<<<<< HEAD:src/Grid_public.cc
-
-      // If `x' is a constant, do nothing.
-      if (!gr.bounds(x, "wrap_assign(...)")) {
-=======
       // If `x' is a constant, do nothing.
       if (!gr.bounds_no_check(x)) {
->>>>>>> Improved and corrected draft code for wrap_assign() for grids.:src/Grid_public.cc
         if (gr.constrains(x))
           // We know that `x' is not a constant,
           // so `x' may wrap to any integral value.




More information about the PPL-devel mailing list