|
|
1.1 root 1: /*
2: * Mtoi returns the integer equivalent of the mint pointed to by "a".
3: * If the value is too large for an int, it calls mperr with an
4: * appropriate error message.
5: */
6: #include "mprec.h"
7:
8: mtoi(a)
9: mint *a;
10: {
11: register char *ap;
12: register int mifl, res;
13:
14: if (mcmp(mminint, a) > 0 || mcmp(a, mmaxint) >0)
15: mperr("mtoi argument too big");
16: ap = & a->val[a->len - 1];
17: mifl = ispos(a);
18: res = (mifl ? *ap : 0);
19: while (--ap >= a->val)
20: res = res * BASE + (mifl ? *ap : NEFL - *ap);
21: return (mifl ? res : - (res + 1));
22: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.