after multiple objections of libtom users [1], we decided to change licensing
[libtompoly.git] / pb_cmp.c
blob0812d617b21dc6cd6f333f6d583c3557c92d0486
1 /* LibTomPoly, Polynomial Basis Math -- Tom St Denis
2 *
3 * LibTomPoly is a public domain library that provides
4 * polynomial basis arithmetic support. It relies on
5 * LibTomMath for large integer support.
7 * This library is free for all purposes without any
8 * express guarantee that it works.
10 * Tom St Denis, tomstdenis@iahu.ca, http://poly.libtomcrypt.org
12 #include <tompoly.h>
14 int pb_cmp(pb_poly *a, pb_poly *b)
16 int x;
18 if (a->used > b->used) {
19 return PB_DEG_GT;
20 } else if (a->used < b->used) {
21 return PB_DEG_LT;
24 for (x = 0; x < a->used; x++) {
25 if (mp_cmp(&(a->terms[x]), &(b->terms[x])) != MP_EQ) {
26 return PB_DEG_EQ;
29 return PB_EQ;