File:  [MW Coherent from dump] / coherent / d / usr / lib / libmp / mtoi.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Wed May 29 04:56:38 2019 UTC (7 years, 2 months ago) by root
Branches: MarkWilliams, MAIN
CVS tags: relic, HEAD
coherent

/*
 *	Mtoi returns the integer equivalent of the mint pointed to by "a".
 *	If the value is too large for an int, it calls mperr with an
 *	appropriate error message.
 */
#include "mprec.h"

mtoi(a)
mint *a;
{
	register char *ap;
	register int mifl, res;

 	if (mcmp(mminint, a) > 0 || mcmp(a, mmaxint) >0)
		mperr("mtoi argument too big");
	ap = & a->val[a->len - 1];
	mifl = ispos(a);
	res = (mifl ? *ap : 0);
	while (--ap >= a->val)
		res = res * BASE + (mifl  ? *ap : NEFL - *ap);
	return (mifl ? res : - (res + 1));
}

unix.superglobalmegacorp.com

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