BSD 3 development
[unix-history] / usr / src / cmd / lisp / subbig.c
CommitLineData
18d1c3cd
JF
1#include "global.h"
2
3lispval
4subbig(pos,neg)
5lispval pos, neg;
6{
7 register lispval work;
8 int *sp(); lispval adbig();
9 register int *mysp = sp() - 2;
10 register int *ersatz = mysp;
11
12 for(work = neg; work!=0; work = work->CDR) {
13 stack(-work->i, (mysp -= 2));
14 }
15 mysp[3] = 0;
16 return(adbig(pos,ersatz));
17}
18/*
19 * subbig -- subtract one bignum from another.
20 *
21 * What this does is it negates each coefficient of a copy of the bignum
22 * which is just pushed on the stack for convenience. This may give rise
23 * to a bignum which is not in canonical form, but is nonetheless a repre
24 * sentation of a bignum. Addbig then adds it to a bignum, and produces
25 * a result in canonical form.
26 */