_mp_alloc vs ALLOC

Niels Möller nisse at lysator.liu.se
Sun Jun 3 20:52:47 CEST 2012


Torbjorn Granlund <tg at gmplib.org> writes:

> I started a page: http://gmplib.org/devel/incompatibility.html

The old_size argument should be removed also from the free function, not
just realloc.

Add return value to mpz_sqrt, for consistency with mpz_root (assuming
such a flag can be returned very cheaply, which I think it can).

And in the category of changes which I'm afraid we don't all agree on:
Let the mpn_mul* functions return the high limb, but not store it.
Motivation: Avoid having to allocate space for it in the case that the
top limb is known zero (happens, e.g., in the toom code). My gut feeling
is that it can also simplify allocation for some divide-and-conquer
algorithms, but I don't have any clear example handy. Maybe one could
also argue for consistency with mpn_addmul_1 and similar functions,
e.g., for the C mpn_mul_basecase, it would be nice if the final call to
mpn_addmul_1 (or _2 or _N) could be compiled as a tail call.

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