[Gmp-commit] /var/hg/gmp: mp_bitcnt_t for [lr]shift.

mercurial at gmplib.org mercurial at gmplib.org
Sun May 8 14:31:03 CEST 2011


details:   /var/hg/gmp/rev/60f70d394fc2
changeset: 14176:60f70d394fc2
user:      Marc Glisse <marc.glisse at inria.fr>
date:      Sun May 08 14:31:01 2011 +0200
description:
mp_bitcnt_t for [lr]shift.

diffstat:

 ChangeLog |   3 +--
 gmpxx.h   |  24 ++++++++++++------------
 2 files changed, 13 insertions(+), 14 deletions(-)

diffs (80 lines):

diff -r 763987d1673f -r 60f70d394fc2 ChangeLog
--- a/ChangeLog	Sun May 08 14:15:01 2011 +0200
+++ b/ChangeLog	Sun May 08 14:31:01 2011 +0200
@@ -1,7 +1,6 @@
 2011-05-08  Marc Glisse  <marc.glisse at inria.fr>
 
-	* gmpxx.h (get_prec): Return mp_bitcnt_t everywhere.
-	(eval): Take precision argument as mp_bitcnt_t.
+	* gmpxx.h: Replace unsigned long with mp_bitcnt_t in many places.
 
 2011-05-06  Marc Glisse  <marc.glisse at inria.fr>
 
diff -r 763987d1673f -r 60f70d394fc2 gmpxx.h
--- a/gmpxx.h	Sun May 08 14:15:01 2011 +0200
+++ b/gmpxx.h	Sun May 08 14:31:01 2011 +0200
@@ -682,21 +682,21 @@
 
 struct __gmp_binary_lshift
 {
-  static void eval(mpz_ptr z, mpz_srcptr w, unsigned long int l)
+  static void eval(mpz_ptr z, mpz_srcptr w, mp_bitcnt_t l)
   { mpz_mul_2exp(z, w, l); }
-  static void eval(mpq_ptr q, mpq_srcptr r, unsigned long int l)
+  static void eval(mpq_ptr q, mpq_srcptr r, mp_bitcnt_t l)
   { mpq_mul_2exp(q, r, l); }
-  static void eval(mpf_ptr f, mpf_srcptr g, unsigned long int l)
+  static void eval(mpf_ptr f, mpf_srcptr g, mp_bitcnt_t l)
   { mpf_mul_2exp(f, g, l); }
 };
 
 struct __gmp_binary_rshift
 {
-  static void eval(mpz_ptr z, mpz_srcptr w, unsigned long int l)
+  static void eval(mpz_ptr z, mpz_srcptr w, mp_bitcnt_t l)
   { mpz_fdiv_q_2exp(z, w, l); }
-  static void eval(mpq_ptr q, mpq_srcptr r, unsigned long int l)
+  static void eval(mpq_ptr q, mpq_srcptr r, mp_bitcnt_t l)
   { mpq_div_2exp(q, r, l); }
-  static void eval(mpf_ptr f, mpf_srcptr g, unsigned long int l)
+  static void eval(mpf_ptr f, mpf_srcptr g, mp_bitcnt_t l)
   { mpf_div_2exp(f, g, l); }
 };
 
@@ -1253,7 +1253,7 @@
 __GMPN_DECLARE_COMPOUND_OPERATOR(fun)
 
 #define __GMP_DECLARE_COMPOUND_OPERATOR_UI(fun) \
-  __gmp_expr & fun(unsigned long int);
+  __gmp_expr & fun(mp_bitcnt_t);
 
 #define __GMP_DECLARE_INCREMENT_OPERATOR(fun) \
   inline __gmp_expr & fun();                  \
@@ -2621,11 +2621,11 @@
                                                                        \
 template <class T, class U>                                            \
 inline __gmp_expr                                                      \
-<T, __gmp_binary_expr<__gmp_expr<T, U>, unsigned long int, eval_fun> > \
-fun(const __gmp_expr<T, U> &expr, unsigned long int l)                 \
+<T, __gmp_binary_expr<__gmp_expr<T, U>, mp_bitcnt_t, eval_fun> > \
+fun(const __gmp_expr<T, U> &expr, mp_bitcnt_t l)                 \
 {                                                                      \
   return __gmp_expr<T, __gmp_binary_expr                               \
-    <__gmp_expr<T, U>, unsigned long int, eval_fun> >(expr, l);        \
+    <__gmp_expr<T, U>, mp_bitcnt_t, eval_fun> >(expr, l);        \
 }
 
 
@@ -2756,10 +2756,10 @@
 
 #define __GMP_DEFINE_COMPOUND_OPERATOR_UI(type, fun, eval_fun)  \
                                                                 \
-inline type##_class & type##_class::fun(unsigned long int l)    \
+inline type##_class & type##_class::fun(mp_bitcnt_t l)    \
 {                                                               \
   __gmp_set_expr(mp, __gmp_expr<type##_t, __gmp_binary_expr     \
-    <type##_class, unsigned long int, eval_fun> >(*this, l));   \
+    <type##_class, mp_bitcnt_t, eval_fun> >(*this, l));   \
   return *this;                                                 \
 }
 


More information about the gmp-commit mailing list