|
DataMuseum.dkPresents historical artifacts from the history of: Commodore CBM-900 |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Commodore CBM-900 Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - download
Length: 524 (0x20c) Types: TextFile Notes: UNIX file Names: »mtoi.c«
└─⟦f27320a65⟧ Bits:30001972 Commodore 900 hard disk image with partial source code └─⟦f4b8d8c84⟧ UNIX Filesystem └─ ⟦this⟧ »libmp/mtoi.c«
#include "mprec.h" /* * 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. */ 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)); }