File:  [CSRG BSD Unix] / 43BSDTahoe / ucb / lisp / franz / subbig.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 16:12:58 2018 UTC (8 years, 1 month ago) by root
Branches: MAIN, BSD
CVS tags: HEAD, BSD43tahoe
BSD 4.3tahoe

#ifndef lint
static char *rcsid =
   "$Header: /var/lib/cvsd/repos/CSRG/43BSDTahoe/ucb/lisp/franz/subbig.c,v 1.1.1.1 2018/04/24 16:12:58 root Exp $";
#endif

/*					-[Sat Jan 29 13:36:05 1983 by jkf]-
 * 	subbig.c			$Locker:  $
 * bignum subtraction
 *
 * (c) copyright 1982, Regents of the University of California
 */

#include "global.h"

/*
 * subbig -- subtract one bignum from another.
 *
 * What this does is it negates each coefficient of a copy of the bignum
 * which is just pushed on the stack for convenience.  This may give rise
 * to a bignum which is not in canonical form, but is nonetheless a repre
 * sentation of a bignum.  Addbig then adds it to a bignum, and produces
 * a result in canonical form.
 */
lispval
subbig(pos,neg)
lispval pos, neg;
{
	register lispval work;
	lispval adbig();
	register long *mysp = sp() - 2;
	register long *ersatz = mysp;
	Keepxs();

	for(work = neg; work!=0; work = work->s.CDR) {
		stack((long)(mysp -= 2));
		stack(-work->i);
	}
	mysp[3] = 0;
	work = (adbig(pos,(lispval)ersatz));
	Freexs();
	return(work);
}

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.