diff options
Diffstat (limited to 'libtommath/bn_mp_copy.c')
-rw-r--r-- | libtommath/bn_mp_copy.c | 67 |
1 files changed, 33 insertions, 34 deletions
diff --git a/libtommath/bn_mp_copy.c b/libtommath/bn_mp_copy.c index 84e839e..bed03b2 100644 --- a/libtommath/bn_mp_copy.c +++ b/libtommath/bn_mp_copy.c @@ -16,50 +16,49 @@ */ /* copy, b = a */ -int -mp_copy (mp_int * a, mp_int * b) +int mp_copy(mp_int *a, mp_int *b) { - int res, n; + int res, n; - /* if dst == src do nothing */ - if (a == b) { - return MP_OKAY; - } + /* if dst == src do nothing */ + if (a == b) { + return MP_OKAY; + } - /* grow dest */ - if (b->alloc < a->used) { - if ((res = mp_grow (b, a->used)) != MP_OKAY) { - return res; - } - } + /* grow dest */ + if (b->alloc < a->used) { + if ((res = mp_grow(b, a->used)) != MP_OKAY) { + return res; + } + } - /* zero b and copy the parameters over */ - { - mp_digit *tmpa, *tmpb; + /* zero b and copy the parameters over */ + { + mp_digit *tmpa, *tmpb; - /* pointer aliases */ + /* pointer aliases */ - /* source */ - tmpa = a->dp; + /* source */ + tmpa = a->dp; - /* destination */ - tmpb = b->dp; + /* destination */ + tmpb = b->dp; - /* copy all the digits */ - for (n = 0; n < a->used; n++) { - *tmpb++ = *tmpa++; - } + /* copy all the digits */ + for (n = 0; n < a->used; n++) { + *tmpb++ = *tmpa++; + } - /* clear high digits */ - for (; n < b->used; n++) { - *tmpb++ = 0; - } - } + /* clear high digits */ + for (; n < b->used; n++) { + *tmpb++ = 0; + } + } - /* copy used count and sign */ - b->used = a->used; - b->sign = a->sign; - return MP_OKAY; + /* copy used count and sign */ + b->used = a->used; + b->sign = a->sign; + return MP_OKAY; } #endif |