[PPL-devel] [GIT] ppl/ppl(bounded_arithmetic): In Polyhedron::wrap_assign() handled the case `o == OVERFLOW_UNDEFINED'.
Roberto Bagnara
bagnara at cs.unipr.it
Mon Apr 27 22:27:52 CEST 2009
Module: ppl/ppl
Branch: bounded_arithmetic
Commit: 0d65c2598c4350a19883cd8e06ae0d3a3a73336a
URL: http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=0d65c2598c4350a19883cd8e06ae0d3a3a73336a
Author: Roberto Bagnara <bagnara at cs.unipr.it>
Date: Mon Apr 27 22:27:06 2009 +0200
In Polyhedron::wrap_assign() handled the case `o == OVERFLOW_UNDEFINED'.
---
src/Polyhedron_public.cc | 2 +-
tests/Polyhedron/wrap1.cc | 61 +++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 62 insertions(+), 1 deletions(-)
diff --git a/src/Polyhedron_public.cc b/src/Polyhedron_public.cc
index 9111f31..2bd274d 100644
--- a/src/Polyhedron_public.cc
+++ b/src/Polyhedron_public.cc
@@ -3764,7 +3764,7 @@ PPL::Polyhedron::wrap_assign(const Variables_Set& vars,
if (un == 0 && ln == 0)
continue;
- if (un - ln > k_threshold)
+ if (o == OVERFLOW_UNDEFINED || un - ln > k_threshold)
goto set_full_range;
Polyhedron hull(topology(), space_dimension(), EMPTY);
diff --git a/tests/Polyhedron/wrap1.cc b/tests/Polyhedron/wrap1.cc
index f997c1a..f03be15 100644
--- a/tests/Polyhedron/wrap1.cc
+++ b/tests/Polyhedron/wrap1.cc
@@ -85,9 +85,70 @@ test02() {
return ok;
}
+bool
+test03() {
+ Variable x(0);
+ Variable y(1);
+ C_Polyhedron ph(2);
+ ph.add_constraint(x + 1024 == 8*y);
+ ph.add_constraint(-64 <= x);
+ ph.add_constraint(x <= 448);
+
+ print_constraints(ph, "*** ph ***");
+
+ Variables_Set vars(x, y);
+
+ ph.wrap_assign(vars, BITS_8, UNSIGNED, OVERFLOW_UNDEFINED);
+
+ C_Polyhedron known_result(2);
+ known_result.add_constraint(x >= 0);
+ known_result.add_constraint(x <= 255);
+ known_result.add_constraint(y >= 120);
+ known_result.add_constraint(y <= 184);
+
+ bool ok = (ph == known_result);
+
+ print_constraints(ph, "*** ph.wrap_assign(...) ***");
+
+ return ok;
+}
+
+bool
+test04() {
+ Variable x(0);
+ Variable y(1);
+ C_Polyhedron ph(2);
+ ph.add_constraint(x + 1024 == 8*y);
+ ph.add_constraint(-64 <= x);
+ ph.add_constraint(x <= 448);
+
+ print_constraints(ph, "*** ph ***");
+
+ Variables_Set vars(x, y);
+
+ Constraint_System cs;
+ cs.insert(x <= y);
+
+ ph.wrap_assign(vars, BITS_8, UNSIGNED, OVERFLOW_UNDEFINED, &cs);
+
+ C_Polyhedron known_result(2);
+ known_result.add_constraint(x >= 0);
+ known_result.add_constraint(y >= 120);
+ known_result.add_constraint(y <= 184);
+ known_result.add_constraint(x <= y);
+
+ bool ok = (ph == known_result);
+
+ print_constraints(ph, "*** ph.wrap_assign(...) ***");
+
+ return ok;
+}
+
} // namespace
BEGIN_MAIN
DO_TEST(test01);
DO_TEST(test02);
+ DO_TEST(test03);
+ DO_TEST(test04);
END_MAIN
More information about the PPL-devel
mailing list