[PPL-devel] [GIT] ppl/ppl(master): Improved documentation and small efficiency improvement to the code.

Patricia Hill p.m.hill at leeds.ac.uk
Tue May 12 18:22:41 CEST 2009

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

Author: Patricia Hill <p.m.hill at leeds.ac.uk>
Date:   Tue May 12 17:19:02 2009 +0100

Improved documentation and small efficiency improvement to the code.

---

doc/definitions.dox |   14 ++++++++------
src/Grid_public.cc  |    3 +--
2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/doc/definitions.dox b/doc/definitions.dox
index e3148c0..aa3839e 100644
--- a/doc/definitions.dox
+++ b/doc/definitions.dox
@@ -2322,9 +2322,9 @@ the given bounded integer type and have the specified overflow behavior.
Suppose \f$\cL \in \Gset_n\f$ is a grid and \f$J\f$ a subset of the
set of space dimensions \f$\{0, \ldots, n-1\}\f$.
Suppose also that the width of the bounded integer type is \f$w\f$ so that
-the range of values \f$R = \{0, \ldots, 2^w-1\}\f$
+the range of values \f$R = \{r \in \Rset \mid 0 \leq r < 2^w\}\f$
if the type is unsigned
-and \f$R = \{-2^{w-1},\ldots, 0, \ldots, 2^{w-1} - 1\}\f$ otherwise.
+and \f$R = \{r \in \Rset \mid -2^{w-1} \leq r < 2^{w-1}\}\f$ otherwise.
Consider a space dimension \f$j \in J\f$ and a variable \f$v_j\f$
for dimension \f$j\f$.

@@ -2345,11 +2345,13 @@ specified overflow behavior.
Therefore the parameter \f$(0, \ldots, 0, v_j, 0, \dots, 0)\f$,
where \f$v_j = 1\f$ is added to the generator system for \f$\cL\f$.

-- Overflow wraps. In this case, for each value \f$a\f$ for
-  \f$v_j\f$ in the grid \f$\cL\f$, the wrapped value can be any value
-  \f$a + z 2^{w-1} \in R\f$ where \f$z \in \Zset\f$.
+- Overflow wraps. In this case, if \f$v_j\f$ has exactly
+  one value \f$a \in R\f$ in \f$\cL\f$, then \f$v_j\f$ is set
+  equal to \f$a\f$. Otherwise, for each value \f$a\f$ for
+  \f$v_j\f$ in the grid \f$\cL\f$, there must be more than one value
+  of the form \f$a + z 2^w \in R\f$ where \f$z \in \Zset\f$.
Therefore the parameter \f$(0, \ldots, 0, v_j, 0, \dots, 0)\f$,
-  where \f$v_j = 2^{w-1}\f$ is added to the generator system for \f$\cL\f$.
+  where \f$v_j = 2^w\f$ is added to the generator system for \f$\cL\f$.

\subsection Grid_Widening Widening Operators

diff --git a/src/Grid_public.cc b/src/Grid_public.cc
index 677859d..844c7ec 100644
--- a/src/Grid_public.cc
+++ b/src/Grid_public.cc
@@ -2759,7 +2759,6 @@ PPL::Grid::wrap_assign(const Variables_Set& vars,
assert(o == OVERFLOW_UNDEFINED);
// If overflow is undefined, then all we know is that the variable
// may take any integer within the range of the bounded integer type.
-  PPL_DIRTY_TEMP_COEFFICIENT(coeff_x);
const Grid_Generator& point = gen_sys[0];
const Coefficient& div = point.divisor();
max_value *= div;
@@ -2775,7 +2774,7 @@ PPL::Grid::wrap_assign(const Variables_Set& vars,
}
else {
// x' is a constant v' in gr'.
-      coeff_x = point.coefficient(x);
+      const Coefficient& coeff_x = point.coefficient(x);
// If the value v' for x' is not within the range for the
// bounded integer type, then x' may wrap to any value v + z'
// where z' is an integer; otherwise x' is unchanged.

`