mpz_limbs interface

Niels Möller nisse at lysator.liu.se
Tue Jan 21 17:34:33 UTC 2014


Marc Glisse <marc.glisse at inria.fr> writes:

> I was talking of the case where I already have a preexisting buffer I
> want to use as _mp_d, I don't want to allocate a new one with
> mpz_realloc2. That seems to be a few steps further than the new limb
> interface goes, and I can understand not wanting to support that.

No, the new limb interface can only do it the other way round. If you
want to use a buffer as mpz_t output, and access it with low-level
fucntions too, you have give the reponsibility for allocating it to
_mpz_realloc, and write the code to tolerate that any use of the buffer
as an mpz_t output might do an unexpected reallocation.

When does this situation arise? In the given example, the root cause was
a missing mpn-level function in gmp.

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