[PPL-devel] [GIT] ppl/ppl(master): Another efficiency improvement to wrap_assign().

Patricia Hill p.m.hill at leeds.ac.uk
Tue May 12 17:54:47 CEST 2009


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

Author: Patricia Hill <p.m.hill at leeds.ac.uk>
Date:   Tue May 12 16:51:46 2009 +0100

Another efficiency improvement to wrap_assign().

---

 src/Grid_public.cc |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/Grid_public.cc b/src/Grid_public.cc
index 0fae952..677859d 100644
--- a/src/Grid_public.cc
+++ b/src/Grid_public.cc
@@ -2761,10 +2761,11 @@ PPL::Grid::wrap_assign(const Variables_Set& vars,
   // 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];
-  Coefficient& div_x = wrap_frequency;
-  div_x = point.divisor();
+  const Coefficient& div = point.divisor();
+  max_value *= div;
+  min_value *= div;
   for (Variables_Set::const_iterator i = vars.begin(),
-         vars_end    = vars.end(); i != vars.end(); ++i) {
+         vars_end = vars.end(); i != vars.end(); ++i) {
     const Variable x = Variable(*i);
     if (!gr.bounds_no_check(x)) {
       // `x' is not a constant in `gr'.
@@ -2778,7 +2779,7 @@ PPL::Grid::wrap_assign(const Variables_Set& vars,
       // 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.
-      if (coeff_x > max_value * div_x || coeff_x < min_value * div_x) {
+      if (coeff_x > max_value || coeff_x < min_value) {
         add_grid_generator(parameter(x));
       }
     }




More information about the PPL-devel mailing list