summaryrefslogtreecommitdiff
path: root/mpz/urandomm.c
diff options
context:
space:
mode:
authorTorbjorn Granlund <tege@gmplib.org>2009-04-08 10:20:31 +0200
committerTorbjorn Granlund <tege@gmplib.org>2009-04-08 10:20:31 +0200
commitf4385af730ab05462a8693b0e9617a8ec4cff8e0 (patch)
tree2e334bc81c5b5648307665c3e45d34b4dcfaa718 /mpz/urandomm.c
parent06416243777cb2b1c99c7b1562fdd3002dde45ca (diff)
downloadgmp-f4385af730ab05462a8693b0e9617a8ec4cff8e0.tar.gz
Amend last fix.
Diffstat (limited to 'mpz/urandomm.c')
-rw-r--r--mpz/urandomm.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/mpz/urandomm.c b/mpz/urandomm.c
index 2be101b62..b8a6d6898 100644
--- a/mpz/urandomm.c
+++ b/mpz/urandomm.c
@@ -60,12 +60,6 @@ mpz_urandomm (mpz_ptr rop, gmp_randstate_t rstate, mpz_srcptr n)
return;
}
- /* Here the allocated size can be one too much if n is a power of
- (2^GMP_NUMB_BITS) but it's convenient for using mpn_cmp below. */
- rp = MPZ_REALLOC (rop, size);
- /* Clear last limb to prevent the case in which size is one too much. */
- rp[size - 1] = 0;
-
TMP_MARK;
np = PTR (n);
if (rop == n)
@@ -76,6 +70,12 @@ mpz_urandomm (mpz_ptr rop, gmp_randstate_t rstate, mpz_srcptr n)
np = tp;
}
+ /* Here the allocated size can be one too much if n is a power of
+ (2^GMP_NUMB_BITS) but it's convenient for using mpn_cmp below. */
+ rp = MPZ_REALLOC (rop, size);
+ /* Clear last limb to prevent the case in which size is one too much. */
+ rp[size - 1] = 0;
+
count = MAX_URANDOMM_ITER; /* Set iteration count limit. */
do
{