mpn_pow_1

Torbjorn Granlund tege@swox.com
20 Nov 2002 13:03:58 +0100


Jason Moxham <J.L.Moxham@maths.soton.ac.uk> writes:

  for the function 

  mp_size_t 
  mpn_pow_1(mp_ptr rp, mp_srcptr bp, mp_size_t bn, mp_limb_t exp, mp_ptr tp)

  how much space is required at rp ? 
  clearly it needs enough space for the result , but does it need any extra 
  limbs?

  how much space is required at tp ? which I assume is a temporary varible

As for all internal functions, that is undefined.  For now,
I suggest that you check current callers.

We have some plans for adding an internal mechanism for
sizing temp allocations, and at the same time change the API
of many internal functions to require all temp space to be
passed by callers.

A typical use might look like this:

n = GMP_TEMP_ALLOC_mpn_pow_1(bp,bn,exp);
temp = GMP_ALLOC_TEMP (n);
mpn_pow_1 (...);
GMP_DEALLOC_TEMP (temp, n);

The various GMP_TEMP_ALLOC_* will take whatever parameters
we think might ever make sense.  A particular implementation
might ignore a subset of passed parameters.  These will be
macros, so "passing" a parameter that is ignored has zero
cost.

-- 
Torbjörn