1 /* TomsFastMath, a fast ISO C bignum library.
3 * This project is meant to fill in where LibTomMath
4 * falls short. That is speed ;-)
6 * This project is public domain and free for all purposes.
8 * Tom St Denis, tomstdenis@gmail.com
10 #include <tfm_private.h>
13 void fp_gcd(fp_int *a, fp_int *b, fp_int *c)
17 /* either zero than gcd is the largest */
18 if (fp_iszero (a) == 1 && fp_iszero (b) == 0) {
22 if (fp_iszero (a) == 0 && fp_iszero (b) == 1) {
27 /* optimized. At this point if a == 0 then
28 * b must equal zero too
30 if (fp_iszero (a) == 1) {
36 if (fp_cmp_mag(a, b) != FP_LT) {
45 while (fp_iszero(&v) == FP_NO) {