
Module: ppl/ppl Branch: bounded_arithmetic Commit: c1d77c82dcad2f0652be3b072e93a9e6e5a90f6d URL: http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=c1d77c82dcad2...
Author: Alberto Gioia alberto.gioia1@studenti.unipr.it Date: Wed Sep 14 12:53:57 2011 +0200
Added into the function of the bitwise operators shift, another check on the second operand.
---
src/Linear_Form.templates.hh | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/src/Linear_Form.templates.hh b/src/Linear_Form.templates.hh index 928ec11..15fd3b3 100644 --- a/src/Linear_Form.templates.hh +++ b/src/Linear_Form.templates.hh @@ -431,6 +431,7 @@ template <typename C> Linear_Form<C>& operator<<(Linear_Form<C>& f, const C& n) { C zero(0); + C one(1);
dimension_type f_size = f.size();
@@ -438,6 +439,8 @@ operator<<(Linear_Form<C>& f, const C& n) { f = Linear_Form<C>(zero); return f; } + else if (n == one) + return f; else if (f >= zero || f < zero) { for (dimension_type i = f_size; i-- > 0; ) f[i] << n; @@ -453,6 +456,7 @@ template <typename C> Linear_Form<C>& operator>>(Linear_Form<C>& f, const C& n) { C zero(0); + C one(1);
dimension_type f_size = f.size();
@@ -460,6 +464,8 @@ operator>>(Linear_Form<C>& f, const C& n) { f = Linear_Form<C>(zero); return f; } + if (n == one) + return f; else if (f >= zero || f < zero) { for (dimension_type i = f_size; i-- > 0; ) f[i] >> n;