[Gmp-commit] /var/hg/gmp-5.1: 2 new changesets
mercurial at gmplib.org
mercurial at gmplib.org
Tue Jul 16 15:53:14 CEST 2013
details: /var/hg/gmp-5.1/rev/adcffef024ec
changeset: 15432:adcffef024ec
user: Torbjorn Granlund <tege at gmplib.org>
date: Tue Jul 16 15:52:44 2013 +0200
description:
Declare countless of function arguments as 'const'.
details: /var/hg/gmp-5.1/rev/4dccfce07204
changeset: 15433:4dccfce07204
user: Torbjorn Granlund <tege at gmplib.org>
date: Tue Jul 16 15:52:59 2013 +0200
description:
ChangeLog
diffstat:
ChangeLog | 4 +
doc/gmp.texi | 408 +++++++++++++++++++++++++++++-----------------------------
2 files changed, 208 insertions(+), 204 deletions(-)
diffs (truncated from 1117 to 300 lines):
diff -r 2f713a66716b -r 4dccfce07204 ChangeLog
--- a/ChangeLog Fri Jul 12 12:21:23 2013 +0200
+++ b/ChangeLog Tue Jul 16 15:52:59 2013 +0200
@@ -1,3 +1,7 @@
+2013-07-16 Torbjorn Granlund <tege at gmplib.org>
+
+ * doc/gmp.texi: Declare countless of function arguments as 'const'.
+
2013-07-12 Torbjorn Granlund <tege at gmplib.org>
* mpn/generic/sbpi1_div_sec.c: Partial rewrite.
diff -r 2f713a66716b -r 4dccfce07204 doc/gmp.texi
--- a/doc/gmp.texi Fri Jul 12 12:21:23 2013 +0200
+++ b/doc/gmp.texi Tue Jul 16 15:52:59 2013 +0200
@@ -3034,19 +3034,19 @@
These functions assign new values to already initialized integers
(@pxref{Initializing Integers}).
- at deftypefun void mpz_set (mpz_t @var{rop}, mpz_t @var{op})
+ at deftypefun void mpz_set (mpz_t @var{rop}, const mpz_t @var{op})
@deftypefunx void mpz_set_ui (mpz_t @var{rop}, unsigned long int @var{op})
@deftypefunx void mpz_set_si (mpz_t @var{rop}, signed long int @var{op})
@deftypefunx void mpz_set_d (mpz_t @var{rop}, double @var{op})
- at deftypefunx void mpz_set_q (mpz_t @var{rop}, mpq_t @var{op})
- at deftypefunx void mpz_set_f (mpz_t @var{rop}, mpf_t @var{op})
+ at deftypefunx void mpz_set_q (mpz_t @var{rop}, const mpq_t @var{op})
+ at deftypefunx void mpz_set_f (mpz_t @var{rop}, const mpf_t @var{op})
Set the value of @var{rop} from @var{op}.
@code{mpz_set_d}, @code{mpz_set_q} and @code{mpz_set_f} truncate @var{op} to
make it an integer.
@end deftypefun
- at deftypefun int mpz_set_str (mpz_t @var{rop}, char *@var{str}, int @var{base})
+ at deftypefun int mpz_set_str (mpz_t @var{rop}, const char *@var{str}, int @var{base})
Set the value of @var{rop} from @var{str}, a null-terminated C string in base
@var{base}. White space is allowed in the string, and is simply ignored.
@@ -3105,7 +3105,7 @@
integer functions. Don't use an initialize-and-set function on a variable
already initialized!
- at deftypefun void mpz_init_set (mpz_t @var{rop}, mpz_t @var{op})
+ at deftypefun void mpz_init_set (mpz_t @var{rop}, const mpz_t @var{op})
@deftypefunx void mpz_init_set_ui (mpz_t @var{rop}, unsigned long int @var{op})
@deftypefunx void mpz_init_set_si (mpz_t @var{rop}, signed long int @var{op})
@deftypefunx void mpz_init_set_d (mpz_t @var{rop}, double @var{op})
@@ -3113,7 +3113,7 @@
@var{op}.
@end deftypefun
- at deftypefun int mpz_init_set_str (mpz_t @var{rop}, char *@var{str}, int @var{base})
+ at deftypefun int mpz_init_set_str (mpz_t @var{rop}, const char *@var{str}, int @var{base})
Initialize @var{rop} and set its value like @code{mpz_set_str} (see its
documentation above for details).
@@ -3133,7 +3133,7 @@
types. Functions for converting @emph{to} GMP integers are described in
@ref{Assigning Integers} and @ref{I/O of Integers}.
- at deftypefun {unsigned long int} mpz_get_ui (mpz_t @var{op})
+ at deftypefun {unsigned long int} mpz_get_ui (const mpz_t @var{op})
Return the value of @var{op} as an @code{unsigned long}.
If @var{op} is too big to fit an @code{unsigned long} then just the least
@@ -3141,7 +3141,7 @@
only the absolute value is used.
@end deftypefun
- at deftypefun {signed long int} mpz_get_si (mpz_t @var{op})
+ at deftypefun {signed long int} mpz_get_si (const mpz_t @var{op})
If @var{op} fits into a @code{signed long int} return the value of @var{op}.
Otherwise return the least significant part of @var{op}, with the same sign
as @var{op}.
@@ -3151,7 +3151,7 @@
the function @code{mpz_fits_slong_p}.
@end deftypefun
- at deftypefun double mpz_get_d (mpz_t @var{op})
+ at deftypefun double mpz_get_d (const mpz_t @var{op})
Convert @var{op} to a @code{double}, truncating if necessary (i.e.@: rounding
towards zero).
@@ -3160,7 +3160,7 @@
may or may not occur.
@end deftypefun
- at deftypefun double mpz_get_d_2exp (signed long int *@var{exp}, mpz_t @var{op})
+ at deftypefun double mpz_get_d_2exp (signed long int *@var{exp}, const mpz_t @var{op})
Convert @var{op} to a @code{double}, truncating if necessary (i.e.@: rounding
towards zero), and returning the exponent separately.
@@ -3174,7 +3174,7 @@
Functions,,, libc, The GNU C Library Reference Manual}).
@end deftypefun
- at deftypefun {char *} mpz_get_str (char *@var{str}, int @var{base}, mpz_t @var{op})
+ at deftypefun {char *} mpz_get_str (char *@var{str}, int @var{base}, const mpz_t @var{op})
Convert @var{op} to a string of digits in base @var{base}. The base argument
may vary from 2 to 62 or from @minus{}2 to @minus{}36.
@@ -3205,45 +3205,45 @@
@cindex Integer arithmetic functions
@cindex Arithmetic functions
- at deftypefun void mpz_add (mpz_t @var{rop}, mpz_t @var{op1}, mpz_t @var{op2})
- at deftypefunx void mpz_add_ui (mpz_t @var{rop}, mpz_t @var{op1}, unsigned long int @var{op2})
+ at deftypefun void mpz_add (mpz_t @var{rop}, const mpz_t @var{op1}, const mpz_t @var{op2})
+ at deftypefunx void mpz_add_ui (mpz_t @var{rop}, const mpz_t @var{op1}, unsigned long int @var{op2})
Set @var{rop} to @math{@var{op1} + @var{op2}}.
@end deftypefun
- at deftypefun void mpz_sub (mpz_t @var{rop}, mpz_t @var{op1}, mpz_t @var{op2})
- at deftypefunx void mpz_sub_ui (mpz_t @var{rop}, mpz_t @var{op1}, unsigned long int @var{op2})
- at deftypefunx void mpz_ui_sub (mpz_t @var{rop}, unsigned long int @var{op1}, mpz_t @var{op2})
+ at deftypefun void mpz_sub (mpz_t @var{rop}, const mpz_t @var{op1}, const mpz_t @var{op2})
+ at deftypefunx void mpz_sub_ui (mpz_t @var{rop}, const mpz_t @var{op1}, unsigned long int @var{op2})
+ at deftypefunx void mpz_ui_sub (mpz_t @var{rop}, unsigned long int @var{op1}, const mpz_t @var{op2})
Set @var{rop} to @var{op1} @minus{} @var{op2}.
@end deftypefun
- at deftypefun void mpz_mul (mpz_t @var{rop}, mpz_t @var{op1}, mpz_t @var{op2})
- at deftypefunx void mpz_mul_si (mpz_t @var{rop}, mpz_t @var{op1}, long int @var{op2})
- at deftypefunx void mpz_mul_ui (mpz_t @var{rop}, mpz_t @var{op1}, unsigned long int @var{op2})
+ at deftypefun void mpz_mul (mpz_t @var{rop}, const mpz_t @var{op1}, const mpz_t @var{op2})
+ at deftypefunx void mpz_mul_si (mpz_t @var{rop}, const mpz_t @var{op1}, long int @var{op2})
+ at deftypefunx void mpz_mul_ui (mpz_t @var{rop}, const mpz_t @var{op1}, unsigned long int @var{op2})
Set @var{rop} to @math{@var{op1} @GMPtimes{} @var{op2}}.
@end deftypefun
- at deftypefun void mpz_addmul (mpz_t @var{rop}, mpz_t @var{op1}, mpz_t @var{op2})
- at deftypefunx void mpz_addmul_ui (mpz_t @var{rop}, mpz_t @var{op1}, unsigned long int @var{op2})
+ at deftypefun void mpz_addmul (mpz_t @var{rop}, const mpz_t @var{op1}, const mpz_t @var{op2})
+ at deftypefunx void mpz_addmul_ui (mpz_t @var{rop}, const mpz_t @var{op1}, unsigned long int @var{op2})
Set @var{rop} to @math{@var{rop} + @var{op1} @GMPtimes{} @var{op2}}.
@end deftypefun
- at deftypefun void mpz_submul (mpz_t @var{rop}, mpz_t @var{op1}, mpz_t @var{op2})
- at deftypefunx void mpz_submul_ui (mpz_t @var{rop}, mpz_t @var{op1}, unsigned long int @var{op2})
+ at deftypefun void mpz_submul (mpz_t @var{rop}, const mpz_t @var{op1}, const mpz_t @var{op2})
+ at deftypefunx void mpz_submul_ui (mpz_t @var{rop}, const mpz_t @var{op1}, unsigned long int @var{op2})
Set @var{rop} to @math{@var{rop} - @var{op1} @GMPtimes{} @var{op2}}.
@end deftypefun
- at deftypefun void mpz_mul_2exp (mpz_t @var{rop}, mpz_t @var{op1}, mp_bitcnt_t @var{op2})
+ at deftypefun void mpz_mul_2exp (mpz_t @var{rop}, const mpz_t @var{op1}, mp_bitcnt_t @var{op2})
@cindex Bit shift left
Set @var{rop} to @m{@var{op1} \times 2^{op2}, @var{op1} times 2 raised to
@var{op2}}. This operation can also be defined as a left shift by @var{op2}
bits.
@end deftypefun
- at deftypefun void mpz_neg (mpz_t @var{rop}, mpz_t @var{op})
+ at deftypefun void mpz_neg (mpz_t @var{rop}, const mpz_t @var{op})
Set @var{rop} to @minus{}@var{op}.
@end deftypefun
- at deftypefun void mpz_abs (mpz_t @var{rop}, mpz_t @var{op})
+ at deftypefun void mpz_abs (mpz_t @var{rop}, const mpz_t @var{op})
Set @var{rop} to the absolute value of @var{op}.
@end deftypefun
@@ -3264,43 +3264,43 @@
@c between each, and seem to let tex do a better job of page breaks than an
@c @sp 1 in the middle of one big set.
- at deftypefun void mpz_cdiv_q (mpz_t @var{q}, mpz_t @var{n}, mpz_t @var{d})
- at deftypefunx void mpz_cdiv_r (mpz_t @var{r}, mpz_t @var{n}, mpz_t @var{d})
- at deftypefunx void mpz_cdiv_qr (mpz_t @var{q}, mpz_t @var{r}, mpz_t @var{n}, mpz_t @var{d})
+ at deftypefun void mpz_cdiv_q (mpz_t @var{q}, const mpz_t @var{n}, const mpz_t @var{d})
+ at deftypefunx void mpz_cdiv_r (mpz_t @var{r}, const mpz_t @var{n}, const mpz_t @var{d})
+ at deftypefunx void mpz_cdiv_qr (mpz_t @var{q}, mpz_t @var{r}, const mpz_t @var{n}, const mpz_t @var{d})
@maybepagebreak
- at deftypefunx {unsigned long int} mpz_cdiv_q_ui (mpz_t @var{q}, mpz_t @var{n}, @w{unsigned long int @var{d}})
- at deftypefunx {unsigned long int} mpz_cdiv_r_ui (mpz_t @var{r}, mpz_t @var{n}, @w{unsigned long int @var{d}})
- at deftypefunx {unsigned long int} mpz_cdiv_qr_ui (mpz_t @var{q}, mpz_t @var{r}, @w{mpz_t @var{n}}, @w{unsigned long int @var{d}})
- at deftypefunx {unsigned long int} mpz_cdiv_ui (mpz_t @var{n}, @w{unsigned long int @var{d}})
+ at deftypefunx {unsigned long int} mpz_cdiv_q_ui (mpz_t @var{q}, const mpz_t @var{n}, @w{unsigned long int @var{d}})
+ at deftypefunx {unsigned long int} mpz_cdiv_r_ui (mpz_t @var{r}, const mpz_t @var{n}, @w{unsigned long int @var{d}})
+ at deftypefunx {unsigned long int} mpz_cdiv_qr_ui (mpz_t @var{q}, mpz_t @var{r}, @w{const mpz_t @var{n}}, @w{unsigned long int @var{d}})
+ at deftypefunx {unsigned long int} mpz_cdiv_ui (const mpz_t @var{n}, @w{unsigned long int @var{d}})
@maybepagebreak
- at deftypefunx void mpz_cdiv_q_2exp (mpz_t @var{q}, mpz_t @var{n}, @w{mp_bitcnt_t @var{b}})
- at deftypefunx void mpz_cdiv_r_2exp (mpz_t @var{r}, mpz_t @var{n}, @w{mp_bitcnt_t @var{b}})
- at end deftypefun
-
- at deftypefun void mpz_fdiv_q (mpz_t @var{q}, mpz_t @var{n}, mpz_t @var{d})
- at deftypefunx void mpz_fdiv_r (mpz_t @var{r}, mpz_t @var{n}, mpz_t @var{d})
- at deftypefunx void mpz_fdiv_qr (mpz_t @var{q}, mpz_t @var{r}, mpz_t @var{n}, mpz_t @var{d})
+ at deftypefunx void mpz_cdiv_q_2exp (const mpz_t @var{q}, mpz_t @var{n}, @w{mp_bitcnt_t @var{b}})
+ at deftypefunx void mpz_cdiv_r_2exp (const mpz_t @var{r}, mpz_t @var{n}, @w{mp_bitcnt_t @var{b}})
+ at end deftypefun
+
+ at deftypefun void mpz_fdiv_q (mpz_t @var{q}, const mpz_t @var{n}, const mpz_t @var{d})
+ at deftypefunx void mpz_fdiv_r (mpz_t @var{r}, const mpz_t @var{n}, const mpz_t @var{d})
+ at deftypefunx void mpz_fdiv_qr (mpz_t @var{q}, mpz_t @var{r}, const mpz_t @var{n}, const mpz_t @var{d})
@maybepagebreak
- at deftypefunx {unsigned long int} mpz_fdiv_q_ui (mpz_t @var{q}, mpz_t @var{n}, @w{unsigned long int @var{d}})
- at deftypefunx {unsigned long int} mpz_fdiv_r_ui (mpz_t @var{r}, mpz_t @var{n}, @w{unsigned long int @var{d}})
- at deftypefunx {unsigned long int} mpz_fdiv_qr_ui (mpz_t @var{q}, mpz_t @var{r}, @w{mpz_t @var{n}}, @w{unsigned long int @var{d}})
- at deftypefunx {unsigned long int} mpz_fdiv_ui (mpz_t @var{n}, @w{unsigned long int @var{d}})
+ at deftypefunx {unsigned long int} mpz_fdiv_q_ui (mpz_t @var{q}, const mpz_t @var{n}, @w{unsigned long int @var{d}})
+ at deftypefunx {unsigned long int} mpz_fdiv_r_ui (mpz_t @var{r}, const mpz_t @var{n}, @w{unsigned long int @var{d}})
+ at deftypefunx {unsigned long int} mpz_fdiv_qr_ui (mpz_t @var{q}, mpz_t @var{r}, @w{const mpz_t @var{n}}, @w{unsigned long int @var{d}})
+ at deftypefunx {unsigned long int} mpz_fdiv_ui (const mpz_t @var{n}, @w{unsigned long int @var{d}})
@maybepagebreak
- at deftypefunx void mpz_fdiv_q_2exp (mpz_t @var{q}, mpz_t @var{n}, @w{mp_bitcnt_t @var{b}})
- at deftypefunx void mpz_fdiv_r_2exp (mpz_t @var{r}, mpz_t @var{n}, @w{mp_bitcnt_t @var{b}})
- at end deftypefun
-
- at deftypefun void mpz_tdiv_q (mpz_t @var{q}, mpz_t @var{n}, mpz_t @var{d})
- at deftypefunx void mpz_tdiv_r (mpz_t @var{r}, mpz_t @var{n}, mpz_t @var{d})
- at deftypefunx void mpz_tdiv_qr (mpz_t @var{q}, mpz_t @var{r}, mpz_t @var{n}, mpz_t @var{d})
+ at deftypefunx void mpz_fdiv_q_2exp (mpz_t @var{q}, const mpz_t @var{n}, @w{mp_bitcnt_t @var{b}})
+ at deftypefunx void mpz_fdiv_r_2exp (mpz_t @var{r}, const mpz_t @var{n}, @w{mp_bitcnt_t @var{b}})
+ at end deftypefun
+
+ at deftypefun void mpz_tdiv_q (mpz_t @var{q}, const mpz_t @var{n}, const mpz_t @var{d})
+ at deftypefunx void mpz_tdiv_r (mpz_t @var{r}, const mpz_t @var{n}, const mpz_t @var{d})
+ at deftypefunx void mpz_tdiv_qr (mpz_t @var{q}, mpz_t @var{r}, const mpz_t @var{n}, const mpz_t @var{d})
@maybepagebreak
- at deftypefunx {unsigned long int} mpz_tdiv_q_ui (mpz_t @var{q}, mpz_t @var{n}, @w{unsigned long int @var{d}})
- at deftypefunx {unsigned long int} mpz_tdiv_r_ui (mpz_t @var{r}, mpz_t @var{n}, @w{unsigned long int @var{d}})
- at deftypefunx {unsigned long int} mpz_tdiv_qr_ui (mpz_t @var{q}, mpz_t @var{r}, @w{mpz_t @var{n}}, @w{unsigned long int @var{d}})
- at deftypefunx {unsigned long int} mpz_tdiv_ui (mpz_t @var{n}, @w{unsigned long int @var{d}})
+ at deftypefunx {unsigned long int} mpz_tdiv_q_ui (mpz_t @var{q}, const mpz_t @var{n}, @w{unsigned long int @var{d}})
+ at deftypefunx {unsigned long int} mpz_tdiv_r_ui (mpz_t @var{r}, const mpz_t @var{n}, @w{unsigned long int @var{d}})
+ at deftypefunx {unsigned long int} mpz_tdiv_qr_ui (mpz_t @var{q}, mpz_t @var{r}, @w{const mpz_t @var{n}}, @w{unsigned long int @var{d}})
+ at deftypefunx {unsigned long int} mpz_tdiv_ui (const mpz_t @var{n}, @w{unsigned long int @var{d}})
@maybepagebreak
- at deftypefunx void mpz_tdiv_q_2exp (mpz_t @var{q}, mpz_t @var{n}, @w{mp_bitcnt_t @var{b}})
- at deftypefunx void mpz_tdiv_r_2exp (mpz_t @var{r}, mpz_t @var{n}, @w{mp_bitcnt_t @var{b}})
+ at deftypefunx void mpz_tdiv_q_2exp (mpz_t @var{q}, const mpz_t @var{n}, @w{mp_bitcnt_t @var{b}})
+ at deftypefunx void mpz_tdiv_r_2exp (mpz_t @var{r}, const mpz_t @var{n}, @w{mp_bitcnt_t @var{b}})
@cindex Bit shift right
@sp 1
@@ -3348,8 +3348,8 @@
effectively treats @var{n} as sign and magnitude.
@end deftypefun
- at deftypefun void mpz_mod (mpz_t @var{r}, mpz_t @var{n}, mpz_t @var{d})
- at deftypefunx {unsigned long int} mpz_mod_ui (mpz_t @var{r}, mpz_t @var{n}, @w{unsigned long int @var{d}})
+ at deftypefun void mpz_mod (mpz_t @var{r}, const mpz_t @var{n}, const mpz_t @var{d})
+ at deftypefunx {unsigned long int} mpz_mod_ui (mpz_t @var{r}, const mpz_t @var{n}, @w{unsigned long int @var{d}})
Set @var{r} to @var{n} @code{mod} @var{d}. The sign of the divisor is
ignored; the result is always non-negative.
@@ -3358,8 +3358,8 @@
the return value is wanted.
@end deftypefun
- at deftypefun void mpz_divexact (mpz_t @var{q}, mpz_t @var{n}, mpz_t @var{d})
- at deftypefunx void mpz_divexact_ui (mpz_t @var{q}, mpz_t @var{n}, unsigned long @var{d})
+ at deftypefun void mpz_divexact (mpz_t @var{q}, const mpz_t @var{n}, const mpz_t @var{d})
+ at deftypefunx void mpz_divexact_ui (mpz_t @var{q}, const mpz_t @var{n}, unsigned long @var{d})
@cindex Exact division functions
Set @var{q} to @var{n}/@var{d}. These functions produce correct results only
when it is known in advance that @var{d} divides @var{n}.
@@ -3369,9 +3369,9 @@
rational to lowest terms.
@end deftypefun
- at deftypefun int mpz_divisible_p (mpz_t @var{n}, mpz_t @var{d})
- at deftypefunx int mpz_divisible_ui_p (mpz_t @var{n}, unsigned long int @var{d})
- at deftypefunx int mpz_divisible_2exp_p (mpz_t @var{n}, mp_bitcnt_t @var{b})
+ at deftypefun int mpz_divisible_p (const mpz_t @var{n}, const mpz_t @var{d})
+ at deftypefunx int mpz_divisible_ui_p (const mpz_t @var{n}, unsigned long int @var{d})
+ at deftypefunx int mpz_divisible_2exp_p (const mpz_t @var{n}, mp_bitcnt_t @var{b})
@cindex Divisibility functions
Return non-zero if @var{n} is exactly divisible by @var{d}, or in the case of
@code{mpz_divisible_2exp_p} by @m{2^b,2^@var{b}}.
@@ -3382,9 +3382,9 @@
that only 0 is considered divisible by 0.
@end deftypefun
- at deftypefun int mpz_congruent_p (mpz_t @var{n}, mpz_t @var{c}, mpz_t @var{d})
- at deftypefunx int mpz_congruent_ui_p (mpz_t @var{n}, unsigned long int @var{c}, unsigned long int @var{d})
- at deftypefunx int mpz_congruent_2exp_p (mpz_t @var{n}, mpz_t @var{c}, mp_bitcnt_t @var{b})
+ at deftypefun int mpz_congruent_p (const mpz_t @var{n}, const mpz_t @var{c}, const mpz_t @var{d})
+ at deftypefunx int mpz_congruent_ui_p (const mpz_t @var{n}, unsigned long int @var{c}, unsigned long int @var{d})
+ at deftypefunx int mpz_congruent_2exp_p (const mpz_t @var{n}, const mpz_t @var{c}, mp_bitcnt_t @var{b})
@cindex Divisibility functions
@cindex Congruence functions
Return non-zero if @var{n} is congruent to @var{c} modulo @var{d}, or in the
@@ -3405,8 +3405,8 @@
@cindex Exponentiation functions
@cindex Powering functions
- at deftypefun void mpz_powm (mpz_t @var{rop}, mpz_t @var{base}, mpz_t @var{exp}, mpz_t @var{mod})
- at deftypefunx void mpz_powm_ui (mpz_t @var{rop}, mpz_t @var{base}, unsigned long int @var{exp}, mpz_t @var{mod})
+ at deftypefun void mpz_powm (mpz_t @var{rop}, const mpz_t @var{base}, const mpz_t @var{exp}, const mpz_t @var{mod})
+ at deftypefunx void mpz_powm_ui (mpz_t @var{rop}, const mpz_t @var{base}, unsigned long int @var{exp}, const mpz_t @var{mod})
Set @var{rop} to @m{base^{exp} \bmod mod, (@var{base} raised to @var{exp})
modulo @var{mod}}.
@@ -3415,7 +3415,7 @@
If an inverse doesn't exist then a divide by zero is raised.
@end deftypefun
More information about the gmp-commit
mailing list