[PPL-devel] [GIT] ppl/ppl(master): Uniformed code and get rid of a warning.
Abramo Bagnara
abramo.bagnara at gmail.com
Mon Apr 5 16:59:28 CEST 2010
Module: ppl/ppl
Branch: master
Commit: 3b995ff6fcf3f3c0c63f989beba3850c69f6d713
URL: http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=3b995ff6fcf3f3c0c63f989beba3850c69f6d713
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