mini-gmp
Zimmermann Paul
Paul.Zimmermann at inria.fr
Fri Jan 17 07:03:48 UTC 2014
Niels,
> > we don't depend on _mpz_realloc setting the result to zero, but your suggestion
> > does not work, since for example in mpfr_get_z_2exp (mpz_ptr z, mpfr_srcptr f),
> > we need to make sure that z has sufficient space to store the significand of f.
>
> I see. How do you access that limb array, just dereferencing the _mp_d
> pointer?
yes we use the PTR() macro to access the _mp_d field.
> If you need to access the limb-array, maybe it would make more sense to
> add the new mpz_limbs_* functions to mini-gmp?
I'm not aware of those functions. Having public functions to access the mpz_t
fields would be useful.
Btw, in gmp_xrealloc_limbs you call gmp_reallocate_func with old_size=0,
which makes the memory management check in the MPFR tests fail. Please
could you fix that?
static mp_ptr
gmp_xrealloc_limbs (mp_ptr old, mp_size_t size)
{
assert (size > 0);
return (*gmp_reallocate_func) (old, 0, size * sizeof (mp_limb_t));
}
Paul
More information about the gmp-bugs
mailing list