Improvements for mpn_mul_fft

Jeunder Yu gis91542 at cis.nctu.edu.tw
Sun Oct 31 03:52:46 CET 2004


Again, I make a mistake :-(
In function mpn_fft_mul_2exp_modF...

>  /* Improve by Jeunder Yu */
>  if (d)
>    {
>      r[0] &= ~cc; /* i.e. r[0] = ~( ~r[0] | cc ), puts cc into complement 
> part */
>      r[n] = CNST_LIMB(1); /* Ensures enough value for mpn_decr_u */
>      ++rd; /* Assumes there is a borrow from r[0..d-1] */
>      /* rd might overflow when sh=GMP_NUMB_BITS-1 */
>      cc = (rd == 0) ? CNST_LIMB(1) : rd;
>      a = r + d + (rd == 0);
>      mpn_decr_u (a, cc);
       ^^^^^^^^^^^^^^^^^^^ The pointer a is mp_srcptr (i.e. point to const 
limb_t)

Change above code to following code

>  if (d)
>    {
       mp_ptr _r;

>      r[0] &= ~cc; /* i.e. r[0] = ~( ~r[0] | cc ), puts cc into complement 
> part */
>      r[n] = CNST_LIMB(1); /* Ensures enough value for mpn_decr_u */
>      ++rd; /* Assumes there is a borrow from r[0..d-1] */
>      /* rd might overflow when sh=GMP_NUMB_BITS-1 */
>      cc = (rd == 0) ? CNST_LIMB(1) : rd;
       _r = r + d + (rd == 0);
       mpn_decr_u (_r, cc);


I don't know whether gmp accept my improvement. :-)

--
Jeunder Yu 




More information about the gmp-devel mailing list