[PPL-devel] [GIT] ppl/ppl(bounded_arithmetic): Added smod_2exp and umod_2exp for boundary.
Abramo Bagnara
abramo.bagnara at gmail.com
Wed May 13 12:53:57 CEST 2009
Module: ppl/ppl
Branch: bounded_arithmetic
Commit: ca38275a5e16241fe45be2193cf78c4e987a501f
URL: http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=ca38275a5e16241fe45be2193cf78c4e987a501f
Author: Abramo Bagnara <abramo.bagnara at gmail.com>
Date: Tue May 12 17:30:01 2009 +0200
Added smod_2exp and umod_2exp for boundary.
---
src/Boundary.defs.hh | 36 ++++++++++++++++++++++++++++++++++++
1 files changed, 36 insertions(+), 0 deletions(-)
diff --git a/src/Boundary.defs.hh b/src/Boundary.defs.hh
index 29a76e9..90deaa8 100644
--- a/src/Boundary.defs.hh
+++ b/src/Boundary.defs.hh
@@ -725,6 +725,42 @@ div_assign_z(Boundary_Type to_type, To& to, To_Info& to_info,
}
}
+template <typename To, typename To_Info, typename T, typename Info>
+inline Result
+umod_2exp_assign(Boundary_Type to_type, To& to, To_Info& to_info,
+ Boundary_Type type, const T& x, const Info& info,
+ unsigned int exp) {
+ assert(to_type != type);
+ bool shrink;
+ if (is_boundary_infinity(type, x, info)) {
+ shrink = boundary_infinity_is_open(type, info);
+ return set_boundary_infinity(to_type, to, to_info, shrink);
+ }
+ shrink = normal_is_open(type, x, info);
+ bool check = (To_Info::check_inexact
+ || (!shrink && (To_Info::store_open || to_info.has_restriction())));
+ Result r = umod_2exp_assign_r(to, x, exp, round_dir_check(to_type, check));
+ return adjust_boundary(to_type, to, to_info, shrink, r);
+}
+
+template <typename To, typename To_Info, typename T, typename Info>
+inline Result
+smod_2exp_assign(Boundary_Type to_type, To& to, To_Info& to_info,
+ Boundary_Type type, const T& x, const Info& info,
+ unsigned int exp) {
+ assert(to_type != type);
+ bool shrink;
+ if (is_boundary_infinity(type, x, info)) {
+ shrink = boundary_infinity_is_open(type, info);
+ return set_boundary_infinity(to_type, to, to_info, shrink);
+ }
+ shrink = normal_is_open(type, x, info);
+ bool check = (To_Info::check_inexact
+ || (!shrink && (To_Info::store_open || to_info.has_restriction())));
+ Result r = smod_2exp_assign_r(to, x, exp, round_dir_check(to_type, check));
+ return adjust_boundary(to_type, to, to_info, shrink, r);
+}
+
} // namespace Boundary_NS
} // namespace Parma_Polyhedra_Library
More information about the PPL-devel
mailing list