mpn_cnd_add_n
Torbjorn Granlund
tg at gmplib.org
Wed Mar 13 20:17:28 CET 2013
nisse at lysator.liu.se (Niels Möller) writes:
Checked in this renaming now.
Lokks like you at least purged the old names everywhere except in
ChangeLog...
Next, I'd like to make mpn_cnd_add_n, mpn_cnd_sub_n and mpn_zero_p
public (I guess that also implies some documentation...).
Testing and documentation, sigh. :-)
mpn_zero_p is an inline function. In gmp.h, setting up inlining looks
pretty hairy, with __GMP_EXTERN_INLINE defined in a couple of different
ways depending on compiler.
On the other hand, gmp-impl.h seems to simply use static inline,
unconditionally. If this is good enough for all supported compilers,
maybe it's good enough also in gmp.h? Potential problems:
* We may still need some __GMP_FORCE_* logic for binary compatibility
with applications which expect the functions to be exported.
* We might break pointer equality (different compilation units might get
different copies of non-inlined versions). I haven't thought very
carefully about it, but I guess we already have that problem for
compilers where __GMP_EXTERN_INLINE expands to static inline (DEC,
SCO, and SunPro C compilers). If it is a problem. I think this can be
worked around with some macro indirection to make sure that pointers
will refer to a unique function in the library.
I don't understand why you assume that the gmp.h mechanisms are
unneeded. I don't recall the details, and I don't feel like expending
the time on it right now, but touching these sort of long developed code
might break things in various ways on various machines. Unless one
spends enough time to appreciate all the difficulties, of course.
One thing to keep in mind is that inlining is not compulsory in C, at
least not for the compilers that predate any standardisation in this
area. Therefore one will need a copy of every potentially inlined
function also in the compiled library.
And as I mentioned a few days ago, I am not sure of the value in
inlining into user code. We should be quite restrictive about that,
except for trivial, non-looping functions.
Anyway, unless someone things cleaning this up now is important, I guess
I'll try to do mpn_zero_p in the same way as other inline functions in
gmp.h.
I appreciate that.
--
Torbjörn
More information about the gmp-devel
mailing list