mini-gmp

Niels Möller nisse at lysator.liu.se
Thu Jan 16 20:11:49 UTC 2014


Zimmermann Paul <Paul.Zimmermann at inria.fr> writes:

> I found a bug in mini-gmp: the GMP _mpz_realloc function is defined as
> mpz_realloc in mini-gmp (without the _ prefix):

I think this was intended as an internal function in mini-gmp, not an
implementation of the _mpz_realloc interface. Hence declared static.

We could add _mpz_realloc (and add mpz_realloc2, which is the
recommended gmp interface).

But both realloc functions would be of quite limited utility when using
mini-gmp, because many of the functions assign the result variable
using mpz_swap, making the caller's allocation irrelevant.

Do you depend on _mpz_realloc setting the result to zero if the value
doesn't fit? Otherwise,

  #if WITH_MINI_GMP
  #define _mpz_realloc(x, s)
  #define mpz_realloc2(x, s)
  #endif

might be a good enough substitute for mpfr (but it's not good enough, if
we want to define it in mini-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-bugs mailing list