[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: seg fault in mpz_root patch
From: |
Torbjorn Granlund |
Subject: |
Re: seg fault in mpz_root patch |
Date: |
19 Dec 2002 02:17:49 +0100 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 |
Jason Moxham <address@hidden> writes:
patch against gmp-4.1.1 attached
--- gmp-4.1.1/mpn/generic/rootrem.c 2002-12-13 02:27:44.000000000 +0000
+++ rootrem.c 2002-12-13 02:16:41.000000000 +0000
@@ -65,7 +65,16 @@
TMP_DECL (marker);
TMP_MARK (marker);
- pp = TMP_ALLOC_LIMBS (un + 2);
+
+ /*
+ As the approximate root can be larger than the actual root by at most
+ a factor of 2 , we need to allow space for another "nth" bits when
+ powering it using mpn_pow_1 , this is a large overestimate that only
+ applies in rare cases i.e. when k is large and the root is small
+ FIXME : change this awful allocation before gmp 4.2
+ */
+
+ pp = TMP_ALLOC_LIMBS (un + 2 + (nth - 1) / GMP_NUMB_BITS + 1);
count_leading_zeros (cnt, up[un - 1]);
unb = un * GMP_NUMB_BITS - cnt + GMP_NAIL_BITS;
Here is what I believe to be a better patch:
pat
Description: Binary data
--
Torbjörn
- Re: seg fault in mpz_root, (continued)
- Re: seg fault in mpz_root, Kevin Ryde, 2002/12/10
- Re: seg fault in mpz_root, Jason Moxham, 2002/12/10
- Re: seg fault in mpz_root patch, Jason Moxham, 2002/12/12
- Re: seg fault in mpz_root patch, Kevin Ryde, 2002/12/16
- Re: seg fault in mpz_root patch, Kevin Ryde, 2002/12/16
- Re: seg fault in mpz_root patch, Jason Moxham, 2002/12/16
- Re: seg fault in mpz_root patch, Kevin Ryde, 2002/12/17
- Re: seg fault in mpz_root patch,
Torbjorn Granlund <=