use of ALLOC(), SIZE(), PTR() macros in libgmp
Torbjorn Granlund
tg at swox.com
Wed Dec 12 05:55:42 CET 2007
"Jan Nijtmans" <nijtmans at users.sourceforge.net> writes:
I'm experimenting with using GMP in a new GPL project, and thereby I
want to experiment with a more efficient memory occupation by
modifying the ALLOC, SIZE and PTR macro's. Those changes
are not intended to be taken over by libgmp (unless this change
turns out to be highly beneficial), but I noticed that those
macros are almost not used in GMP. Most code just uses the _mp_alloc,
_mp_size and _mp_d fields directly.
This is because most GMP code predates the introduction of these
macros.
My first question is, how can I help to make all GMP code use those
macro's (and EXP, PREC as well). I already made a local version of
GMP with all those replacements done, but I wouldn't be surprised
if others are interested in this as well. Of course, I can make a fork,
but this change is risk-less and I have no objection at all (in the contrary!)
to share my experiences with you.
I afraid such a contribution is not very useful. The current
development GMP tree is quite far from GMP 4.2.2, and making the
change is not hard to make automatically given the right source tree.
Note that these macros are not intended for end users, they were
actually intended for allowing us to easily break code that fiddles
with internal fields.
Second, I noted that the LIMBS() macro is only used in mpz/combit.c,
and nowhere else. Here is a small diff, changing this to the PTR()
macro, so the LIMBS() macro can be eliminated. Let this be my
first (tiny) contribution to libgmp.
That is a change I will apply. :-)
--
Torbjörn
More information about the gmp-devel
mailing list