Re: mul_fft, cleaning up some details of the code

2022-03-08 Thread Marco Bodrato
Ciao Paul, Il 2022-03-07 10:28 Paul Zimmermann ha scritto: Date: Sun, 06 Mar 2022 11:14:49 +0100 From: Marco Bodrato Specifically I'd focus into a suspicious piece of code, shared by both our current code and Vivien's. if (cy >= 0) cy = mpn_add_1 (tmp, tmp, Kl, cy);

Re: mul_fft, cleaning up some details of the code

2022-03-08 Thread Paul Zimmermann
Hi Marco, > Since you deeply know how this code works, I ask you one more question. > The last lines of the function mpn_fft_mul_2exp_modF (branch m < n) > contain: > >/* now subtract cc and rd from r[m..n] */ > >r[n] = -mpn_sub_1 (r + m, r + m, n - m, cc); >r[n] -= mpn_sub_1

Re: mul_fft, cleaning up some details of the code

2022-03-08 Thread Marco Bodrato
Ciao Paul, Il 2022-03-08 12:56 Paul Zimmermann ha scritto: Since you deeply know how this code works, I ask you one more question. The last lines of the function mpn_fft_mul_2exp_modF (branch m < n) contain: /* now subtract cc and rd from r[m..n] */ r[n] = -mpn_sub_1 (r + m, r + m, n -

Re: mul_fft, cleaning up some details of the code

2022-03-08 Thread Paul Zimmermann
Dear Marco, > Uhm, the last line of code just before that ones is: > >cc = mpn_sub_1 (r, r, m, cc) + 1; >/* add 1 to cc instead of rd since rd might overflow */ > > So that I'd say that cc is 1 or 2. > Then the case cc=2, m=n-1, r[m]=0, and rd=GMP_NUMB_MAX seems very very > unlik

Re: mul_fft, cleaning up some details of the code

2022-03-08 Thread Marco Bodrato
Ciao Paul, Il 2022-03-08 16:20 Paul Zimmermann ha scritto: Uhm, the last line of code just before that ones is: cc = mpn_sub_1 (r, r, m, cc) + 1; /* add 1 to cc instead of rd since rd might overflow */ it seems you are right! Well, I pushed a clean-up for that portion of the code too