This commit is contained in:
Russ Cox
2005-08-08 12:50:13 +00:00
parent 0189e66e88
commit 934846f35c
382 changed files with 62614 additions and 0 deletions

28
libmp/mpveccmp.c Normal file
View File

@ -0,0 +1,28 @@
#include "os.h"
#include <mp.h>
#include "dat.h"
// prereq: alen >= blen
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;
}