[PPL-devel] [GIT] ppl/ppl(master): Simplified code.

Abramo Bagnara abramo.bagnara at gmail.com
Sun May 17 14:56:12 CEST 2009


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

Author: Abramo Bagnara <abramo.bagnara at gmail.com>
Date:   Sun May 17 11:41:21 2009 +0200

Simplified code.

---

 src/wrap_assign.hh |   25 ++++++++-----------------
 1 files changed, 8 insertions(+), 17 deletions(-)

diff --git a/src/wrap_assign.hh b/src/wrap_assign.hh
index 01c3135..5b1498e 100644
--- a/src/wrap_assign.hh
+++ b/src/wrap_assign.hh
@@ -309,29 +309,20 @@ wrap_assign(PSET& pointset,
     if (o == OVERFLOW_UNDEFINED || collective_wrap_too_complex)
       goto set_full_range;
 
-    Coefficient& diff = ud;
-    diff = last_quadrant - first_quadrant;
-
-    // Please note that the `>=' is intentional here.
-    if (diff >= UINT_MAX)
-      goto set_full_range;
+    Coefficient& quadrants = ud;
+    quadrants = last_quadrant - first_quadrant + 1;
 
     unsigned extension;
-    assign_r(extension, diff, ROUND_NOT_NEEDED);
-    ++extension;
-    assert(extension > 0);
-
-    if (extension > complexity_threshold)
+    Result r = assign_r(extension, quadrants, ROUND_DIRECT);
+    if (result_overflow(r) || extension > complexity_threshold)
       goto set_full_range;
 
     if (!wrap_individually && !collective_wrap_too_complex) {
-      if (collective_wrap_complexity > UINT_MAX / extension)
-        collective_wrap_too_complex = true;
-      else {
-        collective_wrap_complexity *= extension;
-        if (collective_wrap_complexity > complexity_threshold)
+      r = mul_assign_r(collective_wrap_complexity,
+		       collective_wrap_complexity, extension, ROUND_DIRECT);
+      if (result_overflow(r) ||
+	  collective_wrap_complexity > complexity_threshold)
           collective_wrap_too_complex = true;
-      }
       if (collective_wrap_too_complex) {
         // Set all the dimensions in `translations' to full range.
         for (Wrap_Translations::const_iterator i = translations.begin(),




More information about the PPL-devel mailing list