
Module: ppl/ppl Branch: bounded_arithmetic Commit: da83bd6fe05a6e842277a8eadcffc843cc841e52 URL: http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=da83bd6fe05a6...
Author: Roberto Bagnara bagnara@cs.unipr.it Date: Sun Apr 26 17:16:02 2009 +0200
Added void mul_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 159bdb9..3021326 100644 --- a/src/GMP_Integer.defs.hh +++ b/src/GMP_Integer.defs.hh @@ -111,6 +111,10 @@ void add_mul_assign(GMP_Integer& x, void sub_mul_assign(GMP_Integer& x, const GMP_Integer& y, const GMP_Integer& z);
+//! Assigns to \p x the value \f$ y \cdot 2^\mathtt{exp} \f$. +/*! \relates GMP_Integer */ +void mul_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 9cb9e04..bf30bc4 100644 --- a/src/GMP_Integer.inlines.hh +++ b/src/GMP_Integer.inlines.hh @@ -81,6 +81,11 @@ sub_mul_assign(GMP_Integer& x, const GMP_Integer& y, const GMP_Integer& z) { }
inline void +mul_2exp_assign(GMP_Integer& x, const GMP_Integer& y, unsigned int exp) { + mpz_mul_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());