summaryrefslogtreecommitdiff
path: root/gmp-glue.c
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2013-03-23 23:21:09 +0200
committerNiels Möller <nisse@lysator.liu.se>2013-04-04 11:24:13 +0200
commit388596308e08b41ff26535b0aaf35b0553da708b (patch)
tree65778c33a790e6570a388fdc82968bb109b15cf5 /gmp-glue.c
parent0d039117d988ac5132c86f5fff3206a44db6f98f (diff)
downloadnettle-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.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/gmp-glue.c b/gmp-glue.c
index b468699b..a2633a50 100644
--- a/gmp-glue.c
+++ b/gmp-glue.c
@@ -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