From 0d90e4faa825b9c034d867fe72894e32617eee53 Mon Sep 17 00:00:00 2001 From: wbhart Date: Wed, 27 May 2009 15:58:27 +0000 Subject: [PATCH] Fixed a bug in FFT squaring code. --- mpn/generic/mul_fft.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mpn/generic/mul_fft.c b/mpn/generic/mul_fft.c index c9364752..f26e158a 100644 --- a/mpn/generic/mul_fft.c +++ b/mpn/generic/mul_fft.c @@ -2228,7 +2228,7 @@ mpn_mul_fft_aux (mp_ptr op, mp_size_t pl, n = nn; nl = pl + i; } - if (ml > pl) + if ((!sqr) && (ml > pl)) { mp_ptr mm = TMP_ALLOC_LIMBS(pl + (b == 1)); 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; ml = pl + i; } + else if (sqr) + { + m = n; + ml = nl; + } /* 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 */