The mpn_* generally don't do memory allocation, they require the caller to allocate memory for the result and temporaries.
So there should be no big problem changing pike's pow function to use mpn_pow instead of mpz_pow. But pow*m* will be harder (and it also allocates a lot more temporary storage).
/ Niels Möller ()
Previous text:
2002-11-20 15:43: Subject: Gmp
A different way is to stop using the mpz_* functions, and use only the lower level mpn_* functions instead. But then you lose functionality, complex algorithms, e.g. powm, isn't available in the mpn interface.
What does mpn_pow do if it runs out of memory, and why doesn't mpz_pow do the same?
/ Marcus Comstedt (ACROSS) (Hail Ilpalazzo!)