mini-gmp
Niels Möller
nisse at lysator.liu.se
Thu Jan 16 20:38:56 UTC 2014
Zimmermann Paul <Paul.Zimmermann at inria.fr> writes:
> 2) I had to add a line:
> unsigned int mp_bits_per_limb = GMP_NUMB_BITS;
I just added this to mini-gmp, or more precisely
const int mp_bits_per_limb = GMP_LIMB_BITS;
It's signed, just like in gmp, I have no idea why unsigned is not used.
> 3) I had to change "static void" to "void" for gmp_default_alloc,
> gmp_default_realloc and gmp_default_free since we use them in MPFR
Why are you using these functions?
If one wants a particular allocation method, e.g., plain malloc, to me
it seems best to use that directly. Or if one wants allocation which is
compatible with gmp allocations, one shouldn't use the *default*, but
the actually registered functions. E.g, in Nettle I have a function
mp_limb_t *
gmp_alloc_limbs (mp_size_t n)
{
void *(*alloc_func)(size_t);
assert (n > 0);
mp_get_memory_functions (&alloc_func, NULL, NULL);
return (mp_limb_t *) alloc_func ( (size_t) n * sizeof(mp_limb_t));
}
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