[PPL-devel] [GIT] ppl/ppl(bounded_arithmetic): Added void div_2exp_assign(GMP_Integer&, const GMP_Integer&, unsigned int).
Roberto Bagnara
bagnara at cs.unipr.it
Sun Apr 26 20:35:55 CEST 2009
Module: ppl/ppl
Branch: bounded_arithmetic
Commit: 18abd8ea5a0b711931c92bb888fe7363e925af75
URL: http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=18abd8ea5a0b711931c92bb888fe7363e925af75
Author: Roberto Bagnara <bagnara at cs.unipr.it>
Date: Sun Apr 26 17:29:39 2009 +0200
Added void div_2exp_assign(GMP_Integer&, const GMP_Integer&, unsigned int).
---
src/GMP_Integer.defs.hh | 4 ++++
src/GMP_Integer.inlines.hh | 5 +++++
2 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/src/GMP_Integer.defs.hh b/src/GMP_Integer.defs.hh
index 3021326..ba41f61 100644
--- a/src/GMP_Integer.defs.hh
+++ b/src/GMP_Integer.defs.hh
@@ -115,6 +115,10 @@ void sub_mul_assign(GMP_Integer& x,
/*! \relates GMP_Integer */
void mul_2exp_assign(GMP_Integer& x, const GMP_Integer& y, unsigned int exp);
+//! Assigns to \p x the value \f$ y / 2^\mathtt{exp} \f$.
+/*! \relates GMP_Integer */
+void div_2exp_assign(GMP_Integer& x, const GMP_Integer& y, unsigned int exp);
+
/*! \brief
If \p z divides \p y, assigns to \p x the quotient of the integer
division of \p y and \p z.
diff --git a/src/GMP_Integer.inlines.hh b/src/GMP_Integer.inlines.hh
index bf30bc4..b939f79 100644
--- a/src/GMP_Integer.inlines.hh
+++ b/src/GMP_Integer.inlines.hh
@@ -86,6 +86,11 @@ mul_2exp_assign(GMP_Integer& x, const GMP_Integer& y, unsigned int exp) {
}
inline void
+div_2exp_assign(GMP_Integer& x, const GMP_Integer& y, unsigned int exp) {
+ mpz_tdiv_q_2exp(x.get_mpz_t(), y.get_mpz_t(), exp);
+}
+
+inline void
exact_div_assign(GMP_Integer& x, const GMP_Integer& y, const GMP_Integer& z) {
assert(y % z == 0);
mpz_divexact(x.get_mpz_t(), y.get_mpz_t(), z.get_mpz_t());
More information about the PPL-devel
mailing list