Shared toom evaluation functions

bodrato at mail.dm.unipi.it bodrato at mail.dm.unipi.it
Fri Nov 20 05:03:53 CET 2009


Niels,

> Or maybe an even better organization would be to always collect the k,
> k-2, ... terms in one variable, the k-1, k-3, ... in another, and then
> only check k & 1 until you get to the subtraction step. That almost
> makes sense, one must also add a shift of the variable corresponding
> to the odd terms, so one would would be something like
>
>   mpn_lshift ((k & 1) ? xp2 : tp, ...);
>
>   neg = mpn_cmp(...);
>   if (neg)
>     addsub(...);
>   else
>     addsub(...); /* Opposite argument order */
>
>   return neg ^ (k & 1);

Sounds very smooth! I agree.

-- 
http://bodrato.it/papers/



More information about the gmp-devel mailing list