diff options
author | Martin Storsjö <martin@martin.st> | 2013-03-23 23:21:09 +0200 |
---|---|---|
committer | Niels Möller <nisse@lysator.liu.se> | 2013-04-04 11:24:13 +0200 |
commit | 388596308e08b41ff26535b0aaf35b0553da708b (patch) | |
tree | 65778c33a790e6570a388fdc82968bb109b15cf5 /gmp-glue.c | |
parent | 0d039117d988ac5132c86f5fff3206a44db6f98f (diff) | |
download | nettle-388596308e08b41ff26535b0aaf35b0553da708b.tar.gz |
Add fallback functions for mpn_copyd, mpn_copyi and mpn_zero.
Diffstat (limited to 'gmp-glue.c')
-rw-r--r-- | gmp-glue.c | 26 |
1 files changed, 26 insertions, 0 deletions
@@ -106,6 +106,32 @@ mpz_roinit_n (mpz_ptr x, const mp_limb_t *xp, mp_size_t xs) } #endif /* !GMP_HAVE_mpz_limbs_read */ +#if !GMP_HAVE_mpn_copyd +void +mpn_copyd (mp_ptr dst, mp_srcptr src, mp_size_t n) +{ + mp_size_t i; + for (i = n - 1; i >= 0; i--) + dst[i] = src[i]; +} + +void +mpn_copyi (mp_ptr dst, mp_srcptr src, mp_size_t n) +{ + mp_size_t i; + for (i = 0; i < n; i++) + dst[i] = src[i]; +} + +void +mpn_zero (mp_ptr ptr, mp_size_t n) +{ + mp_size_t i; + for (i = 0; i < n; i++) + ptr[i] = 0; +} +#endif /* !GMP_HAVE_mpn_copyd */ + /* Additional convenience functions. */ int |