From b3f61791f1e9095ce8ae9c6d6415b4ee94e2f7eb Mon Sep 17 00:00:00 2001 From: rsc Date: Sun, 21 Mar 2004 14:06:38 +0000 Subject: Add libmp. --- src/libmp/port/mpveccmp.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/libmp/port/mpveccmp.c (limited to 'src/libmp/port/mpveccmp.c') diff --git a/src/libmp/port/mpveccmp.c b/src/libmp/port/mpveccmp.c new file mode 100644 index 00000000..a462b1bd --- /dev/null +++ b/src/libmp/port/mpveccmp.c @@ -0,0 +1,27 @@ +#include "os.h" +#include +#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; +} -- cgit v1.2.3