diff options
author | kennykb <kennykb@noemail.net> | 2006-12-01 00:08:09 (GMT) |
---|---|---|
committer | kennykb <kennykb@noemail.net> | 2006-12-01 00:08:09 (GMT) |
commit | 56fd1a5eb3a09b462e6ddc470f58f494df7907ff (patch) | |
tree | e79d541814ca440317f0079b20cc3f3dd3ad7031 /libtommath/bn_mp_gcd.c | |
parent | 9423c24218ff331c7332b5064b430ea1211a44ff (diff) | |
download | tcl-56fd1a5eb3a09b462e6ddc470f58f494df7907ff.zip tcl-56fd1a5eb3a09b462e6ddc470f58f494df7907ff.tar.gz tcl-56fd1a5eb3a09b462e6ddc470f58f494df7907ff.tar.bz2 |
Import of libtommath 0.39+
FossilOrigin-Name: e5fc0556e8c6a283df75a12157a3df78d9657f1a
Diffstat (limited to 'libtommath/bn_mp_gcd.c')
-rw-r--r-- | libtommath/bn_mp_gcd.c | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/libtommath/bn_mp_gcd.c b/libtommath/bn_mp_gcd.c index f0141ac..bbc5421 100644 --- a/libtommath/bn_mp_gcd.c +++ b/libtommath/bn_mp_gcd.c @@ -12,7 +12,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org + * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com */ /* Greatest Common Divisor using the binary method */ @@ -22,21 +22,13 @@ int mp_gcd (mp_int * a, mp_int * b, mp_int * c) int k, u_lsb, v_lsb, res; /* either zero than gcd is the largest */ - if (mp_iszero (a) == 1 && mp_iszero (b) == 0) { + if (mp_iszero (a) == MP_YES) { return mp_abs (b, c); } - if (mp_iszero (a) == 0 && mp_iszero (b) == 1) { + if (mp_iszero (b) == MP_YES) { return mp_abs (a, c); } - /* optimized. At this point if a == 0 then - * b must equal zero too - */ - if (mp_iszero (a) == 1) { - mp_zero(c); - return MP_OKAY; - } - /* get copies of a and b we can modify */ if ((res = mp_init_copy (&u, a)) != MP_OKAY) { return res; @@ -109,5 +101,5 @@ LBL_U:mp_clear (&v); #endif /* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_gcd.c,v $ */ -/* $Revision: 1.1.1.2 $ */ -/* $Date: 2005/09/26 16:31:56 $ */ +/* $Revision: 1.1.1.3 $ */ +/* $Date: 2006/12/01 00:08:11 $ */ |