rsc | b3f6179 | 2004-03-21 14:06:38 +0000 | [diff] [blame] | 1 | #include "os.h" |
2 | #include <mp.h> | ||||
3 | #include "dat.h" | ||||
4 | |||||
5 | int | ||||
6 | mpveccmp(mpdigit *a, int alen, mpdigit *b, int blen) | ||||
7 | { | ||||
8 | mpdigit x; | ||||
9 | |||||
10 | while(alen > blen) | ||||
11 | if(a[--alen] != 0) | ||||
12 | return 1; | ||||
13 | while(blen > alen) | ||||
14 | if(b[--blen] != 0) | ||||
15 | return -1; | ||||
16 | while(alen > 0){ | ||||
17 | --alen; | ||||
18 | x = a[alen] - b[alen]; | ||||
19 | if(x == 0) | ||||
20 | continue; | ||||
21 | if(x > a[alen]) | ||||
22 | return -1; | ||||
23 | else | ||||
24 | return 1; | ||||
25 | } | ||||
26 | return 0; | ||||
27 | } |