summaryrefslogtreecommitdiffstats
path: root/libtommath/bn_mp_gcd.c
diff options
context:
space:
mode:
authorKevin B Kenny <kennykb@acm.org>2006-12-01 00:08:10 (GMT)
committerKevin B Kenny <kennykb@acm.org>2006-12-01 00:08:10 (GMT)
commit982d09f4d635271e2c515dbe49a9f44d1a42c59a (patch)
treee79d541814ca440317f0079b20cc3f3dd3ad7031 /libtommath/bn_mp_gcd.c
parent2c384db27cc46862fb7a386ba652980bd4accd35 (diff)
downloadtcl-982d09f4d635271e2c515dbe49a9f44d1a42c59a.zip
tcl-982d09f4d635271e2c515dbe49a9f44d1a42c59a.tar.gz
tcl-982d09f4d635271e2c515dbe49a9f44d1a42c59a.tar.bz2
Import of libtommath 0.39+
Diffstat (limited to 'libtommath/bn_mp_gcd.c')
-rw-r--r--libtommath/bn_mp_gcd.c18
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 $ */