Reputation: 167
I can see from the GMP official documentation:
**void mpn_copyi (mp_limb_t rp, const mp_limb_t s1p, mp_size_t n)
Copy from {s1p, n} to {rp, n}, increasingly.
**void mpn_copyd (mp_limb_t rp, const mp_limb_t s1p, mp_size_t n)
Copy from {s1p, n} to {rp, n}, decreasingly.
However, I don't understand what increasingly and decreasingly mean in this context. Does increasingly mean it will copy all the limbs from 0 to n?
Upvotes: 1
Views: 488
Reputation: 25039
Use the source, Teabee.
void
mpn_copyi (mp_ptr rp, mp_srcptr up, mp_size_t n)
{
mp_size_t i;
up += n;
rp += n;
for (i = -n; i != 0; i++)
rp[i] = up[i];
}
And decrementing:
void
mpn_copyd (mp_ptr rp, mp_srcptr up, mp_size_t n)
{
mp_size_t i;
for (i = n - 1; i >= 0; i--)
rp[i] = up[i];
}
Upvotes: 2