summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Bodrato <bodrato@mail.dm.unipi.it>2014-05-20 19:44:39 +0200
committerMarco Bodrato <bodrato@mail.dm.unipi.it>2014-05-20 19:44:39 +0200
commitc223ef16d7fe706becb8c815688820a6a0fa66d6 (patch)
tree064c5d983ece8ee3b3ffa50541d3f8e580ce3ef7
parent7850a2847129193c8fe15ba0e7105d859fe6aea8 (diff)
downloadgmp-c223ef16d7fe706becb8c815688820a6a0fa66d6.tar.gz
+1 in the init2 argument before setbit. (Thanks Niels)
-rw-r--r--gen-fac.c4
-rw-r--r--gen-fib.c2
-rw-r--r--mini-gmp/mini-gmp.c2
-rw-r--r--rand/randmts.c4
4 files changed, 6 insertions, 6 deletions
diff --git a/gen-fac.c b/gen-fac.c
index b1756a611..197bdef71 100644
--- a/gen-fac.c
+++ b/gen-fac.c
@@ -1,6 +1,6 @@
/* Generate data for combinatorics: fac_ui, bin_uiui, ...
-Copyright 2002, 2011-2013 Free Software Foundation, Inc.
+Copyright 2002, 2011-2014 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -101,7 +101,7 @@ gen_consts (int numb, int nail, int limb)
ofl = b - 1;
printf
("#define ODD_FACTORIAL_TABLE_LIMIT (%lu)\n", ofl);
- mpz_init2 (mask, numb);
+ mpz_init2 (mask, numb + 1);
mpz_setbit (mask, numb);
mpz_sub_ui (mask, mask, 1);
printf
diff --git a/gen-fib.c b/gen-fib.c
index 6f62b166a..1fd74c5f0 100644
--- a/gen-fib.c
+++ b/gen-fib.c
@@ -40,7 +40,7 @@ generate (int numb_bits)
mpz_t limit, l;
int falloc, i;
- mpz_init2 (limit, numb_bits);
+ mpz_init2 (limit, numb_bits + 1);
mpz_setbit (limit, numb_bits);
/* fib(2n) > 2^n, so use 2n as a limit for the table size */
diff --git a/mini-gmp/mini-gmp.c b/mini-gmp/mini-gmp.c
index 85b747ac0..2cf036740 100644
--- a/mini-gmp/mini-gmp.c
+++ b/mini-gmp/mini-gmp.c
@@ -3207,7 +3207,7 @@ mpz_rootrem (mpz_t x, mpz_t r, const mpz_t y, unsigned long z)
{
mp_bitcnt_t tb;
tb = mpz_sizeinbase (y, 2) / z + 1;
- mpz_init2 (t, tb);
+ mpz_init2 (t, tb + 1);
mpz_setbit (t, tb);
}
diff --git a/rand/randmts.c b/rand/randmts.c
index 1db785514..7c1c262f5 100644
--- a/rand/randmts.c
+++ b/rand/randmts.c
@@ -1,6 +1,6 @@
/* Mersenne Twister pseudo-random number generator functions.
-Copyright 2002, 2003, 2013 Free Software Foundation, Inc.
+Copyright 2002, 2003, 2013, 2014 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -117,7 +117,7 @@ randseed_mt (gmp_randstate_t rstate, mpz_srcptr seed)
p = (gmp_rand_mt_struct *) RNG_STATE (rstate);
- mpz_init2 (mod, 19937L);
+ mpz_init2 (mod, 19938L);
mpz_init2 (seed1, 19937L);
mpz_setbit (mod, 19937L);