[PPL-devel] [GIT] ppl/ppl(bounded_arithmetic): Added to the bitwise functions, a check for the existence of the infinite.

Alberto Gioia alberto.gioia1 at studenti.unipr.it
Sat Aug 27 18:11:05 CEST 2011


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

Author: Alberto Gioia <alberto.gioia1 at studenti.unipr.it>
Date:   Sat Aug 27 18:09:12 2011 +0200

Added to the bitwise functions, a check for the existence of the infinite.

---

 src/Interval.inlines.hh |   38 ++++++++++++++++++++++++++++++++++++++
 1 files changed, 38 insertions(+), 0 deletions(-)

diff --git a/src/Interval.inlines.hh b/src/Interval.inlines.hh
index 54d7231..fa70325 100644
--- a/src/Interval.inlines.hh
+++ b/src/Interval.inlines.hh
@@ -1089,6 +1089,16 @@ Interval<To_Boundary, To_Info>::and_assign(const From1& x, const From2& y) {
   if (check_empty_arg(x) || check_empty_arg(y))
     return assign(EMPTY);
 
+  int inf = Parma_Polyhedra_Library::is_infinity(x);
+  if (inf) {
+    if (Parma_Polyhedra_Library::is_infinity(y) == -inf)
+      return assign(NOT_A_NUMBER);
+  }
+  else
+    inf = Parma_Polyhedra_Library::is_infinity(y);
+  if (inf)
+    return assign(NOT_A_NUMBER);
+
   Interval<To_Boundary, To_Info> x1;
   Interval<To_Boundary, To_Info> x2;
   Interval<To_Boundary, To_Info> zero(0);
@@ -1184,6 +1194,16 @@ Interval<To_Boundary, To_Info>::or_assign(const From1& x, const From2& y) {
   if (check_empty_arg(x) || check_empty_arg(y))
     return assign(EMPTY);
 
+  int inf = Parma_Polyhedra_Library::is_infinity(x);
+  if (inf) {
+    if (Parma_Polyhedra_Library::is_infinity(y) == -inf)
+      return assign(NOT_A_NUMBER);
+  }
+  else
+    inf = Parma_Polyhedra_Library::is_infinity(y);
+  if (inf)
+    return assign(NOT_A_NUMBER);
+
   Interval<To_Boundary, To_Info> x1;
   Interval<To_Boundary, To_Info> x2;
   Interval<To_Boundary, To_Info> neg_one(-1);
@@ -1280,6 +1300,16 @@ Interval<To_Boundary, To_Info>::xor_assign(const From1& x, const From2& y) {
   if (check_empty_arg(x) || check_empty_arg(y))
     return assign(EMPTY);
 
+  int inf = Parma_Polyhedra_Library::is_infinity(x);
+  if (inf) {
+    if (Parma_Polyhedra_Library::is_infinity(y) == -inf)
+      return assign(NOT_A_NUMBER);
+  }
+  else
+    inf = Parma_Polyhedra_Library::is_infinity(y);
+  if (inf)
+    return assign(NOT_A_NUMBER);
+
   Interval<To_Boundary, To_Info> x1;
   Interval<To_Boundary, To_Info> zero(0);
   Interval<To_Boundary, To_Info> neg_one(-1);
@@ -1378,6 +1408,10 @@ Interval<To_Boundary, To_Info>::lshift_assign(const From1& x, const From2& y) {
   if (check_empty_arg(x) || check_empty_arg(y))
     return assign(EMPTY);
 
+  int inf = Parma_Polyhedra_Library::is_infinity(x);
+  if (inf)
+    return assign(NOT_A_NUMBER);
+
   Interval<To_Boundary, To_Info> x1;
   Interval<To_Boundary, To_Info> z;
   Interval<To_Boundary, To_Info>
@@ -1459,6 +1493,10 @@ Interval<To_Boundary, To_Info>::rshift_assign(const From1& x, const From2& y) {
   if (check_empty_arg(x) || check_empty_arg(y))
     return assign(EMPTY);
 
+  int inf = Parma_Polyhedra_Library::is_infinity(x);
+  if (inf)
+    return assign(NOT_A_NUMBER);
+
   Interval<To_Boundary, To_Info> x1;
   Interval<To_Boundary, To_Info> z;
   Interval<To_Boundary, To_Info>




More information about the PPL-devel mailing list