Mercurial > dropbear
comparison tomsfastmath/src/addsub/fp_cmp_mag.c @ 643:a362b62d38b2 dropbear-tfm
Add tomsfastmath from git rev bfa4582842bc3bab42e4be4aed5703437049502a
with Makefile.in renamed
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Wed, 23 Nov 2011 18:10:20 +0700 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
642:33fd2f3499d2 | 643:a362b62d38b2 |
---|---|
1 /* TomsFastMath, a fast ISO C bignum library. | |
2 * | |
3 * This project is meant to fill in where LibTomMath | |
4 * falls short. That is speed ;-) | |
5 * | |
6 * This project is public domain and free for all purposes. | |
7 * | |
8 * Tom St Denis, [email protected] | |
9 */ | |
10 #include <tfm.h> | |
11 | |
12 int fp_cmp_mag(fp_int *a, fp_int *b) | |
13 { | |
14 int x; | |
15 | |
16 if (a->used > b->used) { | |
17 return FP_GT; | |
18 } else if (a->used < b->used) { | |
19 return FP_LT; | |
20 } else { | |
21 for (x = a->used - 1; x >= 0; x--) { | |
22 if (a->dp[x] > b->dp[x]) { | |
23 return FP_GT; | |
24 } else if (a->dp[x] < b->dp[x]) { | |
25 return FP_LT; | |
26 } | |
27 } | |
28 } | |
29 return FP_EQ; | |
30 } | |
31 | |
32 | |
33 /* $Source$ */ | |
34 /* $Revision$ */ | |
35 /* $Date$ */ |