mpz_limbs interface

Marc Glisse marc.glisse at
Tue Jan 21 19:21:31 UTC 2014

On Tue, 21 Jan 2014, Niels Möller wrote:

> 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.

Up to now, we have always kind of promised that if there was enough 
margin in the output variables, there wouldn't be any unexpected 

> When does this situation arise?

__GMPXX_TMPZ_D, for instance. But this is mostly a speed issue, we 
shouldn't reallocate when it is obviously unneeded. I guess I got confused 
between what is a guideline for us (don't reallocate) and what is promised 
in the doc (don't bother specifying when reallocation may happen: always), 
so we can drop this.

Marc Glisse

More information about the gmp-devel mailing list