Annotation of coherent/d/usr/lib/libmp/user.mprec.h, revision 1.1

1.1     ! root        1: /*
        !             2:  *     Definitions of all user multi-precision types, macros and
        !             3:  *     non-int returning functions.
        !             4:  */
        !             5: 
        !             6: 
        !             7: /*
        !             8:  *     Multi-precision integer type.
        !             9:  */
        !            10: 
        !            11: typedef struct {
        !            12:        unsigned len;
        !            13:        char *val;
        !            14: } mint;
        !            15: 
        !            16: 
        !            17: /*
        !            18:  *     Minit initializes a mint so that it may be used by the other
        !            19:  *     multi-precision routines.  This simply consists of setting the
        !            20:  *     val field to NULL so that mpfree will know that there is nothing
        !            21:  *     to free.  Note that the mint so initialized has no value and
        !            22:  *     should not be used as an operand, but may be used as the result
        !            23:  *     of any of the multi-precision routines.
        !            24:  */
        !            25: 
        !            26: #define        minit(mp)       (mp)->val = NULL
        !            27: 
        !            28: 
        !            29: /*
        !            30:  *     Mvfree frees the value associated to a pointer to a mint.
        !            31:  *     Note that it does not re-initialize the mint.
        !            32:  */
        !            33: 
        !            34: #define        mvfree(mp)      mpfree((mp)->val)
        !            35: 
        !            36: 
        !            37: /*
        !            38:  *     Functions returning non-ints.
        !            39:  */
        !            40: 
        !            41: void   gcd(),          /* greatest common divisor of 2 mints */
        !            42:        madd(),         /* add 2 mints */
        !            43:        mcopy(),        /* copy mint */
        !            44:        mdiv(),         /* divide 2 mints */
        !            45:        min(),          /* read in mint from stdin */
        !            46:        mintfr(),       /* free all space used by a mint */
        !            47:        mitom(),        /* set a mint to the value of an int */
        !            48:        mneg(),         /* negate a mint */
        !            49:        mout(),         /* write out mint onto stdout */
        !            50:        mperr(),        /* print error on stdout and exit */
        !            51:        mpfree(),       /* free space allocated by mpalc */
        !            52:        msqrt(),        /* square root of mint */
        !            53:        msub(),         /* subtract 2 mints */
        !            54:        mult(),         /* multiply 2 mints */
        !            55:        pow(),          /* raise mint to a mint power mod a mint */
        !            56:        rpow(),         /* raise mint to a mint power */
        !            57:        sdiv(),         /* divide a mint by a char */
        !            58:        smult(),        /* multiply a mint by a char */
        !            59:        spow(),         /* raise mint to an unsigned power */
        !            60:        xgcd();         /* extended greatest common divisor */
        !            61: char   *mpalc(),       /* allocate space */
        !            62:        *mtos();        /* convert mint to string */
        !            63: mint   *itom();        /* allocate space for mint initialized to int */
        !            64: 
        !            65: 
        !            66:        /* external variables */
        !            67: 
        !            68: extern mint    *mzero,         /* a mint which has a value of zero */
        !            69:                *mone,          /* a mint which has a value of one */
        !            70:                *mminint,       /* min value that fits in an int */
        !            71:                *mmaxint;       /* max value that fits in an int */
        !            72: extern int     ibase,          /* input base (2 <= ibase <= 16 assumed) */
        !            73:                obase;          /* output base (2 <= obase <= 16 assumed) */

unix.superglobalmegacorp.com

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