diff options
author | Taru Karttunen <taruti@taruti.net> | 2011-03-30 15:46:40 +0300 |
---|---|---|
committer | Taru Karttunen <taruti@taruti.net> | 2011-03-30 15:46:40 +0300 |
commit | e5888a1ffdae813d7575f5fb02275c6bb07e5199 (patch) | |
tree | d8d51eac403f07814b9e936eed0c9a79195e2450 /sys/src/libmp/port/mpveccmp.c |
Import sources from 2011-03-30 iso image
Diffstat (limited to 'sys/src/libmp/port/mpveccmp.c')
-rwxr-xr-x | sys/src/libmp/port/mpveccmp.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/sys/src/libmp/port/mpveccmp.c b/sys/src/libmp/port/mpveccmp.c new file mode 100755 index 000000000..a462b1bd7 --- /dev/null +++ b/sys/src/libmp/port/mpveccmp.c @@ -0,0 +1,27 @@ +#include "os.h" +#include <mp.h> +#include "dat.h" + +int +mpveccmp(mpdigit *a, int alen, mpdigit *b, int blen) +{ + mpdigit x; + + while(alen > blen) + if(a[--alen] != 0) + return 1; + while(blen > alen) + if(b[--blen] != 0) + return -1; + while(alen > 0){ + --alen; + x = a[alen] - b[alen]; + if(x == 0) + continue; + if(x > a[alen]) + return -1; + else + return 1; + } + return 0; +} |