|
|
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 - metrics - download
Length: 652 (0x28c)
Types: TextFile
Notes: UNIX file
Names: »mitom.c«
└─⟦f27320a65⟧ Bits:30001972 Commodore 900 hard disk image with partial source code
└─⟦f4b8d8c84⟧ UNIX Filesystem
└─⟦this⟧ »libmp/mitom.c«
#include "mprec.h"
/*
* Mitom sets the mint pointed to by "mp" to have a value equal
* to the int "n".
*/
void
mitom(n, mp)
int n;
mint *mp;
{
int an;
char mifl; /* minus flag */
char tev[NORSIZ]; /* temporary for converted value */
register char *rp, *limit, *value;
mpfree(mp->val);
an = ((mifl = n<0) ? -n : n);
rp = tev;
while (an != 0) {
*rp++ = an % BASE;
an >>= L2BASE;
}
*rp++ = 0;
limit = rp;
if (mifl) {
rp = tev - 1;
while (++rp < limit)
*rp = NEFL - *rp;
++*tev;
}
value = (char *)mpalc(limit - tev);
mp->val = value;
mp->len = limit - tev;
rp = tev;
while (rp < limit)
*value++ = *rp++;
norm(mp);
}