GMP symbol naming (and the history thereof)?
nisse at lysator.liu.se
Sun Mar 3 16:38:14 CET 2013
Torbjorn Granlund <tg at gmplib.org> writes:
> As a start, I automatically made a list of symbols.
Here are some comments on a few that stood out.
I think these make sense as public (we'd need to investigate how one
best does both _n and _nc in C, with duplication or a tail call).
And this. (I think I'd prefer
mpn_cnd_add_n (mp_limb_t cnd, mp_ptr rp, mp_srcptr ap, mp_srcptr bp, mp_size_t n)
but that's a minor detail, and view the cnd_-prefix as a family of
functions. Some other potential members are mpn_cnd_copy, mpn_cnd_neg
and mpn_cnd_swap, see
for one application).
Some of these would make sense as public (with some kind of fallback to
addmul_1 if no more efficient loop is implemented).
Would make sense as public, I think.
I think this would make sense as public, under a different name, e.g.,
BTW, the other day I realized I'd like to extend the gcdext functions to
allow gp == NULL, so callers who use them for modular inversion don't
need to allocate space for a potentially large gcd. In this case, the
functions should return 1 and produce the cofactor only if the gcd is 1,
and otherwise return 0 to indicate failure.
Some hgcd function should be public, possibly with interface tweaks.
> __gmpn_invert doc
The doc flag is a false positive. But it would make sense to have public
invert and invertappr. (Or "reciprocal", if that's better).
> __gmpn_mulmod_bnm1 doc
Another false positive. But since this function has turned out to be so
useful, it would make sense to make it public in some form.
Should be public, possibly with interface tweaks.
Should be public in some form, but since the bdiv interface redesign is
not yet integrated, redc interfaces should change a bit too for
This (and also mul_basecase) should be public. They're useful for crypto
applications where numbers are known to be of moderate size and where
low code complexity is desired.
> __gmpn_zero doc decl
Missing in the list is mpn_zero_p. Should be public.
Since it's easy, that function is at the top of my list when making
additional mpn functions public. Not entirely sure how to deal with
inline functions, but there are others in gmp-h.in so I should be able
to figure that out.
Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26.
Internet email is subject to wholesale government surveillance.
More information about the gmp-devel