Blob


1 #include "os.h"
2 #include <mp.h>
3 #include "dat.h"
5 /* return neg, 0, pos as abs(b1)-abs(b2) is neg, 0, pos */
6 int
7 mpmagcmp(mpint *b1, mpint *b2)
8 {
9 int i;
11 i = b1->top - b2->top;
12 if(i)
13 return i;
15 return mpveccmp(b1->p, b1->top, b2->p, b2->top);
16 }
18 /* return neg, 0, pos as b1-b2 is neg, 0, pos */
19 int
20 mpcmp(mpint *b1, mpint *b2)
21 {
22 if(b1->sign != b2->sign)
23 return b1->sign - b2->sign;
24 if(b1->sign < 0)
25 return mpmagcmp(b2, b1);
26 else
27 return mpmagcmp(b1, b2);
28 }