[PPL-devel] [GIT] ppl/ppl(bounded_arithmetic): Added new control on the second parameter of the operator<< and operator>>

Alberto Gioia alberto.gioia1 at studenti.unipr.it
Mon Jul 18 12:38:26 CEST 2011


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

Author: Alberto Gioia <alberto.gioia1 at studenti.unipr.it>
Date:   Mon Jul 18 12:37:18 2011 +0200

Added new control on the second parameter of the operator<< and operator>>
function, respectively for the two bitwise operators.

---

 src/Linear_Form.templates.hh |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/Linear_Form.templates.hh b/src/Linear_Form.templates.hh
index ea00c35..2240a2a 100644
--- a/src/Linear_Form.templates.hh
+++ b/src/Linear_Form.templates.hh
@@ -606,7 +606,9 @@ operator<<(Linear_Form<C>& f, const C& n) {
 
   dimension_type f_size = f.size();
 
-  if (f >= zero) {
+  if (n == zero)
+    return f = Linear_Form<C>(zero);
+  else  if (f >= zero) {
     if (n >= zero) {
       exp.assign((typename C::boundary_type)ldexp(1.0, n.lower()));
       exp.join_assign((typename C::boundary_type)ldexp(1.0, n.upper()));
@@ -682,7 +684,9 @@ operator>>(Linear_Form<C>& f, const C& n) {
 
   dimension_type f_size = f.size();
 
-  if (f >= zero) {
+  if (n == zero)
+    return f = Linear_Form<C>(zero);
+  else if (f >= zero) {
     if (n >= zero) {
       exp.assign((typename C::boundary_type)ldexp(1.0, n.lower()));
       exp.join_assign((typename C::boundary_type)ldexp(1.0, n.upper()));




More information about the PPL-devel mailing list