wrap-around interface

Zimmermann Paul Paul.Zimmermann at loria.fr
Thu Oct 18 09:09:08 CEST 2012


       Hi GMP developers,

following your answers yesterday, we'll use the following "wrap-around"
interface in GMP-ECM for the next release after GMP 5.1.0 (which is planned
for 2012 according to http://gmplib.org/#FUTURE), or for GMP 5.1.0 if those
functions are already available. This means that if those functions are not
available in GMP > 5.1.0, GMP-ECM will define some (slow) replacement
functions.

Paul Zimmermann

void mpn_mulmod_bnm1 (mp_ptr rp, mp_size_t rn, mp_srcptr ap, mp_size_t an,
                      mp_srcptr, bp, mp_size_t bn, mp_ptr tp)
Multiplies {ap, an} by {bp, bn} mod B^rn-1 where B=2^mp_bits_per_limb,
and stores the result into {rp, rn}. The scratch space tp is either NULL,
in which case the function allocates itself the needed memory, or it should
contain at least 2*rn+4 limbs (or the number of needed limbs should be
documented).

mp_size_t mpn_mulmod_bnm1_next_size (mp_size_t n)
Returns the smallest optimal size rn >= n for the function mpn_mulmod_bnm1.

mp_limb_t mpn_mulmod_bnp1 (mp_ptr rp, mp_size_t rn, mp_srcptr ap, mp_size_t an,
                           mp_srcptr, bp, mp_size_t bn, mp_ptr tp)
Multiplies {ap, an} by {bp, bn} mod B^rn+1 where B=2^mp_bits_per_limb,
stores the result into {rp, rn}, and returns the potential carry.
The scratch space tp is either NULL, in which case the function allocates
itself the needed memory, or it should contain at least 2*rn+4 limbs
(or the number of needed limbs should be documented).

mp_size_t mpn_mulmod_bnp1_next_size (mp_size_t n)
Returns the smallest optimal size rn >= n for the function mpn_mulmod_bnp1.
For Fermat numbers, i.e., when mp_bits_per_limb*n is a power of 2, we should
have rn = n.


More information about the gmp-devel mailing list