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

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