Extending the mpn interface

Niels Möller nisse at lysator.liu.se
Mon Feb 16 08:00:23 UTC 2015


Bill Allombert <Bill.Allombert at math.u-bordeaux.fr> writes:

> I would like to call mpz_divexact_ui on (x,nx) and put the result 
> in (z,nz), and I would like to avoid doing extra copies (because
> mpz_divexact_ui run in linear time).

The current functions don't let you construct an mpz_t object that can
be passed as a destination argument to mpz functions. There's a
reasonably good reason for that: The details on when mpz functions want
to reallocate is not considered part of the public api.

> mpz_divexact_ui(Z, X, 3);

In this very particular case, you could use mpn_divexact_by3. There
ought to be more public mpn division functions.

Regards,
/Niels

-- 
Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26.
Internet email is subject to wholesale government surveillance.


More information about the gmp-devel mailing list