Annotation of coherent/d/usr/lib/libmp/mitom.c, revision 1.1.1.1

1.1       root        1: /*
                      2:  *     Mitom sets the mint pointed to by "mp" to have a value equal
                      3:  *     to the int "n".
                      4:  */
                      5: #include "mprec.h"
                      6: void
                      7: mitom(n, mp)
                      8: int    n;
                      9: mint   *mp;
                     10: {
                     11:        register char *rp, *limit, *value;
                     12:        unsigned an;
                     13:        char mifl;      /* minus flag */
                     14:        char tev[NORSIZ];       /* temporary for converted value */
                     15: 
                     16:        mpfree(mp->val);
                     17:        an = ((mifl = n<0) ? -n : n);
                     18:        rp = tev;
                     19:        while (an != 0) {
                     20:                *rp++ = an % BASE;
                     21:                an >>= L2BASE;
                     22:        }
                     23:        *rp++ = 0;
                     24:        limit = rp;
                     25:        if (mifl) {
                     26:                rp = tev - 1;
                     27:                while (++rp < limit)
                     28:                        *rp = NEFL - *rp;
                     29:                ++*tev;
                     30:        }
                     31:        value = (char *)mpalc(limit - tev);
                     32:        mp->val = value;
                     33:        mp->len = limit - tev;
                     34:        rp = tev;
                     35:        while (rp < limit)
                     36:                *value++ = *rp++;
                     37:        norm(mp);
                     38: }

unix.superglobalmegacorp.com

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