summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2020-10-07 23:29:21 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2020-10-07 23:29:21 +0000
commit027b0247144d5d847b73842ef3bb74a2e9641212 (patch)
tree66586c89da26dc8f0aeb3abb9723d8d450df1684
parent48399d6224df0e59b7848dea05727c19cc86d7d1 (diff)
downloadmpfr-027b0247144d5d847b73842ef3bb74a2e9641212.tar.gz
[src] Consistency: in prototypes, changed
mpz_t to mpz_ptr (mpfr-impl.h, pool.c); mpfr_random_deviate_t to mpfr_random_deviate_ptr (random_deviate.c). Note: This completes the changes I had done in r14103 (2020-08-21) for mpfr_t. This time, the issue was detected by a GCC 11 snapshot, thanks to the -Warray-parameter option (included in -Wall), which was added on 2020-09-19 in GCC commit 6450f07388f9fe575a489c9309c36012b17b88b0. git-svn-id: https://scm.gforge.inria.fr/anonscm/svn/mpfr/trunk@14154 280ebfd0-de03-0410-8827-d642c229c3f4
-rw-r--r--src/mpfr-impl.h2
-rw-r--r--src/pool.c6
-rw-r--r--src/random_deviate.c20
3 files changed, 15 insertions, 13 deletions
diff --git a/src/mpfr-impl.h b/src/mpfr-impl.h
index 90bc2d238..f4d790ab2 100644
--- a/src/mpfr-impl.h
+++ b/src/mpfr-impl.h
@@ -2486,7 +2486,7 @@ __MPFR_DECLSPEC void mpfr_gamma_one_and_two_third (mpfr_ptr, mpfr_ptr,
mpfr_prec_t);
__MPFR_DECLSPEC void mpfr_mpz_init (mpz_ptr);
-__MPFR_DECLSPEC void mpfr_mpz_init2 (mpz_t, mp_bitcnt_t);
+__MPFR_DECLSPEC void mpfr_mpz_init2 (mpz_ptr, mp_bitcnt_t);
__MPFR_DECLSPEC void mpfr_mpz_clear (mpz_ptr);
__MPFR_DECLSPEC int mpfr_odd_p (mpfr_srcptr);
diff --git a/src/pool.c b/src/pool.c
index 775d7875c..9653d004e 100644
--- a/src/pool.c
+++ b/src/pool.c
@@ -35,7 +35,7 @@ static MPFR_THREAD_ATTR int n_alloc = 0;
static MPFR_THREAD_ATTR __mpz_struct mpz_tab[MPFR_POOL_NENTRIES];
MPFR_HOT_FUNCTION_ATTR void
-mpfr_mpz_init (mpz_t z)
+mpfr_mpz_init (mpz_ptr z)
{
if (MPFR_LIKELY (n_alloc > 0))
{
@@ -54,7 +54,7 @@ mpfr_mpz_init (mpz_t z)
}
MPFR_HOT_FUNCTION_ATTR void
-mpfr_mpz_init2 (mpz_t z, mp_bitcnt_t n)
+mpfr_mpz_init2 (mpz_ptr z, mp_bitcnt_t n)
{
/* The condition on n is used below as the argument n will be ignored if
the mpz_t is obtained from the MPFR stack of previously used mpz_t.
@@ -82,7 +82,7 @@ mpfr_mpz_init2 (mpz_t z, mp_bitcnt_t n)
MPFR_HOT_FUNCTION_ATTR void
-mpfr_mpz_clear (mpz_t z)
+mpfr_mpz_clear (mpz_ptr z)
{
/* We only put objects with at most MPFR_POOL_MAX_SIZE in the mpz_t pool,
to avoid it takes too much memory (and anyway the speedup is mainly
diff --git a/src/random_deviate.c b/src/random_deviate.c
index 5888acb9f..dee12b5c5 100644
--- a/src/random_deviate.c
+++ b/src/random_deviate.c
@@ -64,7 +64,7 @@ https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
/* allocate and set to (0,1) */
void
-mpfr_random_deviate_init (mpfr_random_deviate_t x)
+mpfr_random_deviate_init (mpfr_random_deviate_ptr x)
{
mpz_init (x->f);
x->e = 0;
@@ -72,21 +72,22 @@ mpfr_random_deviate_init (mpfr_random_deviate_t x)
/* reset to (0,1) */
void
-mpfr_random_deviate_reset (mpfr_random_deviate_t x)
+mpfr_random_deviate_reset (mpfr_random_deviate_ptr x)
{
x->e = 0;
}
/* deallocate */
void
-mpfr_random_deviate_clear (mpfr_random_deviate_t x)
+mpfr_random_deviate_clear (mpfr_random_deviate_ptr x)
{
mpz_clear (x->f);
}
/* swap two random deviates */
void
-mpfr_random_deviate_swap (mpfr_random_deviate_t x, mpfr_random_deviate_t y)
+mpfr_random_deviate_swap (mpfr_random_deviate_ptr x,
+ mpfr_random_deviate_ptr y)
{
mpfr_random_size_t s;
unsigned long t;
@@ -107,7 +108,7 @@ mpfr_random_deviate_swap (mpfr_random_deviate_t x, mpfr_random_deviate_t y)
/* ensure x has at least k bits */
static void
-random_deviate_generate (mpfr_random_deviate_t x, mpfr_random_size_t k,
+random_deviate_generate (mpfr_random_deviate_ptr x, mpfr_random_size_t k,
gmp_randstate_t r, mpz_t t)
{
/* Various compile time checks on mpfr_random_deviate_t */
@@ -223,7 +224,7 @@ highest_bit_idx (unsigned long x)
/* return position of leading bit, counting from 1 */
static mpfr_random_size_t
-random_deviate_leading_bit (mpfr_random_deviate_t x, gmp_randstate_t r)
+random_deviate_leading_bit (mpfr_random_deviate_ptr x, gmp_randstate_t r)
{
mpfr_random_size_t l;
random_deviate_generate (x, W, r, 0);
@@ -243,7 +244,7 @@ random_deviate_leading_bit (mpfr_random_deviate_t x, gmp_randstate_t r)
/* return kth bit of fraction, representing 2^-k */
int
-mpfr_random_deviate_tstbit (mpfr_random_deviate_t x, mpfr_random_size_t k,
+mpfr_random_deviate_tstbit (mpfr_random_deviate_ptr x, mpfr_random_size_t k,
gmp_randstate_t r)
{
if (k == 0)
@@ -256,7 +257,8 @@ mpfr_random_deviate_tstbit (mpfr_random_deviate_t x, mpfr_random_size_t k,
/* compare two random deviates, x < y */
int
-mpfr_random_deviate_less (mpfr_random_deviate_t x, mpfr_random_deviate_t y,
+mpfr_random_deviate_less (mpfr_random_deviate_ptr x,
+ mpfr_random_deviate_ptr y,
gmp_randstate_t r)
{
mpfr_random_size_t k = 1;
@@ -280,7 +282,7 @@ mpfr_random_deviate_less (mpfr_random_deviate_t x, mpfr_random_deviate_t y,
/* set mpfr_t z = (neg ? -1 : 1) * (n + x) */
int
mpfr_random_deviate_value (int neg, unsigned long n,
- mpfr_random_deviate_t x, mpfr_ptr z,
+ mpfr_random_deviate_ptr x, mpfr_ptr z,
gmp_randstate_t r, mpfr_rnd_t rnd)
{
/* r is used to add as many bits as necessary to match the precision of z */