3 /* LibTomMath, multiple-precision integer library -- Tom St Denis
5 * LibTomMath is a library that provides multiple-precision
6 * integer arithmetic as well as number theoretic functionality.
8 * The library was designed directly after the MPI library by
9 * Michael Fromberger but has been written from scratch with
10 * additional optimizations in place.
12 * The library is free for all purposes without any express
15 * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
20 mp_copy (mp_int * a, mp_int * b)
24 /* if dst == src do nothing */
30 if (b->alloc < a->used) {
31 if ((res = mp_grow (b, a->used)) != MP_OKAY) {
36 /* zero b and copy the parameters over */
38 register mp_digit *tmpa, *tmpb;
48 /* copy all the digits */
49 for (n = 0; n < a->used; n++) {
53 /* clear high digits */
54 for (; n < b->used; n++) {
59 /* copy used count and sign */
66 /* $Source: /cvs/libtom/libtommath/bn_mp_copy.c,v $ */
67 /* $Revision: 1.3 $ */
68 /* $Date: 2006/03/31 14:18:44 $ */