Commit | Line | Data |
---|---|---|
addc6378 C |
1 | #ifndef lint |
2 | static char *rcsid = | |
3 | "$Header: subbig.c,v 1.2 83/09/12 14:17:31 sklower Exp $"; | |
4 | #endif | |
5 | ||
6 | /* -[Sat Jan 29 13:36:05 1983 by jkf]- | |
7 | * subbig.c $Locker: $ | |
8 | * bignum subtraction | |
9 | * | |
10 | * (c) copyright 1982, Regents of the University of California | |
11 | */ | |
12 | ||
13 | #include "global.h" | |
14 | ||
15 | /* | |
16 | * subbig -- subtract one bignum from another. | |
17 | * | |
18 | * What this does is it negates each coefficient of a copy of the bignum | |
19 | * which is just pushed on the stack for convenience. This may give rise | |
20 | * to a bignum which is not in canonical form, but is nonetheless a repre | |
21 | * sentation of a bignum. Addbig then adds it to a bignum, and produces | |
22 | * a result in canonical form. | |
23 | */ | |
24 | lispval | |
25 | subbig(pos,neg) | |
26 | lispval pos, neg; | |
27 | { | |
28 | register lispval work; | |
29 | lispval adbig(); | |
30 | register long *mysp = sp() - 2; | |
31 | register long *ersatz = mysp; | |
32 | Keepxs(); | |
33 | ||
34 | for(work = neg; work!=0; work = work->s.CDR) { | |
35 | stack((long)(mysp -= 2)); | |
36 | stack(-work->i); | |
37 | } | |
38 | mysp[3] = 0; | |
39 | work = (adbig(pos,(lispval)ersatz)); | |
40 | Freexs(); | |
41 | return(work); | |
42 | } |