[BACK]Return to gmp.h CVS log [TXT][DIR] Up to [local] / OpenXM / src / kan96xx / gmp-2.0.2

Annotation of OpenXM/src/kan96xx/gmp-2.0.2/gmp.h, Revision 1.1.1.1

1.1       maekawa     1: /* gmp.h -- Definitions for GNU multiple precision functions.
                      2:
                      3: Copyright (C) 1991, 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
                      4:
                      5: This file is part of the GNU MP Library.
                      6:
                      7: The GNU MP Library is free software; you can redistribute it and/or modify
                      8: it under the terms of the GNU Library General Public License as published by
                      9: the Free Software Foundation; either version 2 of the License, or (at your
                     10: option) any later version.
                     11:
                     12: The GNU MP Library is distributed in the hope that it will be useful, but
                     13: WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
                     14: or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
                     15: License for more details.
                     16:
                     17: You should have received a copy of the GNU Library General Public License
                     18: along with the GNU MP Library; see the file COPYING.LIB.  If not, write to
                     19: the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
                     20: MA 02111-1307, USA. */
                     21:
                     22: #ifndef __GMP_H__
                     23:
                     24: #ifndef __GNU_MP__
                     25: #define __GNU_MP__ 2
                     26: #define __need_size_t
                     27: #include <stddef.h>
                     28: #undef __need_size_t
                     29:
                     30: #if defined (__STDC__) || defined (__cplusplus)
                     31: #define __gmp_const const
                     32: #else
                     33: #define __gmp_const
                     34: #endif
                     35:
                     36: #if defined (__GNUC__)
                     37: #define __gmp_inline __inline__
                     38: #else
                     39: #define __gmp_inline
                     40: #endif
                     41:
                     42: #ifndef _EXTERN_INLINE
                     43: #ifdef __GNUC__
                     44: #define _EXTERN_INLINE extern __inline__
                     45: #else
                     46: #define _EXTERN_INLINE static
                     47: #endif
                     48: #endif
                     49:
                     50: #ifdef _SHORT_LIMB
                     51: typedef unsigned int           mp_limb_t;
                     52: typedef int                    mp_limb_signed_t;
                     53: #else
                     54: #ifdef _LONG_LONG_LIMB
                     55: typedef unsigned long long int mp_limb_t;
                     56: typedef long long int          mp_limb_signed_t;
                     57: #else
                     58: typedef unsigned long int      mp_limb_t;
                     59: typedef long int               mp_limb_signed_t;
                     60: #endif
                     61: #endif
                     62:
                     63: typedef mp_limb_t *            mp_ptr;
                     64: typedef __gmp_const mp_limb_t *        mp_srcptr;
                     65: typedef long int               mp_size_t;
                     66: typedef long int               mp_exp_t;
                     67:
                     68: #ifndef __MP_SMALL__
                     69: typedef struct
                     70: {
                     71:   int _mp_alloc;               /* Number of *limbs* allocated and pointed
                     72:                                   to by the D field.  */
                     73:   int _mp_size;                        /* abs(SIZE) is the number of limbs
                     74:                                   the last field points to.  If SIZE
                     75:                                   is negative this is a negative
                     76:                                   number.  */
                     77:   mp_limb_t *_mp_d;            /* Pointer to the limbs.  */
                     78: } __mpz_struct;
                     79: #else
                     80: typedef struct
                     81: {
                     82:   short int _mp_alloc;         /* Number of *limbs* allocated and pointed
                     83:                                   to by the D field.  */
                     84:   short int _mp_size;          /* abs(SIZE) is the number of limbs
                     85:                                   the last field points to.  If SIZE
                     86:                                   is negative this is a negative
                     87:                                   number.  */
                     88:   mp_limb_t *_mp_d;            /* Pointer to the limbs.  */
                     89: } __mpz_struct;
                     90: #endif
                     91: #endif /* __GNU_MP__ */
                     92:
                     93: /* User-visible types.  */
                     94: typedef __mpz_struct MP_INT;
                     95: typedef __mpz_struct mpz_t[1];
                     96:
                     97: /* Structure for rational numbers.  Zero is represented as 0/any, i.e.
                     98:    the denominator is ignored.  Negative numbers have the sign in
                     99:    the numerator.  */
                    100: typedef struct
                    101: {
                    102:   __mpz_struct _mp_num;
                    103:   __mpz_struct _mp_den;
                    104: #if 0
                    105:   int _mp_num_alloc;           /* Number of limbs allocated
                    106:                                   for the numerator.  */
                    107:   int _mp_num_size;            /* The absolute value of this field is the
                    108:                                   length of the numerator; the sign is the
                    109:                                   sign of the entire rational number.  */
                    110:   mp_ptr _mp_num;              /* Pointer to the numerator limbs.  */
                    111:   int _mp_den_alloc;           /* Number of limbs allocated
                    112:                                   for the denominator.  */
                    113:   int _mp_den_size;            /* Length of the denominator.  (This field
                    114:                                   should always be positive.) */
                    115:   mp_ptr _mp_den;              /* Pointer to the denominator limbs.  */
                    116: #endif
                    117: } __mpq_struct;
                    118:
                    119: typedef __mpq_struct MP_RAT;
                    120: typedef __mpq_struct mpq_t[1];
                    121:
                    122: typedef struct
                    123: {
                    124:   int _mp_prec;                        /* Max precision, in number of `mp_limb_t's.
                    125:                                   Set by mpf_init and modified by
                    126:                                   mpf_set_prec.  The area pointed to
                    127:                                   by the `d' field contains `prec' + 1
                    128:                                   limbs.  */
                    129:   int _mp_size;                        /* abs(SIZE) is the number of limbs
                    130:                                   the last field points to.  If SIZE
                    131:                                   is negative this is a negative
                    132:                                   number.  */
                    133:   mp_exp_t _mp_exp;            /* Exponent, in the base of `mp_limb_t'.  */
                    134:   mp_limb_t *_mp_d;            /* Pointer to the limbs.  */
                    135: } __mpf_struct;
                    136:
                    137: /* typedef __mpf_struct MP_FLOAT; */
                    138: typedef __mpf_struct mpf_t[1];
                    139:
                    140: /* Types for function declarations in gmp files.  */
                    141: /* ??? Should not pollute user name space with these ??? */
                    142: typedef __gmp_const __mpz_struct *mpz_srcptr;
                    143: typedef __mpz_struct *mpz_ptr;
                    144: typedef __gmp_const __mpf_struct *mpf_srcptr;
                    145: typedef __mpf_struct *mpf_ptr;
                    146: typedef __gmp_const __mpq_struct *mpq_srcptr;
                    147: typedef __mpq_struct *mpq_ptr;
                    148:
                    149: #ifndef _PROTO
                    150: #if defined (__STDC__) || defined (__cplusplus)
                    151: #define _PROTO(x) x
                    152: #else
                    153: #define _PROTO(x) ()
                    154: #endif
                    155: #endif
                    156:
                    157: #ifndef __MPN
                    158: #if defined (__STDC__) || defined (__cplusplus)
                    159: #define __MPN(x) __mpn_##x
                    160: #else
                    161: #define __MPN(x) __mpn_/**/x
                    162: #endif
                    163: #endif
                    164:
                    165: #if defined (FILE) || defined (H_STDIO) || defined (_H_STDIO) \
                    166:  || defined (_STDIO_H) || defined (_STDIO_H_) || defined (__STDIO_H__) \
                    167:  || defined (_STDIO_INCLUDED)
                    168: #define _GMP_H_HAVE_FILE 1
                    169: #endif
                    170:
                    171: void mp_set_memory_functions _PROTO ((void *(*) (size_t),
                    172:                                      void *(*) (void *, size_t, size_t),
                    173:                                      void (*) (void *, size_t)));
                    174: extern __gmp_const int mp_bits_per_limb;
                    175:
                    176: /**************** Integer (i.e. Z) routines.  ****************/
                    177:
                    178: #if defined (__cplusplus)
                    179: extern "C" {
                    180: #endif
                    181: void *_mpz_realloc _PROTO ((mpz_ptr, mp_size_t));
                    182:
                    183: void mpz_abs _PROTO ((mpz_ptr, mpz_srcptr));
                    184: void mpz_add _PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
                    185: void mpz_add_ui _PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
                    186: void mpz_and _PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
                    187: void mpz_array_init _PROTO ((mpz_ptr, mp_size_t, mp_size_t));
                    188: void mpz_cdiv_q _PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
                    189: unsigned long int mpz_cdiv_q_ui _PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
                    190: void mpz_cdiv_qr _PROTO ((mpz_ptr, mpz_ptr, mpz_srcptr, mpz_srcptr));
                    191: unsigned long int mpz_cdiv_qr_ui _PROTO ((mpz_ptr, mpz_ptr, mpz_srcptr, unsigned long int));
                    192: void mpz_cdiv_r _PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
                    193: unsigned long int mpz_cdiv_r_ui _PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
                    194: unsigned long int mpz_cdiv_ui _PROTO ((mpz_srcptr, unsigned long int));
                    195: void mpz_clear _PROTO ((mpz_ptr));
                    196: void mpz_clrbit _PROTO ((mpz_ptr, unsigned long int));
                    197: int mpz_cmp _PROTO ((mpz_srcptr, mpz_srcptr));
                    198: int mpz_cmp_si _PROTO ((mpz_srcptr, signed long int));
                    199: int mpz_cmp_ui _PROTO ((mpz_srcptr, unsigned long int));
                    200: void mpz_com _PROTO ((mpz_ptr, mpz_srcptr));
                    201: void mpz_divexact _PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
                    202: void mpz_fac_ui _PROTO ((mpz_ptr, unsigned long int));
                    203: void mpz_fdiv_q _PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
                    204: void mpz_fdiv_q_2exp _PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
                    205: unsigned long int mpz_fdiv_q_ui _PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
                    206: void mpz_fdiv_qr _PROTO ((mpz_ptr, mpz_ptr, mpz_srcptr, mpz_srcptr));
                    207: unsigned long int mpz_fdiv_qr_ui _PROTO ((mpz_ptr, mpz_ptr, mpz_srcptr, unsigned long int));
                    208: void mpz_fdiv_r _PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
                    209: void mpz_fdiv_r_2exp _PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
                    210: unsigned long int mpz_fdiv_r_ui _PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
                    211: unsigned long int mpz_fdiv_ui _PROTO ((mpz_srcptr, unsigned long int));
                    212: void mpz_gcd _PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
                    213: unsigned long int mpz_gcd_ui _PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
                    214: void mpz_gcdext _PROTO ((mpz_ptr, mpz_ptr, mpz_ptr, mpz_srcptr, mpz_srcptr));
                    215: double mpz_get_d _PROTO ((mpz_srcptr));
                    216: /* signed */ long int mpz_get_si _PROTO ((mpz_srcptr));
                    217: char *mpz_get_str _PROTO ((char *, int, mpz_srcptr));
                    218: unsigned long int mpz_get_ui _PROTO ((mpz_srcptr));
                    219: mp_limb_t mpz_getlimbn _PROTO ((mpz_srcptr, mp_size_t));
                    220: unsigned long int mpz_hamdist _PROTO ((mpz_srcptr, mpz_srcptr));
                    221: void mpz_init _PROTO ((mpz_ptr));
                    222: #ifdef _GMP_H_HAVE_FILE
                    223: size_t mpz_inp_binary _PROTO ((mpz_ptr, FILE *));
                    224: size_t mpz_inp_raw _PROTO ((mpz_ptr, FILE *));
                    225: size_t mpz_inp_str _PROTO ((mpz_ptr, FILE *, int));
                    226: #endif
                    227: void mpz_init_set _PROTO ((mpz_ptr, mpz_srcptr));
                    228: void mpz_init_set_d _PROTO ((mpz_ptr, double));
                    229: void mpz_init_set_si _PROTO ((mpz_ptr, signed long int));
                    230: int mpz_init_set_str _PROTO ((mpz_ptr, const char *, int));
                    231: void mpz_init_set_ui _PROTO ((mpz_ptr, unsigned long int));
                    232: int mpz_invert _PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
                    233: void mpz_ior _PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
                    234: int mpz_jacobi _PROTO ((mpz_srcptr, mpz_srcptr));
                    235: int mpz_legendre _PROTO ((mpz_srcptr, mpz_srcptr));
                    236: void mpz_mod _PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
                    237: void mpz_mul _PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
                    238: void mpz_mul_2exp _PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
                    239: void mpz_mul_ui _PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
                    240: void mpz_neg _PROTO ((mpz_ptr, mpz_srcptr));
                    241: #ifdef _GMP_H_HAVE_FILE
                    242: size_t mpz_out_binary _PROTO ((FILE *, mpz_srcptr));
                    243: size_t mpz_out_raw _PROTO ((FILE *, mpz_srcptr));
                    244: size_t mpz_out_str _PROTO ((FILE *, int, mpz_srcptr));
                    245: #endif
                    246: int mpz_perfect_square_p _PROTO ((mpz_srcptr));
                    247: unsigned long int mpz_popcount _PROTO ((mpz_srcptr));
                    248: void mpz_pow_ui _PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
                    249: void mpz_powm _PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr, mpz_srcptr));
                    250: void mpz_powm_ui _PROTO ((mpz_ptr, mpz_srcptr, unsigned long int, mpz_srcptr));
                    251: int mpz_probab_prime_p _PROTO ((mpz_srcptr, int));
                    252: void mpz_random _PROTO ((mpz_ptr, mp_size_t));
                    253: void mpz_random2 _PROTO ((mpz_ptr, mp_size_t));
                    254: unsigned long int mpz_scan0 _PROTO ((mpz_srcptr, unsigned long int));
                    255: unsigned long int mpz_scan1 _PROTO ((mpz_srcptr, unsigned long int));
                    256: void mpz_set _PROTO ((mpz_ptr, mpz_srcptr));
                    257: void mpz_set_d _PROTO ((mpz_ptr, double));
                    258: void mpz_set_f _PROTO ((mpz_ptr, mpf_srcptr));
                    259: void mpz_set_q _PROTO ((mpz_ptr, mpq_srcptr));
                    260: void mpz_set_si _PROTO ((mpz_ptr, signed long int));
                    261: int mpz_set_str _PROTO ((mpz_ptr, const char *, int));
                    262: void mpz_set_ui _PROTO ((mpz_ptr, unsigned long int));
                    263: void mpz_setbit _PROTO ((mpz_ptr, unsigned long int));
                    264: size_t mpz_size _PROTO ((mpz_srcptr));
                    265: size_t mpz_sizeinbase _PROTO ((mpz_srcptr, int));
                    266: void mpz_sqrt _PROTO ((mpz_ptr, mpz_srcptr));
                    267: void mpz_sqrtrem _PROTO ((mpz_ptr, mpz_ptr, mpz_srcptr));
                    268: void mpz_sub _PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
                    269: void mpz_sub_ui _PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
                    270: void mpz_tdiv_q _PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
                    271: void mpz_tdiv_q_2exp _PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
                    272: void mpz_tdiv_q_ui _PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
                    273: void mpz_tdiv_qr _PROTO ((mpz_ptr, mpz_ptr, mpz_srcptr, mpz_srcptr));
                    274: void mpz_tdiv_qr_ui _PROTO ((mpz_ptr, mpz_ptr, mpz_srcptr, unsigned long int));
                    275: void mpz_tdiv_r _PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
                    276: void mpz_tdiv_r_2exp _PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
                    277: void mpz_tdiv_r_ui _PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
                    278: void mpz_ui_pow_ui _PROTO ((mpz_ptr, unsigned long int, unsigned long int));
                    279:
                    280: /**************** Rational (i.e. Q) routines.  ****************/
                    281:
                    282: void mpq_init _PROTO ((mpq_ptr));
                    283: void mpq_clear _PROTO ((mpq_ptr));
                    284: void mpq_set _PROTO ((mpq_ptr, mpq_srcptr));
                    285: void mpq_set_ui _PROTO ((mpq_ptr, unsigned long int, unsigned long int));
                    286: void mpq_set_si _PROTO ((mpq_ptr, signed long int, unsigned long int));
                    287: void mpq_set_z _PROTO ((mpq_ptr, mpz_srcptr));
                    288: void mpq_add _PROTO ((mpq_ptr, mpq_srcptr, mpq_srcptr));
                    289: void mpq_sub _PROTO ((mpq_ptr, mpq_srcptr, mpq_srcptr));
                    290: void mpq_mul _PROTO ((mpq_ptr, mpq_srcptr, mpq_srcptr));
                    291: void mpq_div _PROTO ((mpq_ptr, mpq_srcptr, mpq_srcptr));
                    292: void mpq_neg _PROTO ((mpq_ptr, mpq_srcptr));
                    293: int mpq_cmp _PROTO ((mpq_srcptr, mpq_srcptr));
                    294: int mpq_cmp_ui _PROTO ((mpq_srcptr, unsigned long int, unsigned long int));
                    295: int mpq_equal _PROTO ((mpq_srcptr, mpq_srcptr));
                    296: void mpq_inv _PROTO ((mpq_ptr, mpq_srcptr));
                    297: void mpq_set_num _PROTO ((mpq_ptr, mpz_srcptr));
                    298: void mpq_set_den _PROTO ((mpq_ptr, mpz_srcptr));
                    299: void mpq_get_num _PROTO ((mpz_ptr, mpq_srcptr));
                    300: void mpq_get_den _PROTO ((mpz_ptr, mpq_srcptr));
                    301: double mpq_get_d _PROTO ((mpq_srcptr));
                    302: void mpq_canonicalize _PROTO ((mpq_ptr));
                    303:
                    304: /**************** Float (i.e. F) routines.  ****************/
                    305:
                    306: void mpf_abs _PROTO ((mpf_ptr, mpf_srcptr));
                    307: void mpf_add _PROTO ((mpf_ptr, mpf_srcptr, mpf_srcptr));
                    308: void mpf_add_ui _PROTO ((mpf_ptr, mpf_srcptr, unsigned long int));
                    309: void mpf_clear _PROTO ((mpf_ptr));
                    310: int mpf_cmp _PROTO ((mpf_srcptr, mpf_srcptr));
                    311: int mpf_cmp_si _PROTO ((mpf_srcptr, signed long int));
                    312: int mpf_cmp_ui _PROTO ((mpf_srcptr, unsigned long int));
                    313: void mpf_div _PROTO ((mpf_ptr, mpf_srcptr, mpf_srcptr));
                    314: void mpf_div_2exp _PROTO ((mpf_ptr, mpf_srcptr, unsigned long int));
                    315: void mpf_div_ui _PROTO ((mpf_ptr, mpf_srcptr, unsigned long int));
                    316: void mpf_dump _PROTO ((mpf_srcptr));
                    317: int mpf_eq _PROTO ((mpf_srcptr, mpf_srcptr, unsigned long int));
                    318: double mpf_get_d _PROTO ((mpf_srcptr));
                    319: unsigned long int mpf_get_prec _PROTO ((mpf_srcptr));
                    320: char *mpf_get_str _PROTO ((char *, mp_exp_t *, int, size_t, mpf_srcptr));
                    321: void mpf_init _PROTO ((mpf_ptr));
                    322: void mpf_init2 _PROTO ((mpf_ptr, unsigned long int));
                    323: #ifdef _GMP_H_HAVE_FILE
                    324: size_t mpf_inp_str _PROTO ((mpf_ptr, FILE *, int));
                    325: #endif
                    326: void mpf_init_set _PROTO ((mpf_ptr, mpf_srcptr));
                    327: void mpf_init_set_d _PROTO ((mpf_ptr, double));
                    328: void mpf_init_set_si _PROTO ((mpf_ptr, signed long int));
                    329: int mpf_init_set_str _PROTO ((mpf_ptr, const char *, int));
                    330: void mpf_init_set_ui _PROTO ((mpf_ptr, unsigned long int));
                    331: void mpf_mul _PROTO ((mpf_ptr, mpf_srcptr, mpf_srcptr));
                    332: void mpf_mul_2exp _PROTO ((mpf_ptr, mpf_srcptr, unsigned long int));
                    333: void mpf_mul_ui _PROTO ((mpf_ptr, mpf_srcptr, unsigned long int));
                    334: void mpf_neg _PROTO ((mpf_ptr, mpf_srcptr));
                    335: #ifdef _GMP_H_HAVE_FILE
                    336: size_t mpf_out_str _PROTO ((FILE *, int, size_t, mpf_srcptr));
                    337: #endif
                    338: void mpf_random2 _PROTO ((mpf_ptr, mp_size_t, mp_exp_t));
                    339: void mpf_reldiff _PROTO ((mpf_ptr, mpf_srcptr, mpf_srcptr));
                    340: void mpf_set _PROTO ((mpf_ptr, mpf_srcptr));
                    341: void mpf_set_d _PROTO ((mpf_ptr, double));
                    342: void mpf_set_default_prec _PROTO ((unsigned long int));
                    343: void mpf_set_prec _PROTO ((mpf_ptr, unsigned long int));
                    344: void mpf_set_prec_raw _PROTO ((mpf_ptr, unsigned long int));
                    345: void mpf_set_q _PROTO ((mpf_ptr, mpq_srcptr));
                    346: void mpf_set_si _PROTO ((mpf_ptr, signed long int));
                    347: int mpf_set_str _PROTO ((mpf_ptr, const char *, int));
                    348: void mpf_set_ui _PROTO ((mpf_ptr, unsigned long int));
                    349: void mpf_set_z _PROTO ((mpf_ptr, mpz_srcptr));
                    350: size_t mpf_size _PROTO ((mpf_srcptr));
                    351: void mpf_sqrt _PROTO ((mpf_ptr, mpf_srcptr));
                    352: void mpf_sqrt_ui _PROTO ((mpf_ptr, unsigned long int));
                    353: void mpf_sub _PROTO ((mpf_ptr, mpf_srcptr, mpf_srcptr));
                    354: void mpf_sub_ui _PROTO ((mpf_ptr, mpf_srcptr, unsigned long int));
                    355: void mpf_ui_div _PROTO ((mpf_ptr, unsigned long int, mpf_srcptr));
                    356: void mpf_ui_sub _PROTO ((mpf_ptr, unsigned long int, mpf_srcptr));
                    357: #if defined (__cplusplus)
                    358: }
                    359: #endif
                    360: /************ Low level positive-integer (i.e. N) routines.  ************/
                    361:
                    362: /* This is ugly, but we need to make usr calls reach the prefixed function.  */
                    363: #define mpn_add                        __MPN(add)
                    364: #define mpn_add_1              __MPN(add_1)
                    365: #define mpn_add_n              __MPN(add_n)
                    366: #define mpn_addmul_1           __MPN(addmul_1)
                    367: #define mpn_bdivmod            __MPN(bdivmod)
                    368: #define mpn_cmp                        __MPN(cmp)
                    369: #define mpn_divmod_1           __MPN(divmod_1)
                    370: #define mpn_divrem             __MPN(divrem)
                    371: #define mpn_divrem_1           __MPN(divrem_1)
                    372: #define mpn_dump               __MPN(dump)
                    373: #define mpn_gcd                        __MPN(gcd)
                    374: #define mpn_gcd_1              __MPN(gcd_1)
                    375: #define mpn_gcdext             __MPN(gcdext)
                    376: #define mpn_get_str            __MPN(get_str)
                    377: #define mpn_hamdist            __MPN(hamdist)
                    378: #define mpn_lshift             __MPN(lshift)
                    379: #define mpn_mod_1              __MPN(mod_1)
                    380: #define mpn_mul                        __MPN(mul)
                    381: #define mpn_mul_1              __MPN(mul_1)
                    382: #define mpn_mul_n              __MPN(mul_n)
                    383: #define mpn_perfect_square_p   __MPN(perfect_square_p)
                    384: #define mpn_popcount           __MPN(popcount)
                    385: #define mpn_preinv_mod_1       __MPN(preinv_mod_1)
                    386: #define mpn_random2            __MPN(random2)
                    387: #define mpn_rshift             __MPN(rshift)
                    388: #define mpn_scan0              __MPN(scan0)
                    389: #define mpn_scan1              __MPN(scan1)
                    390: #define mpn_set_str            __MPN(set_str)
                    391: #define mpn_sqrtrem            __MPN(sqrtrem)
                    392: #define mpn_sub                        __MPN(sub)
                    393: #define mpn_sub_1              __MPN(sub_1)
                    394: #define mpn_sub_n              __MPN(sub_n)
                    395: #define mpn_submul_1           __MPN(submul_1)
                    396: #define mpn_udiv_w_sdiv                __MPN(udiv_w_sdiv)
                    397:
                    398: #if defined (__cplusplus)
                    399: extern "C" {
                    400: #endif
                    401: mp_limb_t mpn_add _PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr,mp_size_t));
                    402: mp_limb_t mpn_add_1 _PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t));
                    403: mp_limb_t mpn_add_n _PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t));
                    404: mp_limb_t mpn_addmul_1 _PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t));
                    405: mp_limb_t mpn_bdivmod _PROTO ((mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, unsigned long int));
                    406: int mpn_cmp _PROTO ((mp_srcptr, mp_srcptr, mp_size_t));
                    407: mp_limb_t mpn_divmod_1 _PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t));
                    408: mp_limb_t mpn_divrem _PROTO ((mp_ptr, mp_size_t, mp_ptr, mp_size_t, mp_srcptr, mp_size_t));
                    409: mp_limb_t mpn_divrem_1 _PROTO ((mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t));
                    410: void mpn_dump _PROTO ((mp_srcptr, mp_size_t));
                    411: mp_size_t mpn_gcd _PROTO ((mp_ptr, mp_ptr, mp_size_t, mp_ptr, mp_size_t));
                    412: mp_limb_t mpn_gcd_1 _PROTO ((mp_srcptr, mp_size_t, mp_limb_t));
                    413: mp_size_t mpn_gcdext _PROTO ((mp_ptr, mp_ptr, mp_ptr, mp_size_t, mp_ptr, mp_size_t));
                    414: size_t mpn_get_str _PROTO ((unsigned char *, int, mp_ptr, mp_size_t));
                    415: unsigned long int mpn_hamdist _PROTO ((mp_srcptr, mp_srcptr, mp_size_t));
                    416: mp_limb_t mpn_lshift _PROTO ((mp_ptr, mp_srcptr, mp_size_t, unsigned int));
                    417: mp_limb_t mpn_mod_1 _PROTO ((mp_srcptr, mp_size_t, mp_limb_t));
                    418: mp_limb_t mpn_mul _PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t));
                    419: mp_limb_t mpn_mul_1 _PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t));
                    420: void mpn_mul_n _PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t));
                    421: int mpn_perfect_square_p _PROTO ((mp_srcptr, mp_size_t));
                    422: unsigned long int mpn_popcount _PROTO ((mp_srcptr, mp_size_t));
                    423: mp_limb_t mpn_preinv_mod_1 _PROTO ((mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t));
                    424: void mpn_random2 _PROTO ((mp_ptr, mp_size_t));
                    425: mp_limb_t mpn_rshift _PROTO ((mp_ptr, mp_srcptr, mp_size_t, unsigned int));
                    426: unsigned long int mpn_scan0 _PROTO ((mp_srcptr, unsigned long int));
                    427: unsigned long int mpn_scan1 _PROTO ((mp_srcptr, unsigned long int));
                    428: mp_size_t mpn_set_str _PROTO ((mp_ptr, const unsigned char *, size_t, int));
                    429: mp_size_t mpn_sqrtrem _PROTO ((mp_ptr, mp_ptr, mp_srcptr, mp_size_t));
                    430: mp_limb_t mpn_sub _PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr,mp_size_t));
                    431: mp_limb_t mpn_sub_1 _PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t));
                    432: mp_limb_t mpn_sub_n _PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t));
                    433: mp_limb_t mpn_submul_1 _PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t));
                    434: #if defined (__cplusplus)
                    435: }
                    436: #endif
                    437:
                    438: #if defined (__GNUC__) || defined (_FORCE_INLINES)
                    439: _EXTERN_INLINE mp_limb_t
                    440: #if defined (__STDC__) || defined (__cplusplus)
                    441: mpn_add_1 (register mp_ptr res_ptr,
                    442:           register mp_srcptr s1_ptr,
                    443:           register mp_size_t s1_size,
                    444:           register mp_limb_t s2_limb)
                    445: #else
                    446: mpn_add_1 (res_ptr, s1_ptr, s1_size, s2_limb)
                    447:      register mp_ptr res_ptr;
                    448:      register mp_srcptr s1_ptr;
                    449:      register mp_size_t s1_size;
                    450:      register mp_limb_t s2_limb;
                    451: #endif
                    452: {
                    453:   register mp_limb_t x;
                    454:
                    455:   x = *s1_ptr++;
                    456:   s2_limb = x + s2_limb;
                    457:   *res_ptr++ = s2_limb;
                    458:   if (s2_limb < x)
                    459:     {
                    460:       while (--s1_size != 0)
                    461:        {
                    462:          x = *s1_ptr++ + 1;
                    463:          *res_ptr++ = x;
                    464:          if (x != 0)
                    465:            goto fin;
                    466:        }
                    467:
                    468:       return 1;
                    469:     }
                    470:
                    471:  fin:
                    472:   if (res_ptr != s1_ptr)
                    473:     {
                    474:       mp_size_t i;
                    475:       for (i = 0; i < s1_size - 1; i++)
                    476:        res_ptr[i] = s1_ptr[i];
                    477:     }
                    478:   return 0;
                    479: }
                    480:
                    481: _EXTERN_INLINE mp_limb_t
                    482: #if defined (__STDC__) || defined (__cplusplus)
                    483: mpn_add (register mp_ptr res_ptr,
                    484:         register mp_srcptr s1_ptr,
                    485:         register mp_size_t s1_size,
                    486:         register mp_srcptr s2_ptr,
                    487:         register mp_size_t s2_size)
                    488: #else
                    489: mpn_add (res_ptr, s1_ptr, s1_size, s2_ptr, s2_size)
                    490:      register mp_ptr res_ptr;
                    491:      register mp_srcptr s1_ptr;
                    492:      register mp_size_t s1_size;
                    493:      register mp_srcptr s2_ptr;
                    494:      register mp_size_t s2_size;
                    495: #endif
                    496: {
                    497:   mp_limb_t cy_limb = 0;
                    498:
                    499:   if (s2_size != 0)
                    500:     cy_limb = mpn_add_n (res_ptr, s1_ptr, s2_ptr, s2_size);
                    501:
                    502:   if (s1_size - s2_size != 0)
                    503:     cy_limb = mpn_add_1 (res_ptr + s2_size,
                    504:                         s1_ptr + s2_size,
                    505:                         s1_size - s2_size,
                    506:                         cy_limb);
                    507:   return cy_limb;
                    508: }
                    509:
                    510: _EXTERN_INLINE mp_limb_t
                    511: #if defined (__STDC__) || defined (__cplusplus)
                    512: mpn_sub_1 (register mp_ptr res_ptr,
                    513:           register mp_srcptr s1_ptr,
                    514:           register mp_size_t s1_size,
                    515:           register mp_limb_t s2_limb)
                    516: #else
                    517: mpn_sub_1 (res_ptr, s1_ptr, s1_size, s2_limb)
                    518:      register mp_ptr res_ptr;
                    519:      register mp_srcptr s1_ptr;
                    520:      register mp_size_t s1_size;
                    521:      register mp_limb_t s2_limb;
                    522: #endif
                    523: {
                    524:   register mp_limb_t x;
                    525:
                    526:   x = *s1_ptr++;
                    527:   s2_limb = x - s2_limb;
                    528:   *res_ptr++ = s2_limb;
                    529:   if (s2_limb > x)
                    530:     {
                    531:       while (--s1_size != 0)
                    532:        {
                    533:          x = *s1_ptr++;
                    534:          *res_ptr++ = x - 1;
                    535:          if (x != 0)
                    536:            goto fin;
                    537:        }
                    538:
                    539:       return 1;
                    540:     }
                    541:
                    542:  fin:
                    543:   if (res_ptr != s1_ptr)
                    544:     {
                    545:       mp_size_t i;
                    546:       for (i = 0; i < s1_size - 1; i++)
                    547:        res_ptr[i] = s1_ptr[i];
                    548:     }
                    549:   return 0;
                    550: }
                    551:
                    552: _EXTERN_INLINE mp_limb_t
                    553: #if defined (__STDC__) || defined (__cplusplus)
                    554: mpn_sub (register mp_ptr res_ptr,
                    555:         register mp_srcptr s1_ptr,
                    556:         register mp_size_t s1_size,
                    557:         register mp_srcptr s2_ptr,
                    558:         register mp_size_t s2_size)
                    559: #else
                    560: mpn_sub (res_ptr, s1_ptr, s1_size, s2_ptr, s2_size)
                    561:      register mp_ptr res_ptr;
                    562:      register mp_srcptr s1_ptr;
                    563:      register mp_size_t s1_size;
                    564:      register mp_srcptr s2_ptr;
                    565:      register mp_size_t s2_size;
                    566: #endif
                    567: {
                    568:   mp_limb_t cy_limb = 0;
                    569:
                    570:   if (s2_size != 0)
                    571:     cy_limb = mpn_sub_n (res_ptr, s1_ptr, s2_ptr, s2_size);
                    572:
                    573:   if (s1_size - s2_size != 0)
                    574:     cy_limb = mpn_sub_1 (res_ptr + s2_size,
                    575:                         s1_ptr + s2_size,
                    576:                         s1_size - s2_size,
                    577:                         cy_limb);
                    578:   return cy_limb;
                    579: }
                    580: #endif /* __GNUC__ */
                    581:
                    582: /* Allow faster testing for negative, zero, and positive.  */
                    583: #define mpz_sgn(Z) ((Z)->_mp_size < 0 ? -1 : (Z)->_mp_size > 0)
                    584: #define mpf_sgn(F) ((F)->_mp_size < 0 ? -1 : (F)->_mp_size > 0)
                    585: #define mpq_sgn(Q) ((Q)->_mp_num._mp_size < 0 ? -1 : (Q)->_mp_num._mp_size > 0)
                    586:
                    587: /* Allow direct user access to numerator and denominator of a mpq_t object.  */
                    588: #define mpq_numref(Q) (&((Q)->_mp_num))
                    589: #define mpq_denref(Q) (&((Q)->_mp_den))
                    590:
                    591: /* When using GCC, optimize certain common comparisons.  */
                    592: #if defined (__GNUC__)
                    593: #define mpz_cmp_ui(Z,UI) \
                    594:   (__builtin_constant_p (UI) && (UI) == 0                              \
                    595:    ? mpz_sgn (Z) : mpz_cmp_ui (Z,UI))
                    596: #define mpz_cmp_si(Z,UI) \
                    597:   (__builtin_constant_p (UI) && (UI) == 0 ? mpz_sgn (Z)                        \
                    598:    : __builtin_constant_p (UI) && (UI) > 0 ? mpz_cmp_ui (Z,UI)         \
                    599:    : mpz_cmp_si (Z,UI))
                    600: #define mpq_cmp_ui(Q,NUI,DUI) \
                    601:   (__builtin_constant_p (NUI) && (NUI) == 0                            \
                    602:    ? mpq_sgn (Q) : mpq_cmp_ui (Q,NUI,DUI))
                    603: #endif
                    604:
                    605: #define mpn_divmod(qp,np,nsize,dp,dsize) mpn_divrem (qp,0,np,nsize,dp,dsize)
                    606: #if 0
                    607: #define mpn_divmod_1(qp,np,nsize,dlimb) mpn_divrem_1 (qp,0,np,nsize,dlimb)
                    608: #endif
                    609:
                    610: /* Compatibility with GMP 1.  */
                    611: #define mpz_mdiv       mpz_fdiv_q
                    612: #define mpz_mdivmod    mpz_fdiv_qr
                    613: #define mpz_mmod       mpz_fdiv_r
                    614: #define mpz_mdiv_ui    mpz_fdiv_q_ui
                    615: #define mpz_mdivmod_ui(q,r,n,d) \
                    616:   ((r == 0) ? mpz_fdiv_q_ui (q,n,d) : mpz_fdiv_qr_ui (q,r,n,d))
                    617: #define mpz_mmod_ui(r,n,d) \
                    618:   ((r == 0) ? mpz_fdiv_ui (n,d) : mpz_fdiv_r_ui (r,n,d))
                    619:
                    620: /* Useful synonyms, but not quite compatible with GMP 1.  */
                    621: #define mpz_div                mpz_fdiv_q
                    622: #define mpz_divmod     mpz_fdiv_qr
                    623: #define mpz_div_ui     mpz_fdiv_q_ui
                    624: #define mpz_divmod_ui  mpz_fdiv_qr_ui
                    625: #define mpz_mod_ui     mpz_fdiv_r_ui
                    626: #define mpz_div_2exp   mpz_fdiv_q_2exp
                    627: #define mpz_mod_2exp   mpz_fdiv_r_2exp
                    628:
                    629: #define __GNU_MP_VERSION 2
                    630: #define __GNU_MP_VERSION_MINOR 0
                    631: #define __GMP_H__
                    632: #endif /* __GMP_H__ */

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>