Fixed a bug in FFT squaring code.

This commit is contained in:
wbhart 2009-05-27 15:58:27 +00:00
parent 749c195a7c
commit 0d90e4faa8

View File

@ -2228,7 +2228,7 @@ mpn_mul_fft_aux (mp_ptr op, mp_size_t pl,
n = nn; n = nn;
nl = pl + i; nl = pl + i;
} }
if (ml > pl) if ((!sqr) && (ml > pl))
{ {
mp_ptr mm = TMP_ALLOC_LIMBS(pl + (b == 1)); mp_ptr mm = TMP_ALLOC_LIMBS(pl + (b == 1));
if ((i = (mp_size_t)mpn_fft_norm_modF (mm, pl, m, ml, b))) if ((i = (mp_size_t)mpn_fft_norm_modF (mm, pl, m, ml, b)))
@ -2236,6 +2236,11 @@ mpn_mul_fft_aux (mp_ptr op, mp_size_t pl,
m = mm; m = mm;
ml = pl + i; ml = pl + i;
} }
else if (sqr)
{
m = n;
ml = nl;
}
/* now nl,ml <= pl if b=-1, nl,ml <= pl+1 if b=1 */ /* now nl,ml <= pl if b=-1, nl,ml <= pl+1 if b=1 */
N = MUL_GMP_NUMB_BITS(pl); /* The entire integer product will be mod 2^N+b */ N = MUL_GMP_NUMB_BITS(pl); /* The entire integer product will be mod 2^N+b */