[PPL-devel] [GIT] ppl/ppl(products): Uniformed code and get rid of a warning.

Abramo Bagnara abramo.bagnara at gmail.com
Mon Apr 5 16:56:32 CEST 2010


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

Author: Abramo Bagnara <abramo.bagnara at gmail.com>
Date:   Mon Apr  5 16:56:29 2010 +0200

Uniformed code and get rid of a warning.

---

 src/checked_int.inlines.hh |   16 ++++++----------
 1 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/src/checked_int.inlines.hh b/src/checked_int.inlines.hh
index ab82f95..f55416c 100644
--- a/src/checked_int.inlines.hh
+++ b/src/checked_int.inlines.hh
@@ -1383,16 +1383,12 @@ add_mul_int(Type& to, const Type x, const Type y, Rounding_Dir dir) {
   case 0:
     return add<To_Policy, To_Policy, To_Policy>(to, to, z, dir);
   case -1:
-    if (to <= 0) {
-      to = z;
-      return r;
-    }
+    if (to <= 0)
+      return set_neg_overflow_int<To_Policy>(to, dir);
     return assign_nan<To_Policy>(to, V_UNKNOWN_NEG_OVERFLOW);
   case 1:
-    if (to >= 0) {
-      to = z;
-      return r;
-    }
+    if (to >= 0)
+      return set_pos_overflow_int<To_Policy>(to, dir);
     return assign_nan<To_Policy>(to, V_UNKNOWN_POS_OVERFLOW);
   default:
     PPL_ASSERT(false);
@@ -1411,11 +1407,11 @@ sub_mul_int(Type& to, const Type x, const Type y, Rounding_Dir dir) {
   case -1:
     if (to >= 0)
       return set_pos_overflow_int<To_Policy>(to, dir);
-    return V_UNKNOWN_NEG_OVERFLOW;
+    return assign_nan<To_Policy>(to, V_UNKNOWN_NEG_OVERFLOW);
   case 1:
     if (to <= 0)
       return set_neg_overflow_int<To_Policy>(to, dir);
-    return V_UNKNOWN_POS_OVERFLOW;
+    return assign_nan<To_Policy>(to, V_UNKNOWN_POS_OVERFLOW);
   default:
     PPL_ASSERT(false);
     return V_NAN;




More information about the PPL-devel mailing list