Expose few private mpn_* functions?

Sergey B Kirpichev skir at sagemath.org
Sat Dec 27 04:24:09 CET 2025


Hello,

few basic integer functions are available
only via mpz_*() interfaces, could you please consider to provide also
mpn_*() analogs, which support arguments of mp_size_t size?

1) mpn_export/import() - mpz_export/import() already support only unsigned
   integers.  I think similar API would be natural rather for mpn_* functions.

2) mpn_pow_1() - it's exposed as public (maybe it's not intentional),
   but not documented yet and has comments that this API is unstable.  In particular,
   it has an argument for scratch space, missing in other functions.  

3) mpn_powm() and other primitives, that make mpz_powm() possible.

4) mpn_get_d() - this is of least importance, but it's API looks stable
   and I don't see big reasons to hide it.

I can provide patches for (1) and (4).


More information about the gmp-discuss mailing list