Home | History | Annotate | Line # | Download | only in mipsn64el
gmp.h revision 1.1
      1  1.1  christos /* Definitions for GNU multiple precision functions.   -*- mode: c -*-
      2  1.1  christos 
      3  1.1  christos Copyright 1991, 1993-1997, 1999-2016, 2020 Free Software Foundation, Inc.
      4  1.1  christos 
      5  1.1  christos This file is part of the GNU MP Library.
      6  1.1  christos 
      7  1.1  christos The GNU MP Library is free software; you can redistribute it and/or modify
      8  1.1  christos it under the terms of either:
      9  1.1  christos 
     10  1.1  christos   * the GNU Lesser General Public License as published by the Free
     11  1.1  christos     Software Foundation; either version 3 of the License, or (at your
     12  1.1  christos     option) any later version.
     13  1.1  christos 
     14  1.1  christos or
     15  1.1  christos 
     16  1.1  christos   * the GNU General Public License as published by the Free Software
     17  1.1  christos     Foundation; either version 2 of the License, or (at your option) any
     18  1.1  christos     later version.
     19  1.1  christos 
     20  1.1  christos or both in parallel, as here.
     21  1.1  christos 
     22  1.1  christos The GNU MP Library is distributed in the hope that it will be useful, but
     23  1.1  christos WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
     24  1.1  christos or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
     25  1.1  christos for more details.
     26  1.1  christos 
     27  1.1  christos You should have received copies of the GNU General Public License and the
     28  1.1  christos GNU Lesser General Public License along with the GNU MP Library.  If not,
     29  1.1  christos see https://www.gnu.org/licenses/.  */
     30  1.1  christos 
     31  1.1  christos #ifndef __GMP_H__
     32  1.1  christos 
     33  1.1  christos #if defined (__cplusplus)
     34  1.1  christos #include <iosfwd>   /* for std::istream, std::ostream, std::string */
     35  1.1  christos #include <cstdio>
     36  1.1  christos #endif
     37  1.1  christos 
     38  1.1  christos 
     39  1.1  christos /* Instantiated by configure. */
     40  1.1  christos #if ! defined (__GMP_WITHIN_CONFIGURE)
     41  1.1  christos #define __GMP_HAVE_HOST_CPU_FAMILY_power   0
     42  1.1  christos #define __GMP_HAVE_HOST_CPU_FAMILY_powerpc 0
     43  1.1  christos #define GMP_LIMB_BITS                      64
     44  1.1  christos #define GMP_NAIL_BITS                      0
     45  1.1  christos #endif
     46  1.1  christos #define GMP_NUMB_BITS     (GMP_LIMB_BITS - GMP_NAIL_BITS)
     47  1.1  christos #define GMP_NUMB_MASK     ((~ __GMP_CAST (mp_limb_t, 0)) >> GMP_NAIL_BITS)
     48  1.1  christos #define GMP_NUMB_MAX      GMP_NUMB_MASK
     49  1.1  christos #define GMP_NAIL_MASK     (~ GMP_NUMB_MASK)
     50  1.1  christos 
     51  1.1  christos 
     52  1.1  christos #ifndef __GNU_MP__
     53  1.1  christos #define __GNU_MP__ 6
     54  1.1  christos 
     55  1.1  christos #include <stddef.h>    /* for size_t */
     56  1.1  christos #include <limits.h>
     57  1.1  christos 
     58  1.1  christos /* Instantiated by configure. */
     59  1.1  christos #if ! defined (__GMP_WITHIN_CONFIGURE)
     60  1.1  christos #define _LONG_LONG_LIMB 1
     61  1.1  christos #define __GMP_LIBGMP_DLL  0
     62  1.1  christos #endif
     63  1.1  christos 
     64  1.1  christos 
     65  1.1  christos /* __GMP_DECLSPEC supports Windows DLL versions of libgmp, and is empty in
     66  1.1  christos    all other circumstances.
     67  1.1  christos 
     68  1.1  christos    When compiling objects for libgmp, __GMP_DECLSPEC is an export directive,
     69  1.1  christos    or when compiling for an application it's an import directive.  The two
     70  1.1  christos    cases are differentiated by __GMP_WITHIN_GMP defined by the GMP Makefiles
     71  1.1  christos    (and not defined from an application).
     72  1.1  christos 
     73  1.1  christos    __GMP_DECLSPEC_XX is similarly used for libgmpxx.  __GMP_WITHIN_GMPXX
     74  1.1  christos    indicates when building libgmpxx, and in that case libgmpxx functions are
     75  1.1  christos    exports, but libgmp functions which might get called are imports.
     76  1.1  christos 
     77  1.1  christos    Libtool DLL_EXPORT define is not used.
     78  1.1  christos 
     79  1.1  christos    There's no attempt to support GMP built both static and DLL.  Doing so
     80  1.1  christos    would mean applications would have to tell us which of the two is going
     81  1.1  christos    to be used when linking, and that seems very tedious and error prone if
     82  1.1  christos    using GMP by hand, and equally tedious from a package since autoconf and
     83  1.1  christos    automake don't give much help.
     84  1.1  christos 
     85  1.1  christos    __GMP_DECLSPEC is required on all documented global functions and
     86  1.1  christos    variables, the various internals in gmp-impl.h etc can be left unadorned.
     87  1.1  christos    But internals used by the test programs or speed measuring programs
     88  1.1  christos    should have __GMP_DECLSPEC, and certainly constants or variables must
     89  1.1  christos    have it or the wrong address will be resolved.
     90  1.1  christos 
     91  1.1  christos    In gcc __declspec can go at either the start or end of a prototype.
     92  1.1  christos 
     93  1.1  christos    In Microsoft C __declspec must go at the start, or after the type like
     94  1.1  christos    void __declspec(...) *foo()".  There's no __dllexport or anything to
     95  1.1  christos    guard against someone foolish #defining dllexport.  _export used to be
     96  1.1  christos    available, but no longer.
     97  1.1  christos 
     98  1.1  christos    In Borland C _export still exists, but needs to go after the type, like
     99  1.1  christos    "void _export foo();".  Would have to change the __GMP_DECLSPEC syntax to
    100  1.1  christos    make use of that.  Probably more trouble than it's worth.  */
    101  1.1  christos 
    102  1.1  christos #if defined (__GNUC__)
    103  1.1  christos #define __GMP_DECLSPEC_EXPORT  __declspec(__dllexport__)
    104  1.1  christos #define __GMP_DECLSPEC_IMPORT  __declspec(__dllimport__)
    105  1.1  christos #endif
    106  1.1  christos #if defined (_MSC_VER) || defined (__BORLANDC__)
    107  1.1  christos #define __GMP_DECLSPEC_EXPORT  __declspec(dllexport)
    108  1.1  christos #define __GMP_DECLSPEC_IMPORT  __declspec(dllimport)
    109  1.1  christos #endif
    110  1.1  christos #ifdef __WATCOMC__
    111  1.1  christos #define __GMP_DECLSPEC_EXPORT  __export
    112  1.1  christos #define __GMP_DECLSPEC_IMPORT  __import
    113  1.1  christos #endif
    114  1.1  christos #ifdef __IBMC__
    115  1.1  christos #define __GMP_DECLSPEC_EXPORT  _Export
    116  1.1  christos #define __GMP_DECLSPEC_IMPORT  _Import
    117  1.1  christos #endif
    118  1.1  christos 
    119  1.1  christos #if __GMP_LIBGMP_DLL
    120  1.1  christos #ifdef __GMP_WITHIN_GMP
    121  1.1  christos /* compiling to go into a DLL libgmp */
    122  1.1  christos #define __GMP_DECLSPEC  __GMP_DECLSPEC_EXPORT
    123  1.1  christos #else
    124  1.1  christos /* compiling to go into an application which will link to a DLL libgmp */
    125  1.1  christos #define __GMP_DECLSPEC  __GMP_DECLSPEC_IMPORT
    126  1.1  christos #endif
    127  1.1  christos #else
    128  1.1  christos /* all other cases */
    129  1.1  christos #define __GMP_DECLSPEC
    130  1.1  christos #endif
    131  1.1  christos 
    132  1.1  christos 
    133  1.1  christos #ifdef __GMP_SHORT_LIMB
    134  1.1  christos typedef unsigned int		mp_limb_t;
    135  1.1  christos typedef int			mp_limb_signed_t;
    136  1.1  christos #else
    137  1.1  christos #ifdef _LONG_LONG_LIMB
    138  1.1  christos typedef unsigned long long int	mp_limb_t;
    139  1.1  christos typedef long long int		mp_limb_signed_t;
    140  1.1  christos #else
    141  1.1  christos typedef unsigned long int	mp_limb_t;
    142  1.1  christos typedef long int		mp_limb_signed_t;
    143  1.1  christos #endif
    144  1.1  christos #endif
    145  1.1  christos typedef unsigned long int	mp_bitcnt_t;
    146  1.1  christos 
    147  1.1  christos /* For reference, note that the name __mpz_struct gets into C++ mangled
    148  1.1  christos    function names, which means although the "__" suggests an internal, we
    149  1.1  christos    must leave this name for binary compatibility.  */
    150  1.1  christos typedef struct
    151  1.1  christos {
    152  1.1  christos   int _mp_alloc;		/* Number of *limbs* allocated and pointed
    153  1.1  christos 				   to by the _mp_d field.  */
    154  1.1  christos   int _mp_size;			/* abs(_mp_size) is the number of limbs the
    155  1.1  christos 				   last field points to.  If _mp_size is
    156  1.1  christos 				   negative this is a negative number.  */
    157  1.1  christos   mp_limb_t *_mp_d;		/* Pointer to the limbs.  */
    158  1.1  christos } __mpz_struct;
    159  1.1  christos 
    160  1.1  christos #endif /* __GNU_MP__ */
    161  1.1  christos 
    162  1.1  christos 
    163  1.1  christos typedef __mpz_struct MP_INT;    /* gmp 1 source compatibility */
    164  1.1  christos typedef __mpz_struct mpz_t[1];
    165  1.1  christos 
    166  1.1  christos typedef mp_limb_t *		mp_ptr;
    167  1.1  christos typedef const mp_limb_t *	mp_srcptr;
    168  1.1  christos #if defined (_CRAY) && ! defined (_CRAYMPP)
    169  1.1  christos /* plain `int' is much faster (48 bits) */
    170  1.1  christos #define __GMP_MP_SIZE_T_INT     1
    171  1.1  christos typedef int			mp_size_t;
    172  1.1  christos typedef int			mp_exp_t;
    173  1.1  christos #else
    174  1.1  christos #define __GMP_MP_SIZE_T_INT     0
    175  1.1  christos typedef long int		mp_size_t;
    176  1.1  christos typedef long int		mp_exp_t;
    177  1.1  christos #endif
    178  1.1  christos 
    179  1.1  christos typedef struct
    180  1.1  christos {
    181  1.1  christos   __mpz_struct _mp_num;
    182  1.1  christos   __mpz_struct _mp_den;
    183  1.1  christos } __mpq_struct;
    184  1.1  christos 
    185  1.1  christos typedef __mpq_struct MP_RAT;    /* gmp 1 source compatibility */
    186  1.1  christos typedef __mpq_struct mpq_t[1];
    187  1.1  christos 
    188  1.1  christos typedef struct
    189  1.1  christos {
    190  1.1  christos   int _mp_prec;			/* Max precision, in number of `mp_limb_t's.
    191  1.1  christos 				   Set by mpf_init and modified by
    192  1.1  christos 				   mpf_set_prec.  The area pointed to by the
    193  1.1  christos 				   _mp_d field contains `prec' + 1 limbs.  */
    194  1.1  christos   int _mp_size;			/* abs(_mp_size) is the number of limbs the
    195  1.1  christos 				   last field points to.  If _mp_size is
    196  1.1  christos 				   negative this is a negative number.  */
    197  1.1  christos   mp_exp_t _mp_exp;		/* Exponent, in the base of `mp_limb_t'.  */
    198  1.1  christos   mp_limb_t *_mp_d;		/* Pointer to the limbs.  */
    199  1.1  christos } __mpf_struct;
    200  1.1  christos 
    201  1.1  christos /* typedef __mpf_struct MP_FLOAT; */
    202  1.1  christos typedef __mpf_struct mpf_t[1];
    203  1.1  christos 
    204  1.1  christos /* Available random number generation algorithms.  */
    205  1.1  christos typedef enum
    206  1.1  christos {
    207  1.1  christos   GMP_RAND_ALG_DEFAULT = 0,
    208  1.1  christos   GMP_RAND_ALG_LC = GMP_RAND_ALG_DEFAULT /* Linear congruential.  */
    209  1.1  christos } gmp_randalg_t;
    210  1.1  christos 
    211  1.1  christos /* Random state struct.  */
    212  1.1  christos typedef struct
    213  1.1  christos {
    214  1.1  christos   mpz_t _mp_seed;	  /* _mp_d member points to state of the generator. */
    215  1.1  christos   gmp_randalg_t _mp_alg;  /* Currently unused. */
    216  1.1  christos   union {
    217  1.1  christos     void *_mp_lc;         /* Pointer to function pointers structure.  */
    218  1.1  christos   } _mp_algdata;
    219  1.1  christos } __gmp_randstate_struct;
    220  1.1  christos typedef __gmp_randstate_struct gmp_randstate_t[1];
    221  1.1  christos 
    222  1.1  christos /* Types for function declarations in gmp files.  */
    223  1.1  christos /* ??? Should not pollute user name space with these ??? */
    224  1.1  christos typedef const __mpz_struct *mpz_srcptr;
    225  1.1  christos typedef __mpz_struct *mpz_ptr;
    226  1.1  christos typedef const __mpf_struct *mpf_srcptr;
    227  1.1  christos typedef __mpf_struct *mpf_ptr;
    228  1.1  christos typedef const __mpq_struct *mpq_srcptr;
    229  1.1  christos typedef __mpq_struct *mpq_ptr;
    230  1.1  christos 
    231  1.1  christos 
    232  1.1  christos #if __GMP_LIBGMP_DLL
    233  1.1  christos #ifdef __GMP_WITHIN_GMPXX
    234  1.1  christos /* compiling to go into a DLL libgmpxx */
    235  1.1  christos #define __GMP_DECLSPEC_XX  __GMP_DECLSPEC_EXPORT
    236  1.1  christos #else
    237  1.1  christos /* compiling to go into a application which will link to a DLL libgmpxx */
    238  1.1  christos #define __GMP_DECLSPEC_XX  __GMP_DECLSPEC_IMPORT
    239  1.1  christos #endif
    240  1.1  christos #else
    241  1.1  christos /* all other cases */
    242  1.1  christos #define __GMP_DECLSPEC_XX
    243  1.1  christos #endif
    244  1.1  christos 
    245  1.1  christos 
    246  1.1  christos #ifndef __MPN
    247  1.1  christos #define __MPN(x) __gmpn_##x
    248  1.1  christos #endif
    249  1.1  christos 
    250  1.1  christos /* For reference, "defined(EOF)" cannot be used here.  In g++ 2.95.4,
    251  1.1  christos    <iostream> defines EOF but not FILE.  */
    252  1.1  christos #if defined (FILE)                                              \
    253  1.1  christos   || defined (H_STDIO)                                          \
    254  1.1  christos   || defined (_H_STDIO)               /* AIX */                 \
    255  1.1  christos   || defined (_STDIO_H)               /* glibc, Sun, SCO */     \
    256  1.1  christos   || defined (_STDIO_H_)              /* BSD, OSF */            \
    257  1.1  christos   || defined (__STDIO_H)              /* Borland */             \
    258  1.1  christos   || defined (__STDIO_H__)            /* IRIX */                \
    259  1.1  christos   || defined (_STDIO_INCLUDED)        /* HPUX */                \
    260  1.1  christos   || defined (__dj_include_stdio_h_)  /* DJGPP */               \
    261  1.1  christos   || defined (_FILE_DEFINED)          /* Microsoft */           \
    262  1.1  christos   || defined (__STDIO__)              /* Apple MPW MrC */       \
    263  1.1  christos   || defined (_MSL_STDIO_H)           /* Metrowerks */          \
    264  1.1  christos   || defined (_STDIO_H_INCLUDED)      /* QNX4 */		\
    265  1.1  christos   || defined (_ISO_STDIO_ISO_H)       /* Sun C++ */		\
    266  1.1  christos   || defined (__STDIO_LOADED)         /* VMS */			\
    267  1.1  christos   || defined (__DEFINED_FILE)         /* musl */
    268  1.1  christos #define _GMP_H_HAVE_FILE 1
    269  1.1  christos #endif
    270  1.1  christos 
    271  1.1  christos /* In ISO C, if a prototype involving "struct obstack *" is given without
    272  1.1  christos    that structure defined, then the struct is scoped down to just the
    273  1.1  christos    prototype, causing a conflict if it's subsequently defined for real.  So
    274  1.1  christos    only give prototypes if we've got obstack.h.  */
    275  1.1  christos #if defined (_OBSTACK_H)   /* glibc <obstack.h> */
    276  1.1  christos #define _GMP_H_HAVE_OBSTACK 1
    277  1.1  christos #endif
    278  1.1  christos 
    279  1.1  christos /* The prototypes for gmp_vprintf etc are provided only if va_list is defined,
    280  1.1  christos    via an application having included <stdarg.h>.  Usually va_list is a typedef
    281  1.1  christos    so can't be tested directly, but C99 specifies that va_start is a macro.
    282  1.1  christos 
    283  1.1  christos    <stdio.h> will define some sort of va_list for vprintf and vfprintf, but
    284  1.1  christos    let's not bother trying to use that since it's not standard and since
    285  1.1  christos    application uses for gmp_vprintf etc will almost certainly require the
    286  1.1  christos    whole <stdarg.h> anyway.  */
    287  1.1  christos 
    288  1.1  christos #ifdef va_start
    289  1.1  christos #define _GMP_H_HAVE_VA_LIST 1
    290  1.1  christos #endif
    291  1.1  christos 
    292  1.1  christos /* Test for gcc >= maj.min, as per __GNUC_PREREQ in glibc */
    293  1.1  christos #if defined (__GNUC__) && defined (__GNUC_MINOR__)
    294  1.1  christos #define __GMP_GNUC_PREREQ(maj, min) \
    295  1.1  christos   ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
    296  1.1  christos #else
    297  1.1  christos #define __GMP_GNUC_PREREQ(maj, min)  0
    298  1.1  christos #endif
    299  1.1  christos 
    300  1.1  christos /* "pure" is in gcc 2.96 and up, see "(gcc)Function Attributes".  Basically
    301  1.1  christos    it means a function does nothing but examine its arguments and memory
    302  1.1  christos    (global or via arguments) to generate a return value, but changes nothing
    303  1.1  christos    and has no side-effects.  __GMP_NO_ATTRIBUTE_CONST_PURE lets
    304  1.1  christos    tune/common.c etc turn this off when trying to write timing loops.  */
    305  1.1  christos #if __GMP_GNUC_PREREQ (2,96) && ! defined (__GMP_NO_ATTRIBUTE_CONST_PURE)
    306  1.1  christos #define __GMP_ATTRIBUTE_PURE   __attribute__ ((__pure__))
    307  1.1  christos #else
    308  1.1  christos #define __GMP_ATTRIBUTE_PURE
    309  1.1  christos #endif
    310  1.1  christos 
    311  1.1  christos 
    312  1.1  christos /* __GMP_CAST allows us to use static_cast in C++, so our macros are clean
    313  1.1  christos    to "g++ -Wold-style-cast".
    314  1.1  christos 
    315  1.1  christos    Casts in "extern inline" code within an extern "C" block don't induce
    316  1.1  christos    these warnings, so __GMP_CAST only needs to be used on documented
    317  1.1  christos    macros.  */
    318  1.1  christos 
    319  1.1  christos #ifdef __cplusplus
    320  1.1  christos #define __GMP_CAST(type, expr)  (static_cast<type> (expr))
    321  1.1  christos #else
    322  1.1  christos #define __GMP_CAST(type, expr)  ((type) (expr))
    323  1.1  christos #endif
    324  1.1  christos 
    325  1.1  christos 
    326  1.1  christos /* An empty "throw ()" means the function doesn't throw any C++ exceptions,
    327  1.1  christos    this can save some stack frame info in applications.
    328  1.1  christos 
    329  1.1  christos    Currently it's given only on functions which never divide-by-zero etc,
    330  1.1  christos    don't allocate memory, and are expected to never need to allocate memory.
    331  1.1  christos    This leaves open the possibility of a C++ throw from a future GMP
    332  1.1  christos    exceptions scheme.
    333  1.1  christos 
    334  1.1  christos    mpz_set_ui etc are omitted to leave open the lazy allocation scheme
    335  1.1  christos    described in doc/tasks.html.  mpz_get_d etc are omitted to leave open
    336  1.1  christos    exceptions for float overflows.
    337  1.1  christos 
    338  1.1  christos    Note that __GMP_NOTHROW must be given on any inlines the same as on their
    339  1.1  christos    prototypes (for g++ at least, where they're used together).  Note also
    340  1.1  christos    that g++ 3.0 demands that __GMP_NOTHROW is before other attributes like
    341  1.1  christos    __GMP_ATTRIBUTE_PURE.  */
    342  1.1  christos 
    343  1.1  christos #if defined (__cplusplus)
    344  1.1  christos #if __cplusplus >= 201103L
    345  1.1  christos #define __GMP_NOTHROW  noexcept
    346  1.1  christos #else
    347  1.1  christos #define __GMP_NOTHROW  throw ()
    348  1.1  christos #endif
    349  1.1  christos #else
    350  1.1  christos #define __GMP_NOTHROW
    351  1.1  christos #endif
    352  1.1  christos 
    353  1.1  christos 
    354  1.1  christos /* PORTME: What other compilers have a useful "extern inline"?  "static
    355  1.1  christos    inline" would be an acceptable substitute if the compiler (or linker)
    356  1.1  christos    discards unused statics.  */
    357  1.1  christos 
    358  1.1  christos  /* gcc has __inline__ in all modes, including strict ansi.  Give a prototype
    359  1.1  christos     for an inline too, so as to correctly specify "dllimport" on windows, in
    360  1.1  christos     case the function is called rather than inlined.
    361  1.1  christos     GCC 4.3 and above with -std=c99 or -std=gnu99 implements ISO C99
    362  1.1  christos     inline semantics, unless -fgnu89-inline is used.  */
    363  1.1  christos #ifdef __GNUC__
    364  1.1  christos #if (defined __GNUC_STDC_INLINE__) || (__GNUC__ == 4 && __GNUC_MINOR__ == 2) \
    365  1.1  christos   || (defined __GNUC_GNU_INLINE__ && defined __cplusplus)
    366  1.1  christos #define __GMP_EXTERN_INLINE extern __inline__ __attribute__ ((__gnu_inline__))
    367  1.1  christos #else
    368  1.1  christos #define __GMP_EXTERN_INLINE      extern __inline__
    369  1.1  christos #endif
    370  1.1  christos #define __GMP_INLINE_PROTOTYPES  1
    371  1.1  christos #endif
    372  1.1  christos 
    373  1.1  christos /* DEC C (eg. version 5.9) supports "static __inline foo()", even in -std1
    374  1.1  christos    strict ANSI mode.  Inlining is done even when not optimizing (ie. -O0
    375  1.1  christos    mode, which is the default), but an unnecessary local copy of foo is
    376  1.1  christos    emitted unless -O is used.  "extern __inline" is accepted, but the
    377  1.1  christos    "extern" appears to be ignored, ie. it becomes a plain global function
    378  1.1  christos    but which is inlined within its file.  Don't know if all old versions of
    379  1.1  christos    DEC C supported __inline, but as a start let's do the right thing for
    380  1.1  christos    current versions.  */
    381  1.1  christos #ifdef __DECC
    382  1.1  christos #define __GMP_EXTERN_INLINE  static __inline
    383  1.1  christos #endif
    384  1.1  christos 
    385  1.1  christos /* SCO OpenUNIX 8 cc supports "static inline foo()" but not in -Xc strict
    386  1.1  christos    ANSI mode (__STDC__ is 1 in that mode).  Inlining only actually takes
    387  1.1  christos    place under -O.  Without -O "foo" seems to be emitted whether it's used
    388  1.1  christos    or not, which is wasteful.  "extern inline foo()" isn't useful, the
    389  1.1  christos    "extern" is apparently ignored, so foo is inlined if possible but also
    390  1.1  christos    emitted as a global, which causes multiple definition errors when
    391  1.1  christos    building a shared libgmp.  */
    392  1.1  christos #ifdef __SCO_VERSION__
    393  1.1  christos #if __SCO_VERSION__ > 400000000 && __STDC__ != 1 \
    394  1.1  christos   && ! defined (__GMP_EXTERN_INLINE)
    395  1.1  christos #define __GMP_EXTERN_INLINE  static inline
    396  1.1  christos #endif
    397  1.1  christos #endif
    398  1.1  christos 
    399  1.1  christos /* Microsoft's C compiler accepts __inline */
    400  1.1  christos #ifdef _MSC_VER
    401  1.1  christos #define __GMP_EXTERN_INLINE  __inline
    402  1.1  christos #endif
    403  1.1  christos 
    404  1.1  christos /* Recent enough Sun C compilers want "inline" */
    405  1.1  christos #if defined (__SUNPRO_C) && __SUNPRO_C >= 0x560 \
    406  1.1  christos   && ! defined (__GMP_EXTERN_INLINE)
    407  1.1  christos #define __GMP_EXTERN_INLINE  inline
    408  1.1  christos #endif
    409  1.1  christos 
    410  1.1  christos /* Somewhat older Sun C compilers want "static inline" */
    411  1.1  christos #if defined (__SUNPRO_C) && __SUNPRO_C >= 0x540 \
    412  1.1  christos   && ! defined (__GMP_EXTERN_INLINE)
    413  1.1  christos #define __GMP_EXTERN_INLINE  static inline
    414  1.1  christos #endif
    415  1.1  christos 
    416  1.1  christos 
    417  1.1  christos /* C++ always has "inline" and since it's a normal feature the linker should
    418  1.1  christos    discard duplicate non-inlined copies, or if it doesn't then that's a
    419  1.1  christos    problem for everyone, not just GMP.  */
    420  1.1  christos #if defined (__cplusplus) && ! defined (__GMP_EXTERN_INLINE)
    421  1.1  christos #define __GMP_EXTERN_INLINE  inline
    422  1.1  christos #endif
    423  1.1  christos 
    424  1.1  christos /* Don't do any inlining within a configure run, since if the compiler ends
    425  1.1  christos    up emitting copies of the code into the object file it can end up
    426  1.1  christos    demanding the various support routines (like mpn_popcount) for linking,
    427  1.1  christos    making the "alloca" test and perhaps others fail.  And on hppa ia64 a
    428  1.1  christos    pre-release gcc 3.2 was seen not respecting the "extern" in "extern
    429  1.1  christos    __inline__", triggering this problem too.  */
    430  1.1  christos #if defined (__GMP_WITHIN_CONFIGURE) && ! __GMP_WITHIN_CONFIGURE_INLINE
    431  1.1  christos #undef __GMP_EXTERN_INLINE
    432  1.1  christos #endif
    433  1.1  christos 
    434  1.1  christos /* By default, don't give a prototype when there's going to be an inline
    435  1.1  christos    version.  Note in particular that Cray C++ objects to the combination of
    436  1.1  christos    prototype and inline.  */
    437  1.1  christos #ifdef __GMP_EXTERN_INLINE
    438  1.1  christos #ifndef __GMP_INLINE_PROTOTYPES
    439  1.1  christos #define __GMP_INLINE_PROTOTYPES  0
    440  1.1  christos #endif
    441  1.1  christos #else
    442  1.1  christos #define __GMP_INLINE_PROTOTYPES  1
    443  1.1  christos #endif
    444  1.1  christos 
    445  1.1  christos 
    446  1.1  christos #define __GMP_ABS(x)   ((x) >= 0 ? (x) : -(x))
    447  1.1  christos #define __GMP_MAX(h,i) ((h) > (i) ? (h) : (i))
    448  1.1  christos 
    449  1.1  christos 
    450  1.1  christos /* __builtin_expect is in gcc 3.0, and not in 2.95. */
    451  1.1  christos #if __GMP_GNUC_PREREQ (3,0)
    452  1.1  christos #define __GMP_LIKELY(cond)    __builtin_expect ((cond) != 0, 1)
    453  1.1  christos #define __GMP_UNLIKELY(cond)  __builtin_expect ((cond) != 0, 0)
    454  1.1  christos #else
    455  1.1  christos #define __GMP_LIKELY(cond)    (cond)
    456  1.1  christos #define __GMP_UNLIKELY(cond)  (cond)
    457  1.1  christos #endif
    458  1.1  christos 
    459  1.1  christos #ifdef _CRAY
    460  1.1  christos #define __GMP_CRAY_Pragma(str)  _Pragma (str)
    461  1.1  christos #else
    462  1.1  christos #define __GMP_CRAY_Pragma(str)
    463  1.1  christos #endif
    464  1.1  christos 
    465  1.1  christos 
    466  1.1  christos /* Allow direct user access to numerator and denominator of an mpq_t object.  */
    467  1.1  christos #define mpq_numref(Q) (&((Q)->_mp_num))
    468  1.1  christos #define mpq_denref(Q) (&((Q)->_mp_den))
    469  1.1  christos 
    470  1.1  christos 
    471  1.1  christos #if defined (__cplusplus)
    472  1.1  christos extern "C" {
    473  1.1  christos using std::FILE;
    474  1.1  christos #endif
    475  1.1  christos 
    476  1.1  christos #define mp_set_memory_functions __gmp_set_memory_functions
    477  1.1  christos __GMP_DECLSPEC void mp_set_memory_functions (void *(*) (size_t),
    478  1.1  christos 				      void *(*) (void *, size_t, size_t),
    479  1.1  christos 				      void (*) (void *, size_t)) __GMP_NOTHROW;
    480  1.1  christos 
    481  1.1  christos #define mp_get_memory_functions __gmp_get_memory_functions
    482  1.1  christos __GMP_DECLSPEC void mp_get_memory_functions (void *(**) (size_t),
    483  1.1  christos 				      void *(**) (void *, size_t, size_t),
    484  1.1  christos 				      void (**) (void *, size_t)) __GMP_NOTHROW;
    485  1.1  christos 
    486  1.1  christos #define mp_bits_per_limb __gmp_bits_per_limb
    487  1.1  christos __GMP_DECLSPEC extern const int mp_bits_per_limb;
    488  1.1  christos 
    489  1.1  christos #define gmp_errno __gmp_errno
    490  1.1  christos __GMP_DECLSPEC extern int gmp_errno;
    491  1.1  christos 
    492  1.1  christos #define gmp_version __gmp_version
    493  1.1  christos __GMP_DECLSPEC extern const char * const gmp_version;
    494  1.1  christos 
    495  1.1  christos 
    496  1.1  christos /**************** Random number routines.  ****************/
    497  1.1  christos 
    498  1.1  christos /* obsolete */
    499  1.1  christos #define gmp_randinit __gmp_randinit
    500  1.1  christos __GMP_DECLSPEC void gmp_randinit (gmp_randstate_t, gmp_randalg_t, ...);
    501  1.1  christos 
    502  1.1  christos #define gmp_randinit_default __gmp_randinit_default
    503  1.1  christos __GMP_DECLSPEC void gmp_randinit_default (gmp_randstate_t);
    504  1.1  christos 
    505  1.1  christos #define gmp_randinit_lc_2exp __gmp_randinit_lc_2exp
    506  1.1  christos __GMP_DECLSPEC void gmp_randinit_lc_2exp (gmp_randstate_t, mpz_srcptr, unsigned long int, mp_bitcnt_t);
    507  1.1  christos 
    508  1.1  christos #define gmp_randinit_lc_2exp_size __gmp_randinit_lc_2exp_size
    509  1.1  christos __GMP_DECLSPEC int gmp_randinit_lc_2exp_size (gmp_randstate_t, mp_bitcnt_t);
    510  1.1  christos 
    511  1.1  christos #define gmp_randinit_mt __gmp_randinit_mt
    512  1.1  christos __GMP_DECLSPEC void gmp_randinit_mt (gmp_randstate_t);
    513  1.1  christos 
    514  1.1  christos #define gmp_randinit_set __gmp_randinit_set
    515  1.1  christos __GMP_DECLSPEC void gmp_randinit_set (gmp_randstate_t, const __gmp_randstate_struct *);
    516  1.1  christos 
    517  1.1  christos #define gmp_randseed __gmp_randseed
    518  1.1  christos __GMP_DECLSPEC void gmp_randseed (gmp_randstate_t, mpz_srcptr);
    519  1.1  christos 
    520  1.1  christos #define gmp_randseed_ui __gmp_randseed_ui
    521  1.1  christos __GMP_DECLSPEC void gmp_randseed_ui (gmp_randstate_t, unsigned long int);
    522  1.1  christos 
    523  1.1  christos #define gmp_randclear __gmp_randclear
    524  1.1  christos __GMP_DECLSPEC void gmp_randclear (gmp_randstate_t);
    525  1.1  christos 
    526  1.1  christos #define gmp_urandomb_ui __gmp_urandomb_ui
    527  1.1  christos __GMP_DECLSPEC unsigned long gmp_urandomb_ui (gmp_randstate_t, unsigned long);
    528  1.1  christos 
    529  1.1  christos #define gmp_urandomm_ui __gmp_urandomm_ui
    530  1.1  christos __GMP_DECLSPEC unsigned long gmp_urandomm_ui (gmp_randstate_t, unsigned long);
    531  1.1  christos 
    532  1.1  christos 
    533  1.1  christos /**************** Formatted output routines.  ****************/
    534  1.1  christos 
    535  1.1  christos #define gmp_asprintf __gmp_asprintf
    536  1.1  christos __GMP_DECLSPEC int gmp_asprintf (char **, const char *, ...);
    537  1.1  christos 
    538  1.1  christos #define gmp_fprintf __gmp_fprintf
    539  1.1  christos #ifdef _GMP_H_HAVE_FILE
    540  1.1  christos __GMP_DECLSPEC int gmp_fprintf (FILE *, const char *, ...);
    541  1.1  christos #endif
    542  1.1  christos 
    543  1.1  christos #define gmp_obstack_printf __gmp_obstack_printf
    544  1.1  christos #if defined (_GMP_H_HAVE_OBSTACK)
    545  1.1  christos __GMP_DECLSPEC int gmp_obstack_printf (struct obstack *, const char *, ...);
    546  1.1  christos #endif
    547  1.1  christos 
    548  1.1  christos #define gmp_obstack_vprintf __gmp_obstack_vprintf
    549  1.1  christos #if defined (_GMP_H_HAVE_OBSTACK) && defined (_GMP_H_HAVE_VA_LIST)
    550  1.1  christos __GMP_DECLSPEC int gmp_obstack_vprintf (struct obstack *, const char *, va_list);
    551  1.1  christos #endif
    552  1.1  christos 
    553  1.1  christos #define gmp_printf __gmp_printf
    554  1.1  christos __GMP_DECLSPEC int gmp_printf (const char *, ...);
    555  1.1  christos 
    556  1.1  christos #define gmp_snprintf __gmp_snprintf
    557  1.1  christos __GMP_DECLSPEC int gmp_snprintf (char *, size_t, const char *, ...);
    558  1.1  christos 
    559  1.1  christos #define gmp_sprintf __gmp_sprintf
    560  1.1  christos __GMP_DECLSPEC int gmp_sprintf (char *, const char *, ...);
    561  1.1  christos 
    562  1.1  christos #define gmp_vasprintf __gmp_vasprintf
    563  1.1  christos #if defined (_GMP_H_HAVE_VA_LIST)
    564  1.1  christos __GMP_DECLSPEC int gmp_vasprintf (char **, const char *, va_list);
    565  1.1  christos #endif
    566  1.1  christos 
    567  1.1  christos #define gmp_vfprintf __gmp_vfprintf
    568  1.1  christos #if defined (_GMP_H_HAVE_FILE) && defined (_GMP_H_HAVE_VA_LIST)
    569  1.1  christos __GMP_DECLSPEC int gmp_vfprintf (FILE *, const char *, va_list);
    570  1.1  christos #endif
    571  1.1  christos 
    572  1.1  christos #define gmp_vprintf __gmp_vprintf
    573  1.1  christos #if defined (_GMP_H_HAVE_VA_LIST)
    574  1.1  christos __GMP_DECLSPEC int gmp_vprintf (const char *, va_list);
    575  1.1  christos #endif
    576  1.1  christos 
    577  1.1  christos #define gmp_vsnprintf __gmp_vsnprintf
    578  1.1  christos #if defined (_GMP_H_HAVE_VA_LIST)
    579  1.1  christos __GMP_DECLSPEC int gmp_vsnprintf (char *, size_t, const char *, va_list);
    580  1.1  christos #endif
    581  1.1  christos 
    582  1.1  christos #define gmp_vsprintf __gmp_vsprintf
    583  1.1  christos #if defined (_GMP_H_HAVE_VA_LIST)
    584  1.1  christos __GMP_DECLSPEC int gmp_vsprintf (char *, const char *, va_list);
    585  1.1  christos #endif
    586  1.1  christos 
    587  1.1  christos 
    588  1.1  christos /**************** Formatted input routines.  ****************/
    589  1.1  christos 
    590  1.1  christos #define gmp_fscanf __gmp_fscanf
    591  1.1  christos #ifdef _GMP_H_HAVE_FILE
    592  1.1  christos __GMP_DECLSPEC int gmp_fscanf (FILE *, const char *, ...);
    593  1.1  christos #endif
    594  1.1  christos 
    595  1.1  christos #define gmp_scanf __gmp_scanf
    596  1.1  christos __GMP_DECLSPEC int gmp_scanf (const char *, ...);
    597  1.1  christos 
    598  1.1  christos #define gmp_sscanf __gmp_sscanf
    599  1.1  christos __GMP_DECLSPEC int gmp_sscanf (const char *, const char *, ...);
    600  1.1  christos 
    601  1.1  christos #define gmp_vfscanf __gmp_vfscanf
    602  1.1  christos #if defined (_GMP_H_HAVE_FILE) && defined (_GMP_H_HAVE_VA_LIST)
    603  1.1  christos __GMP_DECLSPEC int gmp_vfscanf (FILE *, const char *, va_list);
    604  1.1  christos #endif
    605  1.1  christos 
    606  1.1  christos #define gmp_vscanf __gmp_vscanf
    607  1.1  christos #if defined (_GMP_H_HAVE_VA_LIST)
    608  1.1  christos __GMP_DECLSPEC int gmp_vscanf (const char *, va_list);
    609  1.1  christos #endif
    610  1.1  christos 
    611  1.1  christos #define gmp_vsscanf __gmp_vsscanf
    612  1.1  christos #if defined (_GMP_H_HAVE_VA_LIST)
    613  1.1  christos __GMP_DECLSPEC int gmp_vsscanf (const char *, const char *, va_list);
    614  1.1  christos #endif
    615  1.1  christos 
    616  1.1  christos 
    617  1.1  christos /**************** Integer (i.e. Z) routines.  ****************/
    618  1.1  christos 
    619  1.1  christos #define _mpz_realloc __gmpz_realloc
    620  1.1  christos #define mpz_realloc __gmpz_realloc
    621  1.1  christos __GMP_DECLSPEC void *_mpz_realloc (mpz_ptr, mp_size_t);
    622  1.1  christos 
    623  1.1  christos #define mpz_abs __gmpz_abs
    624  1.1  christos #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_abs)
    625  1.1  christos __GMP_DECLSPEC void mpz_abs (mpz_ptr, mpz_srcptr);
    626  1.1  christos #endif
    627  1.1  christos 
    628  1.1  christos #define mpz_add __gmpz_add
    629  1.1  christos __GMP_DECLSPEC void mpz_add (mpz_ptr, mpz_srcptr, mpz_srcptr);
    630  1.1  christos 
    631  1.1  christos #define mpz_add_ui __gmpz_add_ui
    632  1.1  christos __GMP_DECLSPEC void mpz_add_ui (mpz_ptr, mpz_srcptr, unsigned long int);
    633  1.1  christos 
    634  1.1  christos #define mpz_addmul __gmpz_addmul
    635  1.1  christos __GMP_DECLSPEC void mpz_addmul (mpz_ptr, mpz_srcptr, mpz_srcptr);
    636  1.1  christos 
    637  1.1  christos #define mpz_addmul_ui __gmpz_addmul_ui
    638  1.1  christos __GMP_DECLSPEC void mpz_addmul_ui (mpz_ptr, mpz_srcptr, unsigned long int);
    639  1.1  christos 
    640  1.1  christos #define mpz_and __gmpz_and
    641  1.1  christos __GMP_DECLSPEC void mpz_and (mpz_ptr, mpz_srcptr, mpz_srcptr);
    642  1.1  christos 
    643  1.1  christos #define mpz_array_init __gmpz_array_init
    644  1.1  christos __GMP_DECLSPEC void mpz_array_init (mpz_ptr, mp_size_t, mp_size_t);
    645  1.1  christos 
    646  1.1  christos #define mpz_bin_ui __gmpz_bin_ui
    647  1.1  christos __GMP_DECLSPEC void mpz_bin_ui (mpz_ptr, mpz_srcptr, unsigned long int);
    648  1.1  christos 
    649  1.1  christos #define mpz_bin_uiui __gmpz_bin_uiui
    650  1.1  christos __GMP_DECLSPEC void mpz_bin_uiui (mpz_ptr, unsigned long int, unsigned long int);
    651  1.1  christos 
    652  1.1  christos #define mpz_cdiv_q __gmpz_cdiv_q
    653  1.1  christos __GMP_DECLSPEC void mpz_cdiv_q (mpz_ptr, mpz_srcptr, mpz_srcptr);
    654  1.1  christos 
    655  1.1  christos #define mpz_cdiv_q_2exp __gmpz_cdiv_q_2exp
    656  1.1  christos __GMP_DECLSPEC void mpz_cdiv_q_2exp (mpz_ptr, mpz_srcptr, mp_bitcnt_t);
    657  1.1  christos 
    658  1.1  christos #define mpz_cdiv_q_ui __gmpz_cdiv_q_ui
    659  1.1  christos __GMP_DECLSPEC unsigned long int mpz_cdiv_q_ui (mpz_ptr, mpz_srcptr, unsigned long int);
    660  1.1  christos 
    661  1.1  christos #define mpz_cdiv_qr __gmpz_cdiv_qr
    662  1.1  christos __GMP_DECLSPEC void mpz_cdiv_qr (mpz_ptr, mpz_ptr, mpz_srcptr, mpz_srcptr);
    663  1.1  christos 
    664  1.1  christos #define mpz_cdiv_qr_ui __gmpz_cdiv_qr_ui
    665  1.1  christos __GMP_DECLSPEC unsigned long int mpz_cdiv_qr_ui (mpz_ptr, mpz_ptr, mpz_srcptr, unsigned long int);
    666  1.1  christos 
    667  1.1  christos #define mpz_cdiv_r __gmpz_cdiv_r
    668  1.1  christos __GMP_DECLSPEC void mpz_cdiv_r (mpz_ptr, mpz_srcptr, mpz_srcptr);
    669  1.1  christos 
    670  1.1  christos #define mpz_cdiv_r_2exp __gmpz_cdiv_r_2exp
    671  1.1  christos __GMP_DECLSPEC void mpz_cdiv_r_2exp (mpz_ptr, mpz_srcptr, mp_bitcnt_t);
    672  1.1  christos 
    673  1.1  christos #define mpz_cdiv_r_ui __gmpz_cdiv_r_ui
    674  1.1  christos __GMP_DECLSPEC unsigned long int mpz_cdiv_r_ui (mpz_ptr, mpz_srcptr, unsigned long int);
    675  1.1  christos 
    676  1.1  christos #define mpz_cdiv_ui __gmpz_cdiv_ui
    677  1.1  christos __GMP_DECLSPEC unsigned long int mpz_cdiv_ui (mpz_srcptr, unsigned long int) __GMP_ATTRIBUTE_PURE;
    678  1.1  christos 
    679  1.1  christos #define mpz_clear __gmpz_clear
    680  1.1  christos __GMP_DECLSPEC void mpz_clear (mpz_ptr);
    681  1.1  christos 
    682  1.1  christos #define mpz_clears __gmpz_clears
    683  1.1  christos __GMP_DECLSPEC void mpz_clears (mpz_ptr, ...);
    684  1.1  christos 
    685  1.1  christos #define mpz_clrbit __gmpz_clrbit
    686  1.1  christos __GMP_DECLSPEC void mpz_clrbit (mpz_ptr, mp_bitcnt_t);
    687  1.1  christos 
    688  1.1  christos #define mpz_cmp __gmpz_cmp
    689  1.1  christos __GMP_DECLSPEC int mpz_cmp (mpz_srcptr, mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
    690  1.1  christos 
    691  1.1  christos #define mpz_cmp_d __gmpz_cmp_d
    692  1.1  christos __GMP_DECLSPEC int mpz_cmp_d (mpz_srcptr, double) __GMP_ATTRIBUTE_PURE;
    693  1.1  christos 
    694  1.1  christos #define _mpz_cmp_si __gmpz_cmp_si
    695  1.1  christos __GMP_DECLSPEC int _mpz_cmp_si (mpz_srcptr, signed long int) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
    696  1.1  christos 
    697  1.1  christos #define _mpz_cmp_ui __gmpz_cmp_ui
    698  1.1  christos __GMP_DECLSPEC int _mpz_cmp_ui (mpz_srcptr, unsigned long int) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
    699  1.1  christos 
    700  1.1  christos #define mpz_cmpabs __gmpz_cmpabs
    701  1.1  christos __GMP_DECLSPEC int mpz_cmpabs (mpz_srcptr, mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
    702  1.1  christos 
    703  1.1  christos #define mpz_cmpabs_d __gmpz_cmpabs_d
    704  1.1  christos __GMP_DECLSPEC int mpz_cmpabs_d (mpz_srcptr, double) __GMP_ATTRIBUTE_PURE;
    705  1.1  christos 
    706  1.1  christos #define mpz_cmpabs_ui __gmpz_cmpabs_ui
    707  1.1  christos __GMP_DECLSPEC int mpz_cmpabs_ui (mpz_srcptr, unsigned long int) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
    708  1.1  christos 
    709  1.1  christos #define mpz_com __gmpz_com
    710  1.1  christos __GMP_DECLSPEC void mpz_com (mpz_ptr, mpz_srcptr);
    711  1.1  christos 
    712  1.1  christos #define mpz_combit __gmpz_combit
    713  1.1  christos __GMP_DECLSPEC void mpz_combit (mpz_ptr, mp_bitcnt_t);
    714  1.1  christos 
    715  1.1  christos #define mpz_congruent_p __gmpz_congruent_p
    716  1.1  christos __GMP_DECLSPEC int mpz_congruent_p (mpz_srcptr, mpz_srcptr, mpz_srcptr) __GMP_ATTRIBUTE_PURE;
    717  1.1  christos 
    718  1.1  christos #define mpz_congruent_2exp_p __gmpz_congruent_2exp_p
    719  1.1  christos __GMP_DECLSPEC int mpz_congruent_2exp_p (mpz_srcptr, mpz_srcptr, mp_bitcnt_t) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
    720  1.1  christos 
    721  1.1  christos #define mpz_congruent_ui_p __gmpz_congruent_ui_p
    722  1.1  christos __GMP_DECLSPEC int mpz_congruent_ui_p (mpz_srcptr, unsigned long, unsigned long) __GMP_ATTRIBUTE_PURE;
    723  1.1  christos 
    724  1.1  christos #define mpz_divexact __gmpz_divexact
    725  1.1  christos __GMP_DECLSPEC void mpz_divexact (mpz_ptr, mpz_srcptr, mpz_srcptr);
    726  1.1  christos 
    727  1.1  christos #define mpz_divexact_ui __gmpz_divexact_ui
    728  1.1  christos __GMP_DECLSPEC void mpz_divexact_ui (mpz_ptr, mpz_srcptr, unsigned long);
    729  1.1  christos 
    730  1.1  christos #define mpz_divisible_p __gmpz_divisible_p
    731  1.1  christos __GMP_DECLSPEC int mpz_divisible_p (mpz_srcptr, mpz_srcptr) __GMP_ATTRIBUTE_PURE;
    732  1.1  christos 
    733  1.1  christos #define mpz_divisible_ui_p __gmpz_divisible_ui_p
    734  1.1  christos __GMP_DECLSPEC int mpz_divisible_ui_p (mpz_srcptr, unsigned long) __GMP_ATTRIBUTE_PURE;
    735  1.1  christos 
    736  1.1  christos #define mpz_divisible_2exp_p __gmpz_divisible_2exp_p
    737  1.1  christos __GMP_DECLSPEC int mpz_divisible_2exp_p (mpz_srcptr, mp_bitcnt_t) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
    738  1.1  christos 
    739  1.1  christos #define mpz_dump __gmpz_dump
    740  1.1  christos __GMP_DECLSPEC void mpz_dump (mpz_srcptr);
    741  1.1  christos 
    742  1.1  christos #define mpz_export __gmpz_export
    743  1.1  christos __GMP_DECLSPEC void *mpz_export (void *, size_t *, int, size_t, int, size_t, mpz_srcptr);
    744  1.1  christos 
    745  1.1  christos #define mpz_fac_ui __gmpz_fac_ui
    746  1.1  christos __GMP_DECLSPEC void mpz_fac_ui (mpz_ptr, unsigned long int);
    747  1.1  christos 
    748  1.1  christos #define mpz_2fac_ui __gmpz_2fac_ui
    749  1.1  christos __GMP_DECLSPEC void mpz_2fac_ui (mpz_ptr, unsigned long int);
    750  1.1  christos 
    751  1.1  christos #define mpz_mfac_uiui __gmpz_mfac_uiui
    752  1.1  christos __GMP_DECLSPEC void mpz_mfac_uiui (mpz_ptr, unsigned long int, unsigned long int);
    753  1.1  christos 
    754  1.1  christos #define mpz_primorial_ui __gmpz_primorial_ui
    755  1.1  christos __GMP_DECLSPEC void mpz_primorial_ui (mpz_ptr, unsigned long int);
    756  1.1  christos 
    757  1.1  christos #define mpz_fdiv_q __gmpz_fdiv_q
    758  1.1  christos __GMP_DECLSPEC void mpz_fdiv_q (mpz_ptr, mpz_srcptr, mpz_srcptr);
    759  1.1  christos 
    760  1.1  christos #define mpz_fdiv_q_2exp __gmpz_fdiv_q_2exp
    761  1.1  christos __GMP_DECLSPEC void mpz_fdiv_q_2exp (mpz_ptr, mpz_srcptr, mp_bitcnt_t);
    762  1.1  christos 
    763  1.1  christos #define mpz_fdiv_q_ui __gmpz_fdiv_q_ui
    764  1.1  christos __GMP_DECLSPEC unsigned long int mpz_fdiv_q_ui (mpz_ptr, mpz_srcptr, unsigned long int);
    765  1.1  christos 
    766  1.1  christos #define mpz_fdiv_qr __gmpz_fdiv_qr
    767  1.1  christos __GMP_DECLSPEC void mpz_fdiv_qr (mpz_ptr, mpz_ptr, mpz_srcptr, mpz_srcptr);
    768  1.1  christos 
    769  1.1  christos #define mpz_fdiv_qr_ui __gmpz_fdiv_qr_ui
    770  1.1  christos __GMP_DECLSPEC unsigned long int mpz_fdiv_qr_ui (mpz_ptr, mpz_ptr, mpz_srcptr, unsigned long int);
    771  1.1  christos 
    772  1.1  christos #define mpz_fdiv_r __gmpz_fdiv_r
    773  1.1  christos __GMP_DECLSPEC void mpz_fdiv_r (mpz_ptr, mpz_srcptr, mpz_srcptr);
    774  1.1  christos 
    775  1.1  christos #define mpz_fdiv_r_2exp __gmpz_fdiv_r_2exp
    776  1.1  christos __GMP_DECLSPEC void mpz_fdiv_r_2exp (mpz_ptr, mpz_srcptr, mp_bitcnt_t);
    777  1.1  christos 
    778  1.1  christos #define mpz_fdiv_r_ui __gmpz_fdiv_r_ui
    779  1.1  christos __GMP_DECLSPEC unsigned long int mpz_fdiv_r_ui (mpz_ptr, mpz_srcptr, unsigned long int);
    780  1.1  christos 
    781  1.1  christos #define mpz_fdiv_ui __gmpz_fdiv_ui
    782  1.1  christos __GMP_DECLSPEC unsigned long int mpz_fdiv_ui (mpz_srcptr, unsigned long int) __GMP_ATTRIBUTE_PURE;
    783  1.1  christos 
    784  1.1  christos #define mpz_fib_ui __gmpz_fib_ui
    785  1.1  christos __GMP_DECLSPEC void mpz_fib_ui (mpz_ptr, unsigned long int);
    786  1.1  christos 
    787  1.1  christos #define mpz_fib2_ui __gmpz_fib2_ui
    788  1.1  christos __GMP_DECLSPEC void mpz_fib2_ui (mpz_ptr, mpz_ptr, unsigned long int);
    789  1.1  christos 
    790  1.1  christos #define mpz_fits_sint_p __gmpz_fits_sint_p
    791  1.1  christos __GMP_DECLSPEC int mpz_fits_sint_p (mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
    792  1.1  christos 
    793  1.1  christos #define mpz_fits_slong_p __gmpz_fits_slong_p
    794  1.1  christos __GMP_DECLSPEC int mpz_fits_slong_p (mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
    795  1.1  christos 
    796  1.1  christos #define mpz_fits_sshort_p __gmpz_fits_sshort_p
    797  1.1  christos __GMP_DECLSPEC int mpz_fits_sshort_p (mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
    798  1.1  christos 
    799  1.1  christos #define mpz_fits_uint_p __gmpz_fits_uint_p
    800  1.1  christos #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_fits_uint_p)
    801  1.1  christos __GMP_DECLSPEC int mpz_fits_uint_p (mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
    802  1.1  christos #endif
    803  1.1  christos 
    804  1.1  christos #define mpz_fits_ulong_p __gmpz_fits_ulong_p
    805  1.1  christos #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_fits_ulong_p)
    806  1.1  christos __GMP_DECLSPEC int mpz_fits_ulong_p (mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
    807  1.1  christos #endif
    808  1.1  christos 
    809  1.1  christos #define mpz_fits_ushort_p __gmpz_fits_ushort_p
    810  1.1  christos #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_fits_ushort_p)
    811  1.1  christos __GMP_DECLSPEC int mpz_fits_ushort_p (mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
    812  1.1  christos #endif
    813  1.1  christos 
    814  1.1  christos #define mpz_gcd __gmpz_gcd
    815  1.1  christos __GMP_DECLSPEC void mpz_gcd (mpz_ptr, mpz_srcptr, mpz_srcptr);
    816  1.1  christos 
    817  1.1  christos #define mpz_gcd_ui __gmpz_gcd_ui
    818  1.1  christos __GMP_DECLSPEC unsigned long int mpz_gcd_ui (mpz_ptr, mpz_srcptr, unsigned long int);
    819  1.1  christos 
    820  1.1  christos #define mpz_gcdext __gmpz_gcdext
    821  1.1  christos __GMP_DECLSPEC void mpz_gcdext (mpz_ptr, mpz_ptr, mpz_ptr, mpz_srcptr, mpz_srcptr);
    822  1.1  christos 
    823  1.1  christos #define mpz_get_d __gmpz_get_d
    824  1.1  christos __GMP_DECLSPEC double mpz_get_d (mpz_srcptr) __GMP_ATTRIBUTE_PURE;
    825  1.1  christos 
    826  1.1  christos #define mpz_get_d_2exp __gmpz_get_d_2exp
    827  1.1  christos __GMP_DECLSPEC double mpz_get_d_2exp (signed long int *, mpz_srcptr);
    828  1.1  christos 
    829  1.1  christos #define mpz_get_si __gmpz_get_si
    830  1.1  christos __GMP_DECLSPEC /* signed */ long int mpz_get_si (mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
    831  1.1  christos 
    832  1.1  christos #define mpz_get_str __gmpz_get_str
    833  1.1  christos __GMP_DECLSPEC char *mpz_get_str (char *, int, mpz_srcptr);
    834  1.1  christos 
    835  1.1  christos #define mpz_get_ui __gmpz_get_ui
    836  1.1  christos #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_get_ui)
    837  1.1  christos __GMP_DECLSPEC unsigned long int mpz_get_ui (mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
    838  1.1  christos #endif
    839  1.1  christos 
    840  1.1  christos #define mpz_getlimbn __gmpz_getlimbn
    841  1.1  christos #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_getlimbn)
    842  1.1  christos __GMP_DECLSPEC mp_limb_t mpz_getlimbn (mpz_srcptr, mp_size_t) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
    843  1.1  christos #endif
    844  1.1  christos 
    845  1.1  christos #define mpz_hamdist __gmpz_hamdist
    846  1.1  christos __GMP_DECLSPEC mp_bitcnt_t mpz_hamdist (mpz_srcptr, mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
    847  1.1  christos 
    848  1.1  christos #define mpz_import __gmpz_import
    849  1.1  christos __GMP_DECLSPEC void mpz_import (mpz_ptr, size_t, int, size_t, int, size_t, const void *);
    850  1.1  christos 
    851  1.1  christos #define mpz_init __gmpz_init
    852  1.1  christos __GMP_DECLSPEC void mpz_init (mpz_ptr) __GMP_NOTHROW;
    853  1.1  christos 
    854  1.1  christos #define mpz_init2 __gmpz_init2
    855  1.1  christos __GMP_DECLSPEC void mpz_init2 (mpz_ptr, mp_bitcnt_t);
    856  1.1  christos 
    857  1.1  christos #define mpz_inits __gmpz_inits
    858  1.1  christos __GMP_DECLSPEC void mpz_inits (mpz_ptr, ...) __GMP_NOTHROW;
    859  1.1  christos 
    860  1.1  christos #define mpz_init_set __gmpz_init_set
    861  1.1  christos __GMP_DECLSPEC void mpz_init_set (mpz_ptr, mpz_srcptr);
    862  1.1  christos 
    863  1.1  christos #define mpz_init_set_d __gmpz_init_set_d
    864  1.1  christos __GMP_DECLSPEC void mpz_init_set_d (mpz_ptr, double);
    865  1.1  christos 
    866  1.1  christos #define mpz_init_set_si __gmpz_init_set_si
    867  1.1  christos __GMP_DECLSPEC void mpz_init_set_si (mpz_ptr, signed long int);
    868  1.1  christos 
    869  1.1  christos #define mpz_init_set_str __gmpz_init_set_str
    870  1.1  christos __GMP_DECLSPEC int mpz_init_set_str (mpz_ptr, const char *, int);
    871  1.1  christos 
    872  1.1  christos #define mpz_init_set_ui __gmpz_init_set_ui
    873  1.1  christos __GMP_DECLSPEC void mpz_init_set_ui (mpz_ptr, unsigned long int);
    874  1.1  christos 
    875  1.1  christos #define mpz_inp_raw __gmpz_inp_raw
    876  1.1  christos #ifdef _GMP_H_HAVE_FILE
    877  1.1  christos __GMP_DECLSPEC size_t mpz_inp_raw (mpz_ptr, FILE *);
    878  1.1  christos #endif
    879  1.1  christos 
    880  1.1  christos #define mpz_inp_str __gmpz_inp_str
    881  1.1  christos #ifdef _GMP_H_HAVE_FILE
    882  1.1  christos __GMP_DECLSPEC size_t mpz_inp_str (mpz_ptr, FILE *, int);
    883  1.1  christos #endif
    884  1.1  christos 
    885  1.1  christos #define mpz_invert __gmpz_invert
    886  1.1  christos __GMP_DECLSPEC int mpz_invert (mpz_ptr, mpz_srcptr, mpz_srcptr);
    887  1.1  christos 
    888  1.1  christos #define mpz_ior __gmpz_ior
    889  1.1  christos __GMP_DECLSPEC void mpz_ior (mpz_ptr, mpz_srcptr, mpz_srcptr);
    890  1.1  christos 
    891  1.1  christos #define mpz_jacobi __gmpz_jacobi
    892  1.1  christos __GMP_DECLSPEC int mpz_jacobi (mpz_srcptr, mpz_srcptr) __GMP_ATTRIBUTE_PURE;
    893  1.1  christos 
    894  1.1  christos #define mpz_kronecker mpz_jacobi  /* alias */
    895  1.1  christos 
    896  1.1  christos #define mpz_kronecker_si __gmpz_kronecker_si
    897  1.1  christos __GMP_DECLSPEC int mpz_kronecker_si (mpz_srcptr, long) __GMP_ATTRIBUTE_PURE;
    898  1.1  christos 
    899  1.1  christos #define mpz_kronecker_ui __gmpz_kronecker_ui
    900  1.1  christos __GMP_DECLSPEC int mpz_kronecker_ui (mpz_srcptr, unsigned long) __GMP_ATTRIBUTE_PURE;
    901  1.1  christos 
    902  1.1  christos #define mpz_si_kronecker __gmpz_si_kronecker
    903  1.1  christos __GMP_DECLSPEC int mpz_si_kronecker (long, mpz_srcptr) __GMP_ATTRIBUTE_PURE;
    904  1.1  christos 
    905  1.1  christos #define mpz_ui_kronecker __gmpz_ui_kronecker
    906  1.1  christos __GMP_DECLSPEC int mpz_ui_kronecker (unsigned long, mpz_srcptr) __GMP_ATTRIBUTE_PURE;
    907  1.1  christos 
    908  1.1  christos #define mpz_lcm __gmpz_lcm
    909  1.1  christos __GMP_DECLSPEC void mpz_lcm (mpz_ptr, mpz_srcptr, mpz_srcptr);
    910  1.1  christos 
    911  1.1  christos #define mpz_lcm_ui __gmpz_lcm_ui
    912  1.1  christos __GMP_DECLSPEC void mpz_lcm_ui (mpz_ptr, mpz_srcptr, unsigned long);
    913  1.1  christos 
    914  1.1  christos #define mpz_legendre mpz_jacobi  /* alias */
    915  1.1  christos 
    916  1.1  christos #define mpz_lucnum_ui __gmpz_lucnum_ui
    917  1.1  christos __GMP_DECLSPEC void mpz_lucnum_ui (mpz_ptr, unsigned long int);
    918  1.1  christos 
    919  1.1  christos #define mpz_lucnum2_ui __gmpz_lucnum2_ui
    920  1.1  christos __GMP_DECLSPEC void mpz_lucnum2_ui (mpz_ptr, mpz_ptr, unsigned long int);
    921  1.1  christos 
    922  1.1  christos #define mpz_millerrabin __gmpz_millerrabin
    923  1.1  christos __GMP_DECLSPEC int mpz_millerrabin (mpz_srcptr, int) __GMP_ATTRIBUTE_PURE;
    924  1.1  christos 
    925  1.1  christos #define mpz_mod __gmpz_mod
    926  1.1  christos __GMP_DECLSPEC void mpz_mod (mpz_ptr, mpz_srcptr, mpz_srcptr);
    927  1.1  christos 
    928  1.1  christos #define mpz_mod_ui mpz_fdiv_r_ui /* same as fdiv_r because divisor unsigned */
    929  1.1  christos 
    930  1.1  christos #define mpz_mul __gmpz_mul
    931  1.1  christos __GMP_DECLSPEC void mpz_mul (mpz_ptr, mpz_srcptr, mpz_srcptr);
    932  1.1  christos 
    933  1.1  christos #define mpz_mul_2exp __gmpz_mul_2exp
    934  1.1  christos __GMP_DECLSPEC void mpz_mul_2exp (mpz_ptr, mpz_srcptr, mp_bitcnt_t);
    935  1.1  christos 
    936  1.1  christos #define mpz_mul_si __gmpz_mul_si
    937  1.1  christos __GMP_DECLSPEC void mpz_mul_si (mpz_ptr, mpz_srcptr, long int);
    938  1.1  christos 
    939  1.1  christos #define mpz_mul_ui __gmpz_mul_ui
    940  1.1  christos __GMP_DECLSPEC void mpz_mul_ui (mpz_ptr, mpz_srcptr, unsigned long int);
    941  1.1  christos 
    942  1.1  christos #define mpz_neg __gmpz_neg
    943  1.1  christos #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_neg)
    944  1.1  christos __GMP_DECLSPEC void mpz_neg (mpz_ptr, mpz_srcptr);
    945  1.1  christos #endif
    946  1.1  christos 
    947  1.1  christos #define mpz_nextprime __gmpz_nextprime
    948  1.1  christos __GMP_DECLSPEC void mpz_nextprime (mpz_ptr, mpz_srcptr);
    949  1.1  christos 
    950  1.1  christos #define mpz_out_raw __gmpz_out_raw
    951  1.1  christos #ifdef _GMP_H_HAVE_FILE
    952  1.1  christos __GMP_DECLSPEC size_t mpz_out_raw (FILE *, mpz_srcptr);
    953  1.1  christos #endif
    954  1.1  christos 
    955  1.1  christos #define mpz_out_str __gmpz_out_str
    956  1.1  christos #ifdef _GMP_H_HAVE_FILE
    957  1.1  christos __GMP_DECLSPEC size_t mpz_out_str (FILE *, int, mpz_srcptr);
    958  1.1  christos #endif
    959  1.1  christos 
    960  1.1  christos #define mpz_perfect_power_p __gmpz_perfect_power_p
    961  1.1  christos __GMP_DECLSPEC int mpz_perfect_power_p (mpz_srcptr) __GMP_ATTRIBUTE_PURE;
    962  1.1  christos 
    963  1.1  christos #define mpz_perfect_square_p __gmpz_perfect_square_p
    964  1.1  christos #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_perfect_square_p)
    965  1.1  christos __GMP_DECLSPEC int mpz_perfect_square_p (mpz_srcptr) __GMP_ATTRIBUTE_PURE;
    966  1.1  christos #endif
    967  1.1  christos 
    968  1.1  christos #define mpz_popcount __gmpz_popcount
    969  1.1  christos #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_popcount)
    970  1.1  christos __GMP_DECLSPEC mp_bitcnt_t mpz_popcount (mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
    971  1.1  christos #endif
    972  1.1  christos 
    973  1.1  christos #define mpz_pow_ui __gmpz_pow_ui
    974  1.1  christos __GMP_DECLSPEC void mpz_pow_ui (mpz_ptr, mpz_srcptr, unsigned long int);
    975  1.1  christos 
    976  1.1  christos #define mpz_powm __gmpz_powm
    977  1.1  christos __GMP_DECLSPEC void mpz_powm (mpz_ptr, mpz_srcptr, mpz_srcptr, mpz_srcptr);
    978  1.1  christos 
    979  1.1  christos #define mpz_powm_sec __gmpz_powm_sec
    980  1.1  christos __GMP_DECLSPEC void mpz_powm_sec (mpz_ptr, mpz_srcptr, mpz_srcptr, mpz_srcptr);
    981  1.1  christos 
    982  1.1  christos #define mpz_powm_ui __gmpz_powm_ui
    983  1.1  christos __GMP_DECLSPEC void mpz_powm_ui (mpz_ptr, mpz_srcptr, unsigned long int, mpz_srcptr);
    984  1.1  christos 
    985  1.1  christos #define mpz_probab_prime_p __gmpz_probab_prime_p
    986  1.1  christos __GMP_DECLSPEC int mpz_probab_prime_p (mpz_srcptr, int) __GMP_ATTRIBUTE_PURE;
    987  1.1  christos 
    988  1.1  christos #define mpz_random __gmpz_random
    989  1.1  christos __GMP_DECLSPEC void mpz_random (mpz_ptr, mp_size_t);
    990  1.1  christos 
    991  1.1  christos #define mpz_random2 __gmpz_random2
    992  1.1  christos __GMP_DECLSPEC void mpz_random2 (mpz_ptr, mp_size_t);
    993  1.1  christos 
    994  1.1  christos #define mpz_realloc2 __gmpz_realloc2
    995  1.1  christos __GMP_DECLSPEC void mpz_realloc2 (mpz_ptr, mp_bitcnt_t);
    996  1.1  christos 
    997  1.1  christos #define mpz_remove __gmpz_remove
    998  1.1  christos __GMP_DECLSPEC mp_bitcnt_t mpz_remove (mpz_ptr, mpz_srcptr, mpz_srcptr);
    999  1.1  christos 
   1000  1.1  christos #define mpz_root __gmpz_root
   1001  1.1  christos __GMP_DECLSPEC int mpz_root (mpz_ptr, mpz_srcptr, unsigned long int);
   1002  1.1  christos 
   1003  1.1  christos #define mpz_rootrem __gmpz_rootrem
   1004  1.1  christos __GMP_DECLSPEC void mpz_rootrem (mpz_ptr, mpz_ptr, mpz_srcptr, unsigned long int);
   1005  1.1  christos 
   1006  1.1  christos #define mpz_rrandomb __gmpz_rrandomb
   1007  1.1  christos __GMP_DECLSPEC void mpz_rrandomb (mpz_ptr, gmp_randstate_t, mp_bitcnt_t);
   1008  1.1  christos 
   1009  1.1  christos #define mpz_scan0 __gmpz_scan0
   1010  1.1  christos __GMP_DECLSPEC mp_bitcnt_t mpz_scan0 (mpz_srcptr, mp_bitcnt_t) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
   1011  1.1  christos 
   1012  1.1  christos #define mpz_scan1 __gmpz_scan1
   1013  1.1  christos __GMP_DECLSPEC mp_bitcnt_t mpz_scan1 (mpz_srcptr, mp_bitcnt_t) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
   1014  1.1  christos 
   1015  1.1  christos #define mpz_set __gmpz_set
   1016  1.1  christos __GMP_DECLSPEC void mpz_set (mpz_ptr, mpz_srcptr);
   1017  1.1  christos 
   1018  1.1  christos #define mpz_set_d __gmpz_set_d
   1019  1.1  christos __GMP_DECLSPEC void mpz_set_d (mpz_ptr, double);
   1020  1.1  christos 
   1021  1.1  christos #define mpz_set_f __gmpz_set_f
   1022  1.1  christos __GMP_DECLSPEC void mpz_set_f (mpz_ptr, mpf_srcptr);
   1023  1.1  christos 
   1024  1.1  christos #define mpz_set_q __gmpz_set_q
   1025  1.1  christos #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_set_q)
   1026  1.1  christos __GMP_DECLSPEC void mpz_set_q (mpz_ptr, mpq_srcptr);
   1027  1.1  christos #endif
   1028  1.1  christos 
   1029  1.1  christos #define mpz_set_si __gmpz_set_si
   1030  1.1  christos __GMP_DECLSPEC void mpz_set_si (mpz_ptr, signed long int);
   1031  1.1  christos 
   1032  1.1  christos #define mpz_set_str __gmpz_set_str
   1033  1.1  christos __GMP_DECLSPEC int mpz_set_str (mpz_ptr, const char *, int);
   1034  1.1  christos 
   1035  1.1  christos #define mpz_set_ui __gmpz_set_ui
   1036  1.1  christos __GMP_DECLSPEC void mpz_set_ui (mpz_ptr, unsigned long int);
   1037  1.1  christos 
   1038  1.1  christos #define mpz_setbit __gmpz_setbit
   1039  1.1  christos __GMP_DECLSPEC void mpz_setbit (mpz_ptr, mp_bitcnt_t);
   1040  1.1  christos 
   1041  1.1  christos #define mpz_size __gmpz_size
   1042  1.1  christos #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_size)
   1043  1.1  christos __GMP_DECLSPEC size_t mpz_size (mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
   1044  1.1  christos #endif
   1045  1.1  christos 
   1046  1.1  christos #define mpz_sizeinbase __gmpz_sizeinbase
   1047  1.1  christos __GMP_DECLSPEC size_t mpz_sizeinbase (mpz_srcptr, int) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
   1048  1.1  christos 
   1049  1.1  christos #define mpz_sqrt __gmpz_sqrt
   1050  1.1  christos __GMP_DECLSPEC void mpz_sqrt (mpz_ptr, mpz_srcptr);
   1051  1.1  christos 
   1052  1.1  christos #define mpz_sqrtrem __gmpz_sqrtrem
   1053  1.1  christos __GMP_DECLSPEC void mpz_sqrtrem (mpz_ptr, mpz_ptr, mpz_srcptr);
   1054  1.1  christos 
   1055  1.1  christos #define mpz_sub __gmpz_sub
   1056  1.1  christos __GMP_DECLSPEC void mpz_sub (mpz_ptr, mpz_srcptr, mpz_srcptr);
   1057  1.1  christos 
   1058  1.1  christos #define mpz_sub_ui __gmpz_sub_ui
   1059  1.1  christos __GMP_DECLSPEC void mpz_sub_ui (mpz_ptr, mpz_srcptr, unsigned long int);
   1060  1.1  christos 
   1061  1.1  christos #define mpz_ui_sub __gmpz_ui_sub
   1062  1.1  christos __GMP_DECLSPEC void mpz_ui_sub (mpz_ptr, unsigned long int, mpz_srcptr);
   1063  1.1  christos 
   1064  1.1  christos #define mpz_submul __gmpz_submul
   1065  1.1  christos __GMP_DECLSPEC void mpz_submul (mpz_ptr, mpz_srcptr, mpz_srcptr);
   1066  1.1  christos 
   1067  1.1  christos #define mpz_submul_ui __gmpz_submul_ui
   1068  1.1  christos __GMP_DECLSPEC void mpz_submul_ui (mpz_ptr, mpz_srcptr, unsigned long int);
   1069  1.1  christos 
   1070  1.1  christos #define mpz_swap __gmpz_swap
   1071  1.1  christos __GMP_DECLSPEC void mpz_swap (mpz_ptr, mpz_ptr) __GMP_NOTHROW;
   1072  1.1  christos 
   1073  1.1  christos #define mpz_tdiv_ui __gmpz_tdiv_ui
   1074  1.1  christos __GMP_DECLSPEC unsigned long int mpz_tdiv_ui (mpz_srcptr, unsigned long int) __GMP_ATTRIBUTE_PURE;
   1075  1.1  christos 
   1076  1.1  christos #define mpz_tdiv_q __gmpz_tdiv_q
   1077  1.1  christos __GMP_DECLSPEC void mpz_tdiv_q (mpz_ptr, mpz_srcptr, mpz_srcptr);
   1078  1.1  christos 
   1079  1.1  christos #define mpz_tdiv_q_2exp __gmpz_tdiv_q_2exp
   1080  1.1  christos __GMP_DECLSPEC void mpz_tdiv_q_2exp (mpz_ptr, mpz_srcptr, mp_bitcnt_t);
   1081  1.1  christos 
   1082  1.1  christos #define mpz_tdiv_q_ui __gmpz_tdiv_q_ui
   1083  1.1  christos __GMP_DECLSPEC unsigned long int mpz_tdiv_q_ui (mpz_ptr, mpz_srcptr, unsigned long int);
   1084  1.1  christos 
   1085  1.1  christos #define mpz_tdiv_qr __gmpz_tdiv_qr
   1086  1.1  christos __GMP_DECLSPEC void mpz_tdiv_qr (mpz_ptr, mpz_ptr, mpz_srcptr, mpz_srcptr);
   1087  1.1  christos 
   1088  1.1  christos #define mpz_tdiv_qr_ui __gmpz_tdiv_qr_ui
   1089  1.1  christos __GMP_DECLSPEC unsigned long int mpz_tdiv_qr_ui (mpz_ptr, mpz_ptr, mpz_srcptr, unsigned long int);
   1090  1.1  christos 
   1091  1.1  christos #define mpz_tdiv_r __gmpz_tdiv_r
   1092  1.1  christos __GMP_DECLSPEC void mpz_tdiv_r (mpz_ptr, mpz_srcptr, mpz_srcptr);
   1093  1.1  christos 
   1094  1.1  christos #define mpz_tdiv_r_2exp __gmpz_tdiv_r_2exp
   1095  1.1  christos __GMP_DECLSPEC void mpz_tdiv_r_2exp (mpz_ptr, mpz_srcptr, mp_bitcnt_t);
   1096  1.1  christos 
   1097  1.1  christos #define mpz_tdiv_r_ui __gmpz_tdiv_r_ui
   1098  1.1  christos __GMP_DECLSPEC unsigned long int mpz_tdiv_r_ui (mpz_ptr, mpz_srcptr, unsigned long int);
   1099  1.1  christos 
   1100  1.1  christos #define mpz_tstbit __gmpz_tstbit
   1101  1.1  christos __GMP_DECLSPEC int mpz_tstbit (mpz_srcptr, mp_bitcnt_t) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
   1102  1.1  christos 
   1103  1.1  christos #define mpz_ui_pow_ui __gmpz_ui_pow_ui
   1104  1.1  christos __GMP_DECLSPEC void mpz_ui_pow_ui (mpz_ptr, unsigned long int, unsigned long int);
   1105  1.1  christos 
   1106  1.1  christos #define mpz_urandomb __gmpz_urandomb
   1107  1.1  christos __GMP_DECLSPEC void mpz_urandomb (mpz_ptr, gmp_randstate_t, mp_bitcnt_t);
   1108  1.1  christos 
   1109  1.1  christos #define mpz_urandomm __gmpz_urandomm
   1110  1.1  christos __GMP_DECLSPEC void mpz_urandomm (mpz_ptr, gmp_randstate_t, mpz_srcptr);
   1111  1.1  christos 
   1112  1.1  christos #define mpz_xor __gmpz_xor
   1113  1.1  christos #define mpz_eor __gmpz_xor
   1114  1.1  christos __GMP_DECLSPEC void mpz_xor (mpz_ptr, mpz_srcptr, mpz_srcptr);
   1115  1.1  christos 
   1116  1.1  christos #define mpz_limbs_read __gmpz_limbs_read
   1117  1.1  christos __GMP_DECLSPEC mp_srcptr mpz_limbs_read (mpz_srcptr);
   1118  1.1  christos 
   1119  1.1  christos #define mpz_limbs_write __gmpz_limbs_write
   1120  1.1  christos __GMP_DECLSPEC mp_ptr mpz_limbs_write (mpz_ptr, mp_size_t);
   1121  1.1  christos 
   1122  1.1  christos #define mpz_limbs_modify __gmpz_limbs_modify
   1123  1.1  christos __GMP_DECLSPEC mp_ptr mpz_limbs_modify (mpz_ptr, mp_size_t);
   1124  1.1  christos 
   1125  1.1  christos #define mpz_limbs_finish __gmpz_limbs_finish
   1126  1.1  christos __GMP_DECLSPEC void mpz_limbs_finish (mpz_ptr, mp_size_t);
   1127  1.1  christos 
   1128  1.1  christos #define mpz_roinit_n __gmpz_roinit_n
   1129  1.1  christos __GMP_DECLSPEC mpz_srcptr mpz_roinit_n (mpz_ptr, mp_srcptr, mp_size_t);
   1130  1.1  christos 
   1131  1.1  christos #define MPZ_ROINIT_N(xp, xs) {{0, (xs),(xp) }}
   1132  1.1  christos 
   1133  1.1  christos /**************** Rational (i.e. Q) routines.  ****************/
   1134  1.1  christos 
   1135  1.1  christos #define mpq_abs __gmpq_abs
   1136  1.1  christos #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpq_abs)
   1137  1.1  christos __GMP_DECLSPEC void mpq_abs (mpq_ptr, mpq_srcptr);
   1138  1.1  christos #endif
   1139  1.1  christos 
   1140  1.1  christos #define mpq_add __gmpq_add
   1141  1.1  christos __GMP_DECLSPEC void mpq_add (mpq_ptr, mpq_srcptr, mpq_srcptr);
   1142  1.1  christos 
   1143  1.1  christos #define mpq_canonicalize __gmpq_canonicalize
   1144  1.1  christos __GMP_DECLSPEC void mpq_canonicalize (mpq_ptr);
   1145  1.1  christos 
   1146  1.1  christos #define mpq_clear __gmpq_clear
   1147  1.1  christos __GMP_DECLSPEC void mpq_clear (mpq_ptr);
   1148  1.1  christos 
   1149  1.1  christos #define mpq_clears __gmpq_clears
   1150  1.1  christos __GMP_DECLSPEC void mpq_clears (mpq_ptr, ...);
   1151  1.1  christos 
   1152  1.1  christos #define mpq_cmp __gmpq_cmp
   1153  1.1  christos __GMP_DECLSPEC int mpq_cmp (mpq_srcptr, mpq_srcptr) __GMP_ATTRIBUTE_PURE;
   1154  1.1  christos 
   1155  1.1  christos #define _mpq_cmp_si __gmpq_cmp_si
   1156  1.1  christos __GMP_DECLSPEC int _mpq_cmp_si (mpq_srcptr, long, unsigned long) __GMP_ATTRIBUTE_PURE;
   1157  1.1  christos 
   1158  1.1  christos #define _mpq_cmp_ui __gmpq_cmp_ui
   1159  1.1  christos __GMP_DECLSPEC int _mpq_cmp_ui (mpq_srcptr, unsigned long int, unsigned long int) __GMP_ATTRIBUTE_PURE;
   1160  1.1  christos 
   1161  1.1  christos #define mpq_cmp_z __gmpq_cmp_z
   1162  1.1  christos __GMP_DECLSPEC int mpq_cmp_z (mpq_srcptr, mpz_srcptr) __GMP_ATTRIBUTE_PURE;
   1163  1.1  christos 
   1164  1.1  christos #define mpq_div __gmpq_div
   1165  1.1  christos __GMP_DECLSPEC void mpq_div (mpq_ptr, mpq_srcptr, mpq_srcptr);
   1166  1.1  christos 
   1167  1.1  christos #define mpq_div_2exp __gmpq_div_2exp
   1168  1.1  christos __GMP_DECLSPEC void mpq_div_2exp (mpq_ptr, mpq_srcptr, mp_bitcnt_t);
   1169  1.1  christos 
   1170  1.1  christos #define mpq_equal __gmpq_equal
   1171  1.1  christos __GMP_DECLSPEC int mpq_equal (mpq_srcptr, mpq_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
   1172  1.1  christos 
   1173  1.1  christos #define mpq_get_num __gmpq_get_num
   1174  1.1  christos __GMP_DECLSPEC void mpq_get_num (mpz_ptr, mpq_srcptr);
   1175  1.1  christos 
   1176  1.1  christos #define mpq_get_den __gmpq_get_den
   1177  1.1  christos __GMP_DECLSPEC void mpq_get_den (mpz_ptr, mpq_srcptr);
   1178  1.1  christos 
   1179  1.1  christos #define mpq_get_d __gmpq_get_d
   1180  1.1  christos __GMP_DECLSPEC double mpq_get_d (mpq_srcptr) __GMP_ATTRIBUTE_PURE;
   1181  1.1  christos 
   1182  1.1  christos #define mpq_get_str __gmpq_get_str
   1183  1.1  christos __GMP_DECLSPEC char *mpq_get_str (char *, int, mpq_srcptr);
   1184  1.1  christos 
   1185  1.1  christos #define mpq_init __gmpq_init
   1186  1.1  christos __GMP_DECLSPEC void mpq_init (mpq_ptr);
   1187  1.1  christos 
   1188  1.1  christos #define mpq_inits __gmpq_inits
   1189  1.1  christos __GMP_DECLSPEC void mpq_inits (mpq_ptr, ...);
   1190  1.1  christos 
   1191  1.1  christos #define mpq_inp_str __gmpq_inp_str
   1192  1.1  christos #ifdef _GMP_H_HAVE_FILE
   1193  1.1  christos __GMP_DECLSPEC size_t mpq_inp_str (mpq_ptr, FILE *, int);
   1194  1.1  christos #endif
   1195  1.1  christos 
   1196  1.1  christos #define mpq_inv __gmpq_inv
   1197  1.1  christos __GMP_DECLSPEC void mpq_inv (mpq_ptr, mpq_srcptr);
   1198  1.1  christos 
   1199  1.1  christos #define mpq_mul __gmpq_mul
   1200  1.1  christos __GMP_DECLSPEC void mpq_mul (mpq_ptr, mpq_srcptr, mpq_srcptr);
   1201  1.1  christos 
   1202  1.1  christos #define mpq_mul_2exp __gmpq_mul_2exp
   1203  1.1  christos __GMP_DECLSPEC void mpq_mul_2exp (mpq_ptr, mpq_srcptr, mp_bitcnt_t);
   1204  1.1  christos 
   1205  1.1  christos #define mpq_neg __gmpq_neg
   1206  1.1  christos #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpq_neg)
   1207  1.1  christos __GMP_DECLSPEC void mpq_neg (mpq_ptr, mpq_srcptr);
   1208  1.1  christos #endif
   1209  1.1  christos 
   1210  1.1  christos #define mpq_out_str __gmpq_out_str
   1211  1.1  christos #ifdef _GMP_H_HAVE_FILE
   1212  1.1  christos __GMP_DECLSPEC size_t mpq_out_str (FILE *, int, mpq_srcptr);
   1213  1.1  christos #endif
   1214  1.1  christos 
   1215  1.1  christos #define mpq_set __gmpq_set
   1216  1.1  christos __GMP_DECLSPEC void mpq_set (mpq_ptr, mpq_srcptr);
   1217  1.1  christos 
   1218  1.1  christos #define mpq_set_d __gmpq_set_d
   1219  1.1  christos __GMP_DECLSPEC void mpq_set_d (mpq_ptr, double);
   1220  1.1  christos 
   1221  1.1  christos #define mpq_set_den __gmpq_set_den
   1222  1.1  christos __GMP_DECLSPEC void mpq_set_den (mpq_ptr, mpz_srcptr);
   1223  1.1  christos 
   1224  1.1  christos #define mpq_set_f __gmpq_set_f
   1225  1.1  christos __GMP_DECLSPEC void mpq_set_f (mpq_ptr, mpf_srcptr);
   1226  1.1  christos 
   1227  1.1  christos #define mpq_set_num __gmpq_set_num
   1228  1.1  christos __GMP_DECLSPEC void mpq_set_num (mpq_ptr, mpz_srcptr);
   1229  1.1  christos 
   1230  1.1  christos #define mpq_set_si __gmpq_set_si
   1231  1.1  christos __GMP_DECLSPEC void mpq_set_si (mpq_ptr, signed long int, unsigned long int);
   1232  1.1  christos 
   1233  1.1  christos #define mpq_set_str __gmpq_set_str
   1234  1.1  christos __GMP_DECLSPEC int mpq_set_str (mpq_ptr, const char *, int);
   1235  1.1  christos 
   1236  1.1  christos #define mpq_set_ui __gmpq_set_ui
   1237  1.1  christos __GMP_DECLSPEC void mpq_set_ui (mpq_ptr, unsigned long int, unsigned long int);
   1238  1.1  christos 
   1239  1.1  christos #define mpq_set_z __gmpq_set_z
   1240  1.1  christos __GMP_DECLSPEC void mpq_set_z (mpq_ptr, mpz_srcptr);
   1241  1.1  christos 
   1242  1.1  christos #define mpq_sub __gmpq_sub
   1243  1.1  christos __GMP_DECLSPEC void mpq_sub (mpq_ptr, mpq_srcptr, mpq_srcptr);
   1244  1.1  christos 
   1245  1.1  christos #define mpq_swap __gmpq_swap
   1246  1.1  christos __GMP_DECLSPEC void mpq_swap (mpq_ptr, mpq_ptr) __GMP_NOTHROW;
   1247  1.1  christos 
   1248  1.1  christos 
   1249  1.1  christos /**************** Float (i.e. F) routines.  ****************/
   1250  1.1  christos 
   1251  1.1  christos #define mpf_abs __gmpf_abs
   1252  1.1  christos __GMP_DECLSPEC void mpf_abs (mpf_ptr, mpf_srcptr);
   1253  1.1  christos 
   1254  1.1  christos #define mpf_add __gmpf_add
   1255  1.1  christos __GMP_DECLSPEC void mpf_add (mpf_ptr, mpf_srcptr, mpf_srcptr);
   1256  1.1  christos 
   1257  1.1  christos #define mpf_add_ui __gmpf_add_ui
   1258  1.1  christos __GMP_DECLSPEC void mpf_add_ui (mpf_ptr, mpf_srcptr, unsigned long int);
   1259  1.1  christos #define mpf_ceil __gmpf_ceil
   1260  1.1  christos __GMP_DECLSPEC void mpf_ceil (mpf_ptr, mpf_srcptr);
   1261  1.1  christos 
   1262  1.1  christos #define mpf_clear __gmpf_clear
   1263  1.1  christos __GMP_DECLSPEC void mpf_clear (mpf_ptr);
   1264  1.1  christos 
   1265  1.1  christos #define mpf_clears __gmpf_clears
   1266  1.1  christos __GMP_DECLSPEC void mpf_clears (mpf_ptr, ...);
   1267  1.1  christos 
   1268  1.1  christos #define mpf_cmp __gmpf_cmp
   1269  1.1  christos __GMP_DECLSPEC int mpf_cmp (mpf_srcptr, mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
   1270  1.1  christos 
   1271  1.1  christos #define mpf_cmp_z __gmpf_cmp_z
   1272  1.1  christos __GMP_DECLSPEC int mpf_cmp_z (mpf_srcptr, mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
   1273  1.1  christos 
   1274  1.1  christos #define mpf_cmp_d __gmpf_cmp_d
   1275  1.1  christos __GMP_DECLSPEC int mpf_cmp_d (mpf_srcptr, double) __GMP_ATTRIBUTE_PURE;
   1276  1.1  christos 
   1277  1.1  christos #define mpf_cmp_si __gmpf_cmp_si
   1278  1.1  christos __GMP_DECLSPEC int mpf_cmp_si (mpf_srcptr, signed long int) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
   1279  1.1  christos 
   1280  1.1  christos #define mpf_cmp_ui __gmpf_cmp_ui
   1281  1.1  christos __GMP_DECLSPEC int mpf_cmp_ui (mpf_srcptr, unsigned long int) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
   1282  1.1  christos 
   1283  1.1  christos #define mpf_div __gmpf_div
   1284  1.1  christos __GMP_DECLSPEC void mpf_div (mpf_ptr, mpf_srcptr, mpf_srcptr);
   1285  1.1  christos 
   1286  1.1  christos #define mpf_div_2exp __gmpf_div_2exp
   1287  1.1  christos __GMP_DECLSPEC void mpf_div_2exp (mpf_ptr, mpf_srcptr, mp_bitcnt_t);
   1288  1.1  christos 
   1289  1.1  christos #define mpf_div_ui __gmpf_div_ui
   1290  1.1  christos __GMP_DECLSPEC void mpf_div_ui (mpf_ptr, mpf_srcptr, unsigned long int);
   1291  1.1  christos 
   1292  1.1  christos #define mpf_dump __gmpf_dump
   1293  1.1  christos __GMP_DECLSPEC void mpf_dump (mpf_srcptr);
   1294  1.1  christos 
   1295  1.1  christos #define mpf_eq __gmpf_eq
   1296  1.1  christos __GMP_DECLSPEC int mpf_eq (mpf_srcptr, mpf_srcptr, mp_bitcnt_t) __GMP_ATTRIBUTE_PURE;
   1297  1.1  christos 
   1298  1.1  christos #define mpf_fits_sint_p __gmpf_fits_sint_p
   1299  1.1  christos __GMP_DECLSPEC int mpf_fits_sint_p (mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
   1300  1.1  christos 
   1301  1.1  christos #define mpf_fits_slong_p __gmpf_fits_slong_p
   1302  1.1  christos __GMP_DECLSPEC int mpf_fits_slong_p (mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
   1303  1.1  christos 
   1304  1.1  christos #define mpf_fits_sshort_p __gmpf_fits_sshort_p
   1305  1.1  christos __GMP_DECLSPEC int mpf_fits_sshort_p (mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
   1306  1.1  christos 
   1307  1.1  christos #define mpf_fits_uint_p __gmpf_fits_uint_p
   1308  1.1  christos __GMP_DECLSPEC int mpf_fits_uint_p (mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
   1309  1.1  christos 
   1310  1.1  christos #define mpf_fits_ulong_p __gmpf_fits_ulong_p
   1311  1.1  christos __GMP_DECLSPEC int mpf_fits_ulong_p (mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
   1312  1.1  christos 
   1313  1.1  christos #define mpf_fits_ushort_p __gmpf_fits_ushort_p
   1314  1.1  christos __GMP_DECLSPEC int mpf_fits_ushort_p (mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
   1315  1.1  christos 
   1316  1.1  christos #define mpf_floor __gmpf_floor
   1317  1.1  christos __GMP_DECLSPEC void mpf_floor (mpf_ptr, mpf_srcptr);
   1318  1.1  christos 
   1319  1.1  christos #define mpf_get_d __gmpf_get_d
   1320  1.1  christos __GMP_DECLSPEC double mpf_get_d (mpf_srcptr) __GMP_ATTRIBUTE_PURE;
   1321  1.1  christos 
   1322  1.1  christos #define mpf_get_d_2exp __gmpf_get_d_2exp
   1323  1.1  christos __GMP_DECLSPEC double mpf_get_d_2exp (signed long int *, mpf_srcptr);
   1324  1.1  christos 
   1325  1.1  christos #define mpf_get_default_prec __gmpf_get_default_prec
   1326  1.1  christos __GMP_DECLSPEC mp_bitcnt_t mpf_get_default_prec (void) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
   1327  1.1  christos 
   1328  1.1  christos #define mpf_get_prec __gmpf_get_prec
   1329  1.1  christos __GMP_DECLSPEC mp_bitcnt_t mpf_get_prec (mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
   1330  1.1  christos 
   1331  1.1  christos #define mpf_get_si __gmpf_get_si
   1332  1.1  christos __GMP_DECLSPEC long mpf_get_si (mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
   1333  1.1  christos 
   1334  1.1  christos #define mpf_get_str __gmpf_get_str
   1335  1.1  christos __GMP_DECLSPEC char *mpf_get_str (char *, mp_exp_t *, int, size_t, mpf_srcptr);
   1336  1.1  christos 
   1337  1.1  christos #define mpf_get_ui __gmpf_get_ui
   1338  1.1  christos __GMP_DECLSPEC unsigned long mpf_get_ui (mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
   1339  1.1  christos 
   1340  1.1  christos #define mpf_init __gmpf_init
   1341  1.1  christos __GMP_DECLSPEC void mpf_init (mpf_ptr);
   1342  1.1  christos 
   1343  1.1  christos #define mpf_init2 __gmpf_init2
   1344  1.1  christos __GMP_DECLSPEC void mpf_init2 (mpf_ptr, mp_bitcnt_t);
   1345  1.1  christos 
   1346  1.1  christos #define mpf_inits __gmpf_inits
   1347  1.1  christos __GMP_DECLSPEC void mpf_inits (mpf_ptr, ...);
   1348  1.1  christos 
   1349  1.1  christos #define mpf_init_set __gmpf_init_set
   1350  1.1  christos __GMP_DECLSPEC void mpf_init_set (mpf_ptr, mpf_srcptr);
   1351  1.1  christos 
   1352  1.1  christos #define mpf_init_set_d __gmpf_init_set_d
   1353  1.1  christos __GMP_DECLSPEC void mpf_init_set_d (mpf_ptr, double);
   1354  1.1  christos 
   1355  1.1  christos #define mpf_init_set_si __gmpf_init_set_si
   1356  1.1  christos __GMP_DECLSPEC void mpf_init_set_si (mpf_ptr, signed long int);
   1357  1.1  christos 
   1358  1.1  christos #define mpf_init_set_str __gmpf_init_set_str
   1359  1.1  christos __GMP_DECLSPEC int mpf_init_set_str (mpf_ptr, const char *, int);
   1360  1.1  christos 
   1361  1.1  christos #define mpf_init_set_ui __gmpf_init_set_ui
   1362  1.1  christos __GMP_DECLSPEC void mpf_init_set_ui (mpf_ptr, unsigned long int);
   1363  1.1  christos 
   1364  1.1  christos #define mpf_inp_str __gmpf_inp_str
   1365  1.1  christos #ifdef _GMP_H_HAVE_FILE
   1366  1.1  christos __GMP_DECLSPEC size_t mpf_inp_str (mpf_ptr, FILE *, int);
   1367  1.1  christos #endif
   1368  1.1  christos 
   1369  1.1  christos #define mpf_integer_p __gmpf_integer_p
   1370  1.1  christos __GMP_DECLSPEC int mpf_integer_p (mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
   1371  1.1  christos 
   1372  1.1  christos #define mpf_mul __gmpf_mul
   1373  1.1  christos __GMP_DECLSPEC void mpf_mul (mpf_ptr, mpf_srcptr, mpf_srcptr);
   1374  1.1  christos 
   1375  1.1  christos #define mpf_mul_2exp __gmpf_mul_2exp
   1376  1.1  christos __GMP_DECLSPEC void mpf_mul_2exp (mpf_ptr, mpf_srcptr, mp_bitcnt_t);
   1377  1.1  christos 
   1378  1.1  christos #define mpf_mul_ui __gmpf_mul_ui
   1379  1.1  christos __GMP_DECLSPEC void mpf_mul_ui (mpf_ptr, mpf_srcptr, unsigned long int);
   1380  1.1  christos 
   1381  1.1  christos #define mpf_neg __gmpf_neg
   1382  1.1  christos __GMP_DECLSPEC void mpf_neg (mpf_ptr, mpf_srcptr);
   1383  1.1  christos 
   1384  1.1  christos #define mpf_out_str __gmpf_out_str
   1385  1.1  christos #ifdef _GMP_H_HAVE_FILE
   1386  1.1  christos __GMP_DECLSPEC size_t mpf_out_str (FILE *, int, size_t, mpf_srcptr);
   1387  1.1  christos #endif
   1388  1.1  christos 
   1389  1.1  christos #define mpf_pow_ui __gmpf_pow_ui
   1390  1.1  christos __GMP_DECLSPEC void mpf_pow_ui (mpf_ptr, mpf_srcptr, unsigned long int);
   1391  1.1  christos 
   1392  1.1  christos #define mpf_random2 __gmpf_random2
   1393  1.1  christos __GMP_DECLSPEC void mpf_random2 (mpf_ptr, mp_size_t, mp_exp_t);
   1394  1.1  christos 
   1395  1.1  christos #define mpf_reldiff __gmpf_reldiff
   1396  1.1  christos __GMP_DECLSPEC void mpf_reldiff (mpf_ptr, mpf_srcptr, mpf_srcptr);
   1397  1.1  christos 
   1398  1.1  christos #define mpf_set __gmpf_set
   1399  1.1  christos __GMP_DECLSPEC void mpf_set (mpf_ptr, mpf_srcptr);
   1400  1.1  christos 
   1401  1.1  christos #define mpf_set_d __gmpf_set_d
   1402  1.1  christos __GMP_DECLSPEC void mpf_set_d (mpf_ptr, double);
   1403  1.1  christos 
   1404  1.1  christos #define mpf_set_default_prec __gmpf_set_default_prec
   1405  1.1  christos __GMP_DECLSPEC void mpf_set_default_prec (mp_bitcnt_t) __GMP_NOTHROW;
   1406  1.1  christos 
   1407  1.1  christos #define mpf_set_prec __gmpf_set_prec
   1408  1.1  christos __GMP_DECLSPEC void mpf_set_prec (mpf_ptr, mp_bitcnt_t);
   1409  1.1  christos 
   1410  1.1  christos #define mpf_set_prec_raw __gmpf_set_prec_raw
   1411  1.1  christos __GMP_DECLSPEC void mpf_set_prec_raw (mpf_ptr, mp_bitcnt_t) __GMP_NOTHROW;
   1412  1.1  christos 
   1413  1.1  christos #define mpf_set_q __gmpf_set_q
   1414  1.1  christos __GMP_DECLSPEC void mpf_set_q (mpf_ptr, mpq_srcptr);
   1415  1.1  christos 
   1416  1.1  christos #define mpf_set_si __gmpf_set_si
   1417  1.1  christos __GMP_DECLSPEC void mpf_set_si (mpf_ptr, signed long int);
   1418  1.1  christos 
   1419  1.1  christos #define mpf_set_str __gmpf_set_str
   1420  1.1  christos __GMP_DECLSPEC int mpf_set_str (mpf_ptr, const char *, int);
   1421  1.1  christos 
   1422  1.1  christos #define mpf_set_ui __gmpf_set_ui
   1423  1.1  christos __GMP_DECLSPEC void mpf_set_ui (mpf_ptr, unsigned long int);
   1424  1.1  christos 
   1425  1.1  christos #define mpf_set_z __gmpf_set_z
   1426  1.1  christos __GMP_DECLSPEC void mpf_set_z (mpf_ptr, mpz_srcptr);
   1427  1.1  christos 
   1428  1.1  christos #define mpf_size __gmpf_size
   1429  1.1  christos __GMP_DECLSPEC size_t mpf_size (mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
   1430  1.1  christos 
   1431  1.1  christos #define mpf_sqrt __gmpf_sqrt
   1432  1.1  christos __GMP_DECLSPEC void mpf_sqrt (mpf_ptr, mpf_srcptr);
   1433  1.1  christos 
   1434  1.1  christos #define mpf_sqrt_ui __gmpf_sqrt_ui
   1435  1.1  christos __GMP_DECLSPEC void mpf_sqrt_ui (mpf_ptr, unsigned long int);
   1436  1.1  christos 
   1437  1.1  christos #define mpf_sub __gmpf_sub
   1438  1.1  christos __GMP_DECLSPEC void mpf_sub (mpf_ptr, mpf_srcptr, mpf_srcptr);
   1439  1.1  christos 
   1440  1.1  christos #define mpf_sub_ui __gmpf_sub_ui
   1441  1.1  christos __GMP_DECLSPEC void mpf_sub_ui (mpf_ptr, mpf_srcptr, unsigned long int);
   1442  1.1  christos 
   1443  1.1  christos #define mpf_swap __gmpf_swap
   1444  1.1  christos __GMP_DECLSPEC void mpf_swap (mpf_ptr, mpf_ptr) __GMP_NOTHROW;
   1445  1.1  christos 
   1446  1.1  christos #define mpf_trunc __gmpf_trunc
   1447  1.1  christos __GMP_DECLSPEC void mpf_trunc (mpf_ptr, mpf_srcptr);
   1448  1.1  christos 
   1449  1.1  christos #define mpf_ui_div __gmpf_ui_div
   1450  1.1  christos __GMP_DECLSPEC void mpf_ui_div (mpf_ptr, unsigned long int, mpf_srcptr);
   1451  1.1  christos 
   1452  1.1  christos #define mpf_ui_sub __gmpf_ui_sub
   1453  1.1  christos __GMP_DECLSPEC void mpf_ui_sub (mpf_ptr, unsigned long int, mpf_srcptr);
   1454  1.1  christos 
   1455  1.1  christos #define mpf_urandomb __gmpf_urandomb
   1456  1.1  christos __GMP_DECLSPEC void mpf_urandomb (mpf_t, gmp_randstate_t, mp_bitcnt_t);
   1457  1.1  christos 
   1458  1.1  christos 
   1459  1.1  christos /************ Low level positive-integer (i.e. N) routines.  ************/
   1460  1.1  christos 
   1461  1.1  christos /* This is ugly, but we need to make user calls reach the prefixed function. */
   1462  1.1  christos 
   1463  1.1  christos #define mpn_add __MPN(add)
   1464  1.1  christos #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpn_add)
   1465  1.1  christos __GMP_DECLSPEC mp_limb_t mpn_add (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t);
   1466  1.1  christos #endif
   1467  1.1  christos 
   1468  1.1  christos #define mpn_add_1 __MPN(add_1)
   1469  1.1  christos #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpn_add_1)
   1470  1.1  christos __GMP_DECLSPEC mp_limb_t mpn_add_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t) __GMP_NOTHROW;
   1471  1.1  christos #endif
   1472  1.1  christos 
   1473  1.1  christos #define mpn_add_n __MPN(add_n)
   1474  1.1  christos __GMP_DECLSPEC mp_limb_t mpn_add_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
   1475  1.1  christos 
   1476  1.1  christos #define mpn_addmul_1 __MPN(addmul_1)
   1477  1.1  christos __GMP_DECLSPEC mp_limb_t mpn_addmul_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
   1478  1.1  christos 
   1479  1.1  christos #define mpn_cmp __MPN(cmp)
   1480  1.1  christos #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpn_cmp)
   1481  1.1  christos __GMP_DECLSPEC int mpn_cmp (mp_srcptr, mp_srcptr, mp_size_t) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
   1482  1.1  christos #endif
   1483  1.1  christos 
   1484  1.1  christos #define mpn_zero_p __MPN(zero_p)
   1485  1.1  christos #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpn_zero_p)
   1486  1.1  christos __GMP_DECLSPEC int mpn_zero_p (mp_srcptr, mp_size_t) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
   1487  1.1  christos #endif
   1488  1.1  christos 
   1489  1.1  christos #define mpn_divexact_1 __MPN(divexact_1)
   1490  1.1  christos __GMP_DECLSPEC void mpn_divexact_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
   1491  1.1  christos 
   1492  1.1  christos #define mpn_divexact_by3(dst,src,size) \
   1493  1.1  christos   mpn_divexact_by3c (dst, src, size, __GMP_CAST (mp_limb_t, 0))
   1494  1.1  christos 
   1495  1.1  christos #define mpn_divexact_by3c __MPN(divexact_by3c)
   1496  1.1  christos __GMP_DECLSPEC mp_limb_t mpn_divexact_by3c (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
   1497  1.1  christos 
   1498  1.1  christos #define mpn_divmod_1(qp,np,nsize,dlimb) \
   1499  1.1  christos   mpn_divrem_1 (qp, __GMP_CAST (mp_size_t, 0), np, nsize, dlimb)
   1500  1.1  christos 
   1501  1.1  christos #define mpn_divrem __MPN(divrem)
   1502  1.1  christos __GMP_DECLSPEC mp_limb_t mpn_divrem (mp_ptr, mp_size_t, mp_ptr, mp_size_t, mp_srcptr, mp_size_t);
   1503  1.1  christos 
   1504  1.1  christos #define mpn_divrem_1 __MPN(divrem_1)
   1505  1.1  christos __GMP_DECLSPEC mp_limb_t mpn_divrem_1 (mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t);
   1506  1.1  christos 
   1507  1.1  christos #define mpn_divrem_2 __MPN(divrem_2)
   1508  1.1  christos __GMP_DECLSPEC mp_limb_t mpn_divrem_2 (mp_ptr, mp_size_t, mp_ptr, mp_size_t, mp_srcptr);
   1509  1.1  christos 
   1510  1.1  christos #define mpn_div_qr_1 __MPN(div_qr_1)
   1511  1.1  christos __GMP_DECLSPEC mp_limb_t mpn_div_qr_1 (mp_ptr, mp_limb_t *, mp_srcptr, mp_size_t, mp_limb_t);
   1512  1.1  christos 
   1513  1.1  christos #define mpn_div_qr_2 __MPN(div_qr_2)
   1514  1.1  christos __GMP_DECLSPEC mp_limb_t mpn_div_qr_2 (mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_srcptr);
   1515  1.1  christos 
   1516  1.1  christos #define mpn_gcd __MPN(gcd)
   1517  1.1  christos __GMP_DECLSPEC mp_size_t mpn_gcd (mp_ptr, mp_ptr, mp_size_t, mp_ptr, mp_size_t);
   1518  1.1  christos 
   1519  1.1  christos #define mpn_gcd_11 __MPN(gcd_11)
   1520  1.1  christos __GMP_DECLSPEC mp_limb_t mpn_gcd_11 (mp_limb_t, mp_limb_t) __GMP_ATTRIBUTE_PURE;
   1521  1.1  christos 
   1522  1.1  christos #define mpn_gcd_1 __MPN(gcd_1)
   1523  1.1  christos __GMP_DECLSPEC mp_limb_t mpn_gcd_1 (mp_srcptr, mp_size_t, mp_limb_t) __GMP_ATTRIBUTE_PURE;
   1524  1.1  christos 
   1525  1.1  christos #define mpn_gcdext_1 __MPN(gcdext_1)
   1526  1.1  christos __GMP_DECLSPEC mp_limb_t mpn_gcdext_1 (mp_limb_signed_t *, mp_limb_signed_t *, mp_limb_t, mp_limb_t);
   1527  1.1  christos 
   1528  1.1  christos #define mpn_gcdext __MPN(gcdext)
   1529  1.1  christos __GMP_DECLSPEC mp_size_t mpn_gcdext (mp_ptr, mp_ptr, mp_size_t *, mp_ptr, mp_size_t, mp_ptr, mp_size_t);
   1530  1.1  christos 
   1531  1.1  christos #define mpn_get_str __MPN(get_str)
   1532  1.1  christos __GMP_DECLSPEC size_t mpn_get_str (unsigned char *, int, mp_ptr, mp_size_t);
   1533  1.1  christos 
   1534  1.1  christos #define mpn_hamdist __MPN(hamdist)
   1535  1.1  christos __GMP_DECLSPEC mp_bitcnt_t mpn_hamdist (mp_srcptr, mp_srcptr, mp_size_t) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
   1536  1.1  christos 
   1537  1.1  christos #define mpn_lshift __MPN(lshift)
   1538  1.1  christos __GMP_DECLSPEC mp_limb_t mpn_lshift (mp_ptr, mp_srcptr, mp_size_t, unsigned int);
   1539  1.1  christos 
   1540  1.1  christos #define mpn_mod_1 __MPN(mod_1)
   1541  1.1  christos __GMP_DECLSPEC mp_limb_t mpn_mod_1 (mp_srcptr, mp_size_t, mp_limb_t) __GMP_ATTRIBUTE_PURE;
   1542  1.1  christos 
   1543  1.1  christos #define mpn_mul __MPN(mul)
   1544  1.1  christos __GMP_DECLSPEC mp_limb_t mpn_mul (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t);
   1545  1.1  christos 
   1546  1.1  christos #define mpn_mul_1 __MPN(mul_1)
   1547  1.1  christos __GMP_DECLSPEC mp_limb_t mpn_mul_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
   1548  1.1  christos 
   1549  1.1  christos #define mpn_mul_n __MPN(mul_n)
   1550  1.1  christos __GMP_DECLSPEC void mpn_mul_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
   1551  1.1  christos 
   1552  1.1  christos #define mpn_sqr __MPN(sqr)
   1553  1.1  christos __GMP_DECLSPEC void mpn_sqr (mp_ptr, mp_srcptr, mp_size_t);
   1554  1.1  christos 
   1555  1.1  christos #define mpn_neg __MPN(neg)
   1556  1.1  christos #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpn_neg)
   1557  1.1  christos __GMP_DECLSPEC mp_limb_t mpn_neg (mp_ptr, mp_srcptr, mp_size_t);
   1558  1.1  christos #endif
   1559  1.1  christos 
   1560  1.1  christos #define mpn_com __MPN(com)
   1561  1.1  christos __GMP_DECLSPEC void mpn_com (mp_ptr, mp_srcptr, mp_size_t);
   1562  1.1  christos 
   1563  1.1  christos #define mpn_perfect_square_p __MPN(perfect_square_p)
   1564  1.1  christos __GMP_DECLSPEC int mpn_perfect_square_p (mp_srcptr, mp_size_t) __GMP_ATTRIBUTE_PURE;
   1565  1.1  christos 
   1566  1.1  christos #define mpn_perfect_power_p __MPN(perfect_power_p)
   1567  1.1  christos __GMP_DECLSPEC int mpn_perfect_power_p (mp_srcptr, mp_size_t) __GMP_ATTRIBUTE_PURE;
   1568  1.1  christos 
   1569  1.1  christos #define mpn_popcount __MPN(popcount)
   1570  1.1  christos __GMP_DECLSPEC mp_bitcnt_t mpn_popcount (mp_srcptr, mp_size_t) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
   1571  1.1  christos 
   1572  1.1  christos #define mpn_pow_1 __MPN(pow_1)
   1573  1.1  christos __GMP_DECLSPEC mp_size_t mpn_pow_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_ptr);
   1574  1.1  christos 
   1575  1.1  christos /* undocumented now, but retained here for upward compatibility */
   1576  1.1  christos #define mpn_preinv_mod_1 __MPN(preinv_mod_1)
   1577  1.1  christos __GMP_DECLSPEC mp_limb_t mpn_preinv_mod_1 (mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t) __GMP_ATTRIBUTE_PURE;
   1578  1.1  christos 
   1579  1.1  christos #define mpn_random __MPN(random)
   1580  1.1  christos __GMP_DECLSPEC void mpn_random (mp_ptr, mp_size_t);
   1581  1.1  christos 
   1582  1.1  christos #define mpn_random2 __MPN(random2)
   1583  1.1  christos __GMP_DECLSPEC void mpn_random2 (mp_ptr, mp_size_t);
   1584  1.1  christos 
   1585  1.1  christos #define mpn_rshift __MPN(rshift)
   1586  1.1  christos __GMP_DECLSPEC mp_limb_t mpn_rshift (mp_ptr, mp_srcptr, mp_size_t, unsigned int);
   1587  1.1  christos 
   1588  1.1  christos #define mpn_scan0 __MPN(scan0)
   1589  1.1  christos __GMP_DECLSPEC mp_bitcnt_t mpn_scan0 (mp_srcptr, mp_bitcnt_t) __GMP_ATTRIBUTE_PURE;
   1590  1.1  christos 
   1591  1.1  christos #define mpn_scan1 __MPN(scan1)
   1592  1.1  christos __GMP_DECLSPEC mp_bitcnt_t mpn_scan1 (mp_srcptr, mp_bitcnt_t) __GMP_ATTRIBUTE_PURE;
   1593  1.1  christos 
   1594  1.1  christos #define mpn_set_str __MPN(set_str)
   1595  1.1  christos __GMP_DECLSPEC mp_size_t mpn_set_str (mp_ptr, const unsigned char *, size_t, int);
   1596  1.1  christos 
   1597  1.1  christos #define mpn_sizeinbase __MPN(sizeinbase)
   1598  1.1  christos __GMP_DECLSPEC size_t mpn_sizeinbase (mp_srcptr, mp_size_t, int);
   1599  1.1  christos 
   1600  1.1  christos #define mpn_sqrtrem __MPN(sqrtrem)
   1601  1.1  christos __GMP_DECLSPEC mp_size_t mpn_sqrtrem (mp_ptr, mp_ptr, mp_srcptr, mp_size_t);
   1602  1.1  christos 
   1603  1.1  christos #define mpn_sub __MPN(sub)
   1604  1.1  christos #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpn_sub)
   1605  1.1  christos __GMP_DECLSPEC mp_limb_t mpn_sub (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t);
   1606  1.1  christos #endif
   1607  1.1  christos 
   1608  1.1  christos #define mpn_sub_1 __MPN(sub_1)
   1609  1.1  christos #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpn_sub_1)
   1610  1.1  christos __GMP_DECLSPEC mp_limb_t mpn_sub_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t) __GMP_NOTHROW;
   1611  1.1  christos #endif
   1612  1.1  christos 
   1613  1.1  christos #define mpn_sub_n __MPN(sub_n)
   1614  1.1  christos __GMP_DECLSPEC mp_limb_t mpn_sub_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
   1615  1.1  christos 
   1616  1.1  christos #define mpn_submul_1 __MPN(submul_1)
   1617  1.1  christos __GMP_DECLSPEC mp_limb_t mpn_submul_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
   1618  1.1  christos 
   1619  1.1  christos #define mpn_tdiv_qr __MPN(tdiv_qr)
   1620  1.1  christos __GMP_DECLSPEC void mpn_tdiv_qr (mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t);
   1621  1.1  christos 
   1622  1.1  christos #define mpn_and_n __MPN(and_n)
   1623  1.1  christos __GMP_DECLSPEC void mpn_and_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
   1624  1.1  christos #define mpn_andn_n __MPN(andn_n)
   1625  1.1  christos __GMP_DECLSPEC void mpn_andn_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
   1626  1.1  christos #define mpn_nand_n __MPN(nand_n)
   1627  1.1  christos __GMP_DECLSPEC void mpn_nand_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
   1628  1.1  christos #define mpn_ior_n __MPN(ior_n)
   1629  1.1  christos __GMP_DECLSPEC void mpn_ior_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
   1630  1.1  christos #define mpn_iorn_n __MPN(iorn_n)
   1631  1.1  christos __GMP_DECLSPEC void mpn_iorn_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
   1632  1.1  christos #define mpn_nior_n __MPN(nior_n)
   1633  1.1  christos __GMP_DECLSPEC void mpn_nior_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
   1634  1.1  christos #define mpn_xor_n __MPN(xor_n)
   1635  1.1  christos __GMP_DECLSPEC void mpn_xor_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
   1636  1.1  christos #define mpn_xnor_n __MPN(xnor_n)
   1637  1.1  christos __GMP_DECLSPEC void mpn_xnor_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
   1638  1.1  christos 
   1639  1.1  christos #define mpn_copyi __MPN(copyi)
   1640  1.1  christos __GMP_DECLSPEC void mpn_copyi (mp_ptr, mp_srcptr, mp_size_t);
   1641  1.1  christos #define mpn_copyd __MPN(copyd)
   1642  1.1  christos __GMP_DECLSPEC void mpn_copyd (mp_ptr, mp_srcptr, mp_size_t);
   1643  1.1  christos #define mpn_zero __MPN(zero)
   1644  1.1  christos __GMP_DECLSPEC void mpn_zero (mp_ptr, mp_size_t);
   1645  1.1  christos 
   1646  1.1  christos #define mpn_cnd_add_n __MPN(cnd_add_n)
   1647  1.1  christos __GMP_DECLSPEC mp_limb_t mpn_cnd_add_n (mp_limb_t, mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
   1648  1.1  christos #define mpn_cnd_sub_n __MPN(cnd_sub_n)
   1649  1.1  christos __GMP_DECLSPEC mp_limb_t mpn_cnd_sub_n (mp_limb_t, mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
   1650  1.1  christos 
   1651  1.1  christos #define mpn_sec_add_1 __MPN(sec_add_1)
   1652  1.1  christos __GMP_DECLSPEC mp_limb_t mpn_sec_add_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_ptr);
   1653  1.1  christos #define mpn_sec_add_1_itch __MPN(sec_add_1_itch)
   1654  1.1  christos __GMP_DECLSPEC mp_size_t mpn_sec_add_1_itch (mp_size_t) __GMP_ATTRIBUTE_PURE;
   1655  1.1  christos 
   1656  1.1  christos #define mpn_sec_sub_1 __MPN(sec_sub_1)
   1657  1.1  christos __GMP_DECLSPEC mp_limb_t mpn_sec_sub_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_ptr);
   1658  1.1  christos #define mpn_sec_sub_1_itch __MPN(sec_sub_1_itch)
   1659  1.1  christos __GMP_DECLSPEC mp_size_t mpn_sec_sub_1_itch (mp_size_t) __GMP_ATTRIBUTE_PURE;
   1660  1.1  christos 
   1661  1.1  christos #define mpn_cnd_swap  __MPN(cnd_swap)
   1662  1.1  christos __GMP_DECLSPEC void mpn_cnd_swap (mp_limb_t, volatile mp_limb_t *, volatile mp_limb_t *, mp_size_t);
   1663  1.1  christos 
   1664  1.1  christos #define mpn_sec_mul __MPN(sec_mul)
   1665  1.1  christos __GMP_DECLSPEC void mpn_sec_mul (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr);
   1666  1.1  christos #define mpn_sec_mul_itch __MPN(sec_mul_itch)
   1667  1.1  christos __GMP_DECLSPEC mp_size_t mpn_sec_mul_itch (mp_size_t, mp_size_t) __GMP_ATTRIBUTE_PURE;
   1668  1.1  christos 
   1669  1.1  christos #define mpn_sec_sqr __MPN(sec_sqr)
   1670  1.1  christos __GMP_DECLSPEC void mpn_sec_sqr (mp_ptr, mp_srcptr, mp_size_t, mp_ptr);
   1671  1.1  christos #define mpn_sec_sqr_itch __MPN(sec_sqr_itch)
   1672  1.1  christos __GMP_DECLSPEC mp_size_t mpn_sec_sqr_itch (mp_size_t) __GMP_ATTRIBUTE_PURE;
   1673  1.1  christos 
   1674  1.1  christos #define mpn_sec_powm __MPN(sec_powm)
   1675  1.1  christos __GMP_DECLSPEC void mpn_sec_powm (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_bitcnt_t, mp_srcptr, mp_size_t, mp_ptr);
   1676  1.1  christos #define mpn_sec_powm_itch __MPN(sec_powm_itch)
   1677  1.1  christos __GMP_DECLSPEC mp_size_t mpn_sec_powm_itch (mp_size_t, mp_bitcnt_t, mp_size_t) __GMP_ATTRIBUTE_PURE;
   1678  1.1  christos 
   1679  1.1  christos #define mpn_sec_tabselect __MPN(sec_tabselect)
   1680  1.1  christos __GMP_DECLSPEC void mpn_sec_tabselect (volatile mp_limb_t *, volatile const mp_limb_t *, mp_size_t, mp_size_t, mp_size_t);
   1681  1.1  christos 
   1682  1.1  christos #define mpn_sec_div_qr __MPN(sec_div_qr)
   1683  1.1  christos __GMP_DECLSPEC mp_limb_t mpn_sec_div_qr (mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr);
   1684  1.1  christos #define mpn_sec_div_qr_itch __MPN(sec_div_qr_itch)
   1685  1.1  christos __GMP_DECLSPEC mp_size_t mpn_sec_div_qr_itch (mp_size_t, mp_size_t) __GMP_ATTRIBUTE_PURE;
   1686  1.1  christos #define mpn_sec_div_r __MPN(sec_div_r)
   1687  1.1  christos __GMP_DECLSPEC void mpn_sec_div_r (mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr);
   1688  1.1  christos #define mpn_sec_div_r_itch __MPN(sec_div_r_itch)
   1689  1.1  christos __GMP_DECLSPEC mp_size_t mpn_sec_div_r_itch (mp_size_t, mp_size_t) __GMP_ATTRIBUTE_PURE;
   1690  1.1  christos 
   1691  1.1  christos #define mpn_sec_invert __MPN(sec_invert)
   1692  1.1  christos __GMP_DECLSPEC int mpn_sec_invert (mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_bitcnt_t, mp_ptr);
   1693  1.1  christos #define mpn_sec_invert_itch __MPN(sec_invert_itch)
   1694  1.1  christos __GMP_DECLSPEC mp_size_t mpn_sec_invert_itch (mp_size_t) __GMP_ATTRIBUTE_PURE;
   1695  1.1  christos 
   1696  1.1  christos 
   1697  1.1  christos /**************** mpz inlines ****************/
   1698  1.1  christos 
   1699  1.1  christos /* The following are provided as inlines where possible, but always exist as
   1700  1.1  christos    library functions too, for binary compatibility.
   1701  1.1  christos 
   1702  1.1  christos    Within gmp itself this inlining generally isn't relied on, since it
   1703  1.1  christos    doesn't get done for all compilers, whereas if something is worth
   1704  1.1  christos    inlining then it's worth arranging always.
   1705  1.1  christos 
   1706  1.1  christos    There are two styles of inlining here.  When the same bit of code is
   1707  1.1  christos    wanted for the inline as for the library version, then __GMP_FORCE_foo
   1708  1.1  christos    arranges for that code to be emitted and the __GMP_EXTERN_INLINE
   1709  1.1  christos    directive suppressed, eg. mpz_fits_uint_p.  When a different bit of code
   1710  1.1  christos    is wanted for the inline than for the library version, then
   1711  1.1  christos    __GMP_FORCE_foo arranges the inline to be suppressed, eg. mpz_abs.  */
   1712  1.1  christos 
   1713  1.1  christos #if defined (__GMP_EXTERN_INLINE) && ! defined (__GMP_FORCE_mpz_abs)
   1714  1.1  christos __GMP_EXTERN_INLINE void
   1715  1.1  christos mpz_abs (mpz_ptr __gmp_w, mpz_srcptr __gmp_u)
   1716  1.1  christos {
   1717  1.1  christos   if (__gmp_w != __gmp_u)
   1718  1.1  christos     mpz_set (__gmp_w, __gmp_u);
   1719  1.1  christos   __gmp_w->_mp_size = __GMP_ABS (__gmp_w->_mp_size);
   1720  1.1  christos }
   1721  1.1  christos #endif
   1722  1.1  christos 
   1723  1.1  christos #if GMP_NAIL_BITS == 0
   1724  1.1  christos #define __GMPZ_FITS_UTYPE_P(z,maxval)					\
   1725  1.1  christos   mp_size_t  __gmp_n = z->_mp_size;					\
   1726  1.1  christos   mp_ptr  __gmp_p = z->_mp_d;						\
   1727  1.1  christos   return (__gmp_n == 0 || (__gmp_n == 1 && __gmp_p[0] <= maxval));
   1728  1.1  christos #else
   1729  1.1  christos #define __GMPZ_FITS_UTYPE_P(z,maxval)					\
   1730  1.1  christos   mp_size_t  __gmp_n = z->_mp_size;					\
   1731  1.1  christos   mp_ptr  __gmp_p = z->_mp_d;						\
   1732  1.1  christos   return (__gmp_n == 0 || (__gmp_n == 1 && __gmp_p[0] <= maxval)	\
   1733  1.1  christos 	  || (__gmp_n == 2 && __gmp_p[1] <= ((mp_limb_t) maxval >> GMP_NUMB_BITS)));
   1734  1.1  christos #endif
   1735  1.1  christos 
   1736  1.1  christos #if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpz_fits_uint_p)
   1737  1.1  christos #if ! defined (__GMP_FORCE_mpz_fits_uint_p)
   1738  1.1  christos __GMP_EXTERN_INLINE
   1739  1.1  christos #endif
   1740  1.1  christos int
   1741  1.1  christos mpz_fits_uint_p (mpz_srcptr __gmp_z) __GMP_NOTHROW
   1742  1.1  christos {
   1743  1.1  christos   __GMPZ_FITS_UTYPE_P (__gmp_z, UINT_MAX);
   1744  1.1  christos }
   1745  1.1  christos #endif
   1746  1.1  christos 
   1747  1.1  christos #if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpz_fits_ulong_p)
   1748  1.1  christos #if ! defined (__GMP_FORCE_mpz_fits_ulong_p)
   1749  1.1  christos __GMP_EXTERN_INLINE
   1750  1.1  christos #endif
   1751  1.1  christos int
   1752  1.1  christos mpz_fits_ulong_p (mpz_srcptr __gmp_z) __GMP_NOTHROW
   1753  1.1  christos {
   1754  1.1  christos   __GMPZ_FITS_UTYPE_P (__gmp_z, ULONG_MAX);
   1755  1.1  christos }
   1756  1.1  christos #endif
   1757  1.1  christos 
   1758  1.1  christos #if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpz_fits_ushort_p)
   1759  1.1  christos #if ! defined (__GMP_FORCE_mpz_fits_ushort_p)
   1760  1.1  christos __GMP_EXTERN_INLINE
   1761  1.1  christos #endif
   1762  1.1  christos int
   1763  1.1  christos mpz_fits_ushort_p (mpz_srcptr __gmp_z) __GMP_NOTHROW
   1764  1.1  christos {
   1765  1.1  christos   __GMPZ_FITS_UTYPE_P (__gmp_z, USHRT_MAX);
   1766  1.1  christos }
   1767  1.1  christos #endif
   1768  1.1  christos 
   1769  1.1  christos #if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpz_get_ui)
   1770  1.1  christos #if ! defined (__GMP_FORCE_mpz_get_ui)
   1771  1.1  christos __GMP_EXTERN_INLINE
   1772  1.1  christos #endif
   1773  1.1  christos unsigned long
   1774  1.1  christos mpz_get_ui (mpz_srcptr __gmp_z) __GMP_NOTHROW
   1775  1.1  christos {
   1776  1.1  christos   mp_ptr __gmp_p = __gmp_z->_mp_d;
   1777  1.1  christos   mp_size_t __gmp_n = __gmp_z->_mp_size;
   1778  1.1  christos   mp_limb_t __gmp_l = __gmp_p[0];
   1779  1.1  christos   /* This is a "#if" rather than a plain "if" so as to avoid gcc warnings
   1780  1.1  christos      about "<< GMP_NUMB_BITS" exceeding the type size, and to avoid Borland
   1781  1.1  christos      C++ 6.0 warnings about condition always true for something like
   1782  1.1  christos      "ULONG_MAX < GMP_NUMB_MASK".  */
   1783  1.1  christos #if GMP_NAIL_BITS == 0 || defined (_LONG_LONG_LIMB)
   1784  1.1  christos   /* limb==long and no nails, or limb==longlong, one limb is enough */
   1785  1.1  christos   return (__gmp_n != 0 ? __gmp_l : 0);
   1786  1.1  christos #else
   1787  1.1  christos   /* limb==long and nails, need two limbs when available */
   1788  1.1  christos   __gmp_n = __GMP_ABS (__gmp_n);
   1789  1.1  christos   if (__gmp_n <= 1)
   1790  1.1  christos     return (__gmp_n != 0 ? __gmp_l : 0);
   1791  1.1  christos   else
   1792  1.1  christos     return __gmp_l + (__gmp_p[1] << GMP_NUMB_BITS);
   1793  1.1  christos #endif
   1794  1.1  christos }
   1795  1.1  christos #endif
   1796  1.1  christos 
   1797  1.1  christos #if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpz_getlimbn)
   1798  1.1  christos #if ! defined (__GMP_FORCE_mpz_getlimbn)
   1799  1.1  christos __GMP_EXTERN_INLINE
   1800  1.1  christos #endif
   1801  1.1  christos mp_limb_t
   1802  1.1  christos mpz_getlimbn (mpz_srcptr __gmp_z, mp_size_t __gmp_n) __GMP_NOTHROW
   1803  1.1  christos {
   1804  1.1  christos   mp_limb_t  __gmp_result = 0;
   1805  1.1  christos   if (__GMP_LIKELY (__gmp_n >= 0 && __gmp_n < __GMP_ABS (__gmp_z->_mp_size)))
   1806  1.1  christos     __gmp_result = __gmp_z->_mp_d[__gmp_n];
   1807  1.1  christos   return __gmp_result;
   1808  1.1  christos }
   1809  1.1  christos #endif
   1810  1.1  christos 
   1811  1.1  christos #if defined (__GMP_EXTERN_INLINE) && ! defined (__GMP_FORCE_mpz_neg)
   1812  1.1  christos __GMP_EXTERN_INLINE void
   1813  1.1  christos mpz_neg (mpz_ptr __gmp_w, mpz_srcptr __gmp_u)
   1814  1.1  christos {
   1815  1.1  christos   if (__gmp_w != __gmp_u)
   1816  1.1  christos     mpz_set (__gmp_w, __gmp_u);
   1817  1.1  christos   __gmp_w->_mp_size = - __gmp_w->_mp_size;
   1818  1.1  christos }
   1819  1.1  christos #endif
   1820  1.1  christos 
   1821  1.1  christos #if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpz_perfect_square_p)
   1822  1.1  christos #if ! defined (__GMP_FORCE_mpz_perfect_square_p)
   1823  1.1  christos __GMP_EXTERN_INLINE
   1824  1.1  christos #endif
   1825  1.1  christos int
   1826  1.1  christos mpz_perfect_square_p (mpz_srcptr __gmp_a)
   1827  1.1  christos {
   1828  1.1  christos   mp_size_t __gmp_asize;
   1829  1.1  christos   int       __gmp_result;
   1830  1.1  christos 
   1831  1.1  christos   __gmp_asize = __gmp_a->_mp_size;
   1832  1.1  christos   __gmp_result = (__gmp_asize >= 0);  /* zero is a square, negatives are not */
   1833  1.1  christos   if (__GMP_LIKELY (__gmp_asize > 0))
   1834  1.1  christos     __gmp_result = mpn_perfect_square_p (__gmp_a->_mp_d, __gmp_asize);
   1835  1.1  christos   return __gmp_result;
   1836  1.1  christos }
   1837  1.1  christos #endif
   1838  1.1  christos 
   1839  1.1  christos #if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpz_popcount)
   1840  1.1  christos #if ! defined (__GMP_FORCE_mpz_popcount)
   1841  1.1  christos __GMP_EXTERN_INLINE
   1842  1.1  christos #endif
   1843  1.1  christos mp_bitcnt_t
   1844  1.1  christos mpz_popcount (mpz_srcptr __gmp_u) __GMP_NOTHROW
   1845  1.1  christos {
   1846  1.1  christos   mp_size_t      __gmp_usize;
   1847  1.1  christos   mp_bitcnt_t    __gmp_result;
   1848  1.1  christos 
   1849  1.1  christos   __gmp_usize = __gmp_u->_mp_size;
   1850  1.1  christos   __gmp_result = (__gmp_usize < 0 ? ~ __GMP_CAST (mp_bitcnt_t, 0) : __GMP_CAST (mp_bitcnt_t, 0));
   1851  1.1  christos   if (__GMP_LIKELY (__gmp_usize > 0))
   1852  1.1  christos     __gmp_result =  mpn_popcount (__gmp_u->_mp_d, __gmp_usize);
   1853  1.1  christos   return __gmp_result;
   1854  1.1  christos }
   1855  1.1  christos #endif
   1856  1.1  christos 
   1857  1.1  christos #if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpz_set_q)
   1858  1.1  christos #if ! defined (__GMP_FORCE_mpz_set_q)
   1859  1.1  christos __GMP_EXTERN_INLINE
   1860  1.1  christos #endif
   1861  1.1  christos void
   1862  1.1  christos mpz_set_q (mpz_ptr __gmp_w, mpq_srcptr __gmp_u)
   1863  1.1  christos {
   1864  1.1  christos   mpz_tdiv_q (__gmp_w, mpq_numref (__gmp_u), mpq_denref (__gmp_u));
   1865  1.1  christos }
   1866  1.1  christos #endif
   1867  1.1  christos 
   1868  1.1  christos #if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpz_size)
   1869  1.1  christos #if ! defined (__GMP_FORCE_mpz_size)
   1870  1.1  christos __GMP_EXTERN_INLINE
   1871  1.1  christos #endif
   1872  1.1  christos size_t
   1873  1.1  christos mpz_size (mpz_srcptr __gmp_z) __GMP_NOTHROW
   1874  1.1  christos {
   1875  1.1  christos   return __GMP_ABS (__gmp_z->_mp_size);
   1876  1.1  christos }
   1877  1.1  christos #endif
   1878  1.1  christos 
   1879  1.1  christos 
   1880  1.1  christos /**************** mpq inlines ****************/
   1881  1.1  christos 
   1882  1.1  christos #if defined (__GMP_EXTERN_INLINE) && ! defined (__GMP_FORCE_mpq_abs)
   1883  1.1  christos __GMP_EXTERN_INLINE void
   1884  1.1  christos mpq_abs (mpq_ptr __gmp_w, mpq_srcptr __gmp_u)
   1885  1.1  christos {
   1886  1.1  christos   if (__gmp_w != __gmp_u)
   1887  1.1  christos     mpq_set (__gmp_w, __gmp_u);
   1888  1.1  christos   __gmp_w->_mp_num._mp_size = __GMP_ABS (__gmp_w->_mp_num._mp_size);
   1889  1.1  christos }
   1890  1.1  christos #endif
   1891  1.1  christos 
   1892  1.1  christos #if defined (__GMP_EXTERN_INLINE) && ! defined (__GMP_FORCE_mpq_neg)
   1893  1.1  christos __GMP_EXTERN_INLINE void
   1894  1.1  christos mpq_neg (mpq_ptr __gmp_w, mpq_srcptr __gmp_u)
   1895  1.1  christos {
   1896  1.1  christos   if (__gmp_w != __gmp_u)
   1897  1.1  christos     mpq_set (__gmp_w, __gmp_u);
   1898  1.1  christos   __gmp_w->_mp_num._mp_size = - __gmp_w->_mp_num._mp_size;
   1899  1.1  christos }
   1900  1.1  christos #endif
   1901  1.1  christos 
   1902  1.1  christos 
   1903  1.1  christos /**************** mpn inlines ****************/
   1904  1.1  christos 
   1905  1.1  christos /* The comments with __GMPN_ADD_1 below apply here too.
   1906  1.1  christos 
   1907  1.1  christos    The test for FUNCTION returning 0 should predict well.  If it's assumed
   1908  1.1  christos    {yp,ysize} will usually have a random number of bits then the high limb
   1909  1.1  christos    won't be full and a carry out will occur a good deal less than 50% of the
   1910  1.1  christos    time.
   1911  1.1  christos 
   1912  1.1  christos    ysize==0 isn't a documented feature, but is used internally in a few
   1913  1.1  christos    places.
   1914  1.1  christos 
   1915  1.1  christos    Producing cout last stops it using up a register during the main part of
   1916  1.1  christos    the calculation, though gcc (as of 3.0) on an "if (mpn_add (...))"
   1917  1.1  christos    doesn't seem able to move the true and false legs of the conditional up
   1918  1.1  christos    to the two places cout is generated.  */
   1919  1.1  christos 
   1920  1.1  christos #define __GMPN_AORS(cout, wp, xp, xsize, yp, ysize, FUNCTION, TEST)     \
   1921  1.1  christos   do {                                                                  \
   1922  1.1  christos     mp_size_t  __gmp_i;                                                 \
   1923  1.1  christos     mp_limb_t  __gmp_x;                                                 \
   1924  1.1  christos                                                                         \
   1925  1.1  christos     /* ASSERT ((ysize) >= 0); */                                        \
   1926  1.1  christos     /* ASSERT ((xsize) >= (ysize)); */                                  \
   1927  1.1  christos     /* ASSERT (MPN_SAME_OR_SEPARATE2_P (wp, xsize, xp, xsize)); */      \
   1928  1.1  christos     /* ASSERT (MPN_SAME_OR_SEPARATE2_P (wp, xsize, yp, ysize)); */      \
   1929  1.1  christos                                                                         \
   1930  1.1  christos     __gmp_i = (ysize);                                                  \
   1931  1.1  christos     if (__gmp_i != 0)                                                   \
   1932  1.1  christos       {                                                                 \
   1933  1.1  christos         if (FUNCTION (wp, xp, yp, __gmp_i))                             \
   1934  1.1  christos           {                                                             \
   1935  1.1  christos             do                                                          \
   1936  1.1  christos               {                                                         \
   1937  1.1  christos                 if (__gmp_i >= (xsize))                                 \
   1938  1.1  christos                   {                                                     \
   1939  1.1  christos                     (cout) = 1;                                         \
   1940  1.1  christos                     goto __gmp_done;                                    \
   1941  1.1  christos                   }                                                     \
   1942  1.1  christos                 __gmp_x = (xp)[__gmp_i];                                \
   1943  1.1  christos               }                                                         \
   1944  1.1  christos             while (TEST);                                               \
   1945  1.1  christos           }                                                             \
   1946  1.1  christos       }                                                                 \
   1947  1.1  christos     if ((wp) != (xp))                                                   \
   1948  1.1  christos       __GMPN_COPY_REST (wp, xp, xsize, __gmp_i);                        \
   1949  1.1  christos     (cout) = 0;                                                         \
   1950  1.1  christos   __gmp_done:                                                           \
   1951  1.1  christos     ;                                                                   \
   1952  1.1  christos   } while (0)
   1953  1.1  christos 
   1954  1.1  christos #define __GMPN_ADD(cout, wp, xp, xsize, yp, ysize)              \
   1955  1.1  christos   __GMPN_AORS (cout, wp, xp, xsize, yp, ysize, mpn_add_n,       \
   1956  1.1  christos                (((wp)[__gmp_i++] = (__gmp_x + 1) & GMP_NUMB_MASK) == 0))
   1957  1.1  christos #define __GMPN_SUB(cout, wp, xp, xsize, yp, ysize)              \
   1958  1.1  christos   __GMPN_AORS (cout, wp, xp, xsize, yp, ysize, mpn_sub_n,       \
   1959  1.1  christos                (((wp)[__gmp_i++] = (__gmp_x - 1) & GMP_NUMB_MASK), __gmp_x == 0))
   1960  1.1  christos 
   1961  1.1  christos 
   1962  1.1  christos /* The use of __gmp_i indexing is designed to ensure a compile time src==dst
   1963  1.1  christos    remains nice and clear to the compiler, so that __GMPN_COPY_REST can
   1964  1.1  christos    disappear, and the load/add/store gets a chance to become a
   1965  1.1  christos    read-modify-write on CISC CPUs.
   1966  1.1  christos 
   1967  1.1  christos    Alternatives:
   1968  1.1  christos 
   1969  1.1  christos    Using a pair of pointers instead of indexing would be possible, but gcc
   1970  1.1  christos    isn't able to recognise compile-time src==dst in that case, even when the
   1971  1.1  christos    pointers are incremented more or less together.  Other compilers would
   1972  1.1  christos    very likely have similar difficulty.
   1973  1.1  christos 
   1974  1.1  christos    gcc could use "if (__builtin_constant_p(src==dst) && src==dst)" or
   1975  1.1  christos    similar to detect a compile-time src==dst.  This works nicely on gcc
   1976  1.1  christos    2.95.x, it's not good on gcc 3.0 where __builtin_constant_p(p==p) seems
   1977  1.1  christos    to be always false, for a pointer p.  But the current code form seems
   1978  1.1  christos    good enough for src==dst anyway.
   1979  1.1  christos 
   1980  1.1  christos    gcc on x86 as usual doesn't give particularly good flags handling for the
   1981  1.1  christos    carry/borrow detection.  It's tempting to want some multi instruction asm
   1982  1.1  christos    blocks to help it, and this was tried, but in truth there's only a few
   1983  1.1  christos    instructions to save and any gain is all too easily lost by register
   1984  1.1  christos    juggling setting up for the asm.  */
   1985  1.1  christos 
   1986  1.1  christos #if GMP_NAIL_BITS == 0
   1987  1.1  christos #define __GMPN_AORS_1(cout, dst, src, n, v, OP, CB)		\
   1988  1.1  christos   do {								\
   1989  1.1  christos     mp_size_t  __gmp_i;						\
   1990  1.1  christos     mp_limb_t  __gmp_x, __gmp_r;                                \
   1991  1.1  christos 								\
   1992  1.1  christos     /* ASSERT ((n) >= 1); */					\
   1993  1.1  christos     /* ASSERT (MPN_SAME_OR_SEPARATE_P (dst, src, n)); */	\
   1994  1.1  christos 								\
   1995  1.1  christos     __gmp_x = (src)[0];						\
   1996  1.1  christos     __gmp_r = __gmp_x OP (v);                                   \
   1997  1.1  christos     (dst)[0] = __gmp_r;						\
   1998  1.1  christos     if (CB (__gmp_r, __gmp_x, (v)))                             \
   1999  1.1  christos       {								\
   2000  1.1  christos 	(cout) = 1;						\
   2001  1.1  christos 	for (__gmp_i = 1; __gmp_i < (n);)                       \
   2002  1.1  christos 	  {							\
   2003  1.1  christos 	    __gmp_x = (src)[__gmp_i];                           \
   2004  1.1  christos 	    __gmp_r = __gmp_x OP 1;                             \
   2005  1.1  christos 	    (dst)[__gmp_i] = __gmp_r;                           \
   2006  1.1  christos 	    ++__gmp_i;						\
   2007  1.1  christos 	    if (!CB (__gmp_r, __gmp_x, 1))                      \
   2008  1.1  christos 	      {							\
   2009  1.1  christos 		if ((src) != (dst))				\
   2010  1.1  christos 		  __GMPN_COPY_REST (dst, src, n, __gmp_i);      \
   2011  1.1  christos 		(cout) = 0;					\
   2012  1.1  christos 		break;						\
   2013  1.1  christos 	      }							\
   2014  1.1  christos 	  }							\
   2015  1.1  christos       }								\
   2016  1.1  christos     else							\
   2017  1.1  christos       {								\
   2018  1.1  christos 	if ((src) != (dst))					\
   2019  1.1  christos 	  __GMPN_COPY_REST (dst, src, n, 1);			\
   2020  1.1  christos 	(cout) = 0;						\
   2021  1.1  christos       }								\
   2022  1.1  christos   } while (0)
   2023  1.1  christos #endif
   2024  1.1  christos 
   2025  1.1  christos #if GMP_NAIL_BITS >= 1
   2026  1.1  christos #define __GMPN_AORS_1(cout, dst, src, n, v, OP, CB)		\
   2027  1.1  christos   do {								\
   2028  1.1  christos     mp_size_t  __gmp_i;						\
   2029  1.1  christos     mp_limb_t  __gmp_x, __gmp_r;				\
   2030  1.1  christos 								\
   2031  1.1  christos     /* ASSERT ((n) >= 1); */					\
   2032  1.1  christos     /* ASSERT (MPN_SAME_OR_SEPARATE_P (dst, src, n)); */	\
   2033  1.1  christos 								\
   2034  1.1  christos     __gmp_x = (src)[0];						\
   2035  1.1  christos     __gmp_r = __gmp_x OP (v);					\
   2036  1.1  christos     (dst)[0] = __gmp_r & GMP_NUMB_MASK;				\
   2037  1.1  christos     if (__gmp_r >> GMP_NUMB_BITS != 0)				\
   2038  1.1  christos       {								\
   2039  1.1  christos 	(cout) = 1;						\
   2040  1.1  christos 	for (__gmp_i = 1; __gmp_i < (n);)			\
   2041  1.1  christos 	  {							\
   2042  1.1  christos 	    __gmp_x = (src)[__gmp_i];				\
   2043  1.1  christos 	    __gmp_r = __gmp_x OP 1;				\
   2044  1.1  christos 	    (dst)[__gmp_i] = __gmp_r & GMP_NUMB_MASK;		\
   2045  1.1  christos 	    ++__gmp_i;						\
   2046  1.1  christos 	    if (__gmp_r >> GMP_NUMB_BITS == 0)			\
   2047  1.1  christos 	      {							\
   2048  1.1  christos 		if ((src) != (dst))				\
   2049  1.1  christos 		  __GMPN_COPY_REST (dst, src, n, __gmp_i);	\
   2050  1.1  christos 		(cout) = 0;					\
   2051  1.1  christos 		break;						\
   2052  1.1  christos 	      }							\
   2053  1.1  christos 	  }							\
   2054  1.1  christos       }								\
   2055  1.1  christos     else							\
   2056  1.1  christos       {								\
   2057  1.1  christos 	if ((src) != (dst))					\
   2058  1.1  christos 	  __GMPN_COPY_REST (dst, src, n, 1);			\
   2059  1.1  christos 	(cout) = 0;						\
   2060  1.1  christos       }								\
   2061  1.1  christos   } while (0)
   2062  1.1  christos #endif
   2063  1.1  christos 
   2064  1.1  christos #define __GMPN_ADDCB(r,x,y) ((r) < (y))
   2065  1.1  christos #define __GMPN_SUBCB(r,x,y) ((x) < (y))
   2066  1.1  christos 
   2067  1.1  christos #define __GMPN_ADD_1(cout, dst, src, n, v)	     \
   2068  1.1  christos   __GMPN_AORS_1(cout, dst, src, n, v, +, __GMPN_ADDCB)
   2069  1.1  christos #define __GMPN_SUB_1(cout, dst, src, n, v)	     \
   2070  1.1  christos   __GMPN_AORS_1(cout, dst, src, n, v, -, __GMPN_SUBCB)
   2071  1.1  christos 
   2072  1.1  christos 
   2073  1.1  christos /* Compare {xp,size} and {yp,size}, setting "result" to positive, zero or
   2074  1.1  christos    negative.  size==0 is allowed.  On random data usually only one limb will
   2075  1.1  christos    need to be examined to get a result, so it's worth having it inline.  */
   2076  1.1  christos #define __GMPN_CMP(result, xp, yp, size)                                \
   2077  1.1  christos   do {                                                                  \
   2078  1.1  christos     mp_size_t  __gmp_i;                                                 \
   2079  1.1  christos     mp_limb_t  __gmp_x, __gmp_y;                                        \
   2080  1.1  christos                                                                         \
   2081  1.1  christos     /* ASSERT ((size) >= 0); */                                         \
   2082  1.1  christos                                                                         \
   2083  1.1  christos     (result) = 0;                                                       \
   2084  1.1  christos     __gmp_i = (size);                                                   \
   2085  1.1  christos     while (--__gmp_i >= 0)                                              \
   2086  1.1  christos       {                                                                 \
   2087  1.1  christos         __gmp_x = (xp)[__gmp_i];                                        \
   2088  1.1  christos         __gmp_y = (yp)[__gmp_i];                                        \
   2089  1.1  christos         if (__gmp_x != __gmp_y)                                         \
   2090  1.1  christos           {                                                             \
   2091  1.1  christos             /* Cannot use __gmp_x - __gmp_y, may overflow an "int" */   \
   2092  1.1  christos             (result) = (__gmp_x > __gmp_y ? 1 : -1);                    \
   2093  1.1  christos             break;                                                      \
   2094  1.1  christos           }                                                             \
   2095  1.1  christos       }                                                                 \
   2096  1.1  christos   } while (0)
   2097  1.1  christos 
   2098  1.1  christos 
   2099  1.1  christos #if defined (__GMPN_COPY) && ! defined (__GMPN_COPY_REST)
   2100  1.1  christos #define __GMPN_COPY_REST(dst, src, size, start)                 \
   2101  1.1  christos   do {                                                          \
   2102  1.1  christos     /* ASSERT ((start) >= 0); */                                \
   2103  1.1  christos     /* ASSERT ((start) <= (size)); */                           \
   2104  1.1  christos     __GMPN_COPY ((dst)+(start), (src)+(start), (size)-(start)); \
   2105  1.1  christos   } while (0)
   2106  1.1  christos #endif
   2107  1.1  christos 
   2108  1.1  christos /* Copy {src,size} to {dst,size}, starting at "start".  This is designed to
   2109  1.1  christos    keep the indexing dst[j] and src[j] nice and simple for __GMPN_ADD_1,
   2110  1.1  christos    __GMPN_ADD, etc.  */
   2111  1.1  christos #if ! defined (__GMPN_COPY_REST)
   2112  1.1  christos #define __GMPN_COPY_REST(dst, src, size, start)                 \
   2113  1.1  christos   do {                                                          \
   2114  1.1  christos     mp_size_t __gmp_j;                                          \
   2115  1.1  christos     /* ASSERT ((size) >= 0); */                                 \
   2116  1.1  christos     /* ASSERT ((start) >= 0); */                                \
   2117  1.1  christos     /* ASSERT ((start) <= (size)); */                           \
   2118  1.1  christos     /* ASSERT (MPN_SAME_OR_SEPARATE_P (dst, src, size)); */     \
   2119  1.1  christos     __GMP_CRAY_Pragma ("_CRI ivdep");                           \
   2120  1.1  christos     for (__gmp_j = (start); __gmp_j < (size); __gmp_j++)        \
   2121  1.1  christos       (dst)[__gmp_j] = (src)[__gmp_j];                          \
   2122  1.1  christos   } while (0)
   2123  1.1  christos #endif
   2124  1.1  christos 
   2125  1.1  christos /* Enhancement: Use some of the smarter code from gmp-impl.h.  Maybe use
   2126  1.1  christos    mpn_copyi if there's a native version, and if we don't mind demanding
   2127  1.1  christos    binary compatibility for it (on targets which use it).  */
   2128  1.1  christos 
   2129  1.1  christos #if ! defined (__GMPN_COPY)
   2130  1.1  christos #define __GMPN_COPY(dst, src, size)   __GMPN_COPY_REST (dst, src, size, 0)
   2131  1.1  christos #endif
   2132  1.1  christos 
   2133  1.1  christos 
   2134  1.1  christos #if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpn_add)
   2135  1.1  christos #if ! defined (__GMP_FORCE_mpn_add)
   2136  1.1  christos __GMP_EXTERN_INLINE
   2137  1.1  christos #endif
   2138  1.1  christos mp_limb_t
   2139  1.1  christos mpn_add (mp_ptr __gmp_wp, mp_srcptr __gmp_xp, mp_size_t __gmp_xsize, mp_srcptr __gmp_yp, mp_size_t __gmp_ysize)
   2140  1.1  christos {
   2141  1.1  christos   mp_limb_t  __gmp_c;
   2142  1.1  christos   __GMPN_ADD (__gmp_c, __gmp_wp, __gmp_xp, __gmp_xsize, __gmp_yp, __gmp_ysize);
   2143  1.1  christos   return __gmp_c;
   2144  1.1  christos }
   2145  1.1  christos #endif
   2146  1.1  christos 
   2147  1.1  christos #if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpn_add_1)
   2148  1.1  christos #if ! defined (__GMP_FORCE_mpn_add_1)
   2149  1.1  christos __GMP_EXTERN_INLINE
   2150  1.1  christos #endif
   2151  1.1  christos mp_limb_t
   2152  1.1  christos mpn_add_1 (mp_ptr __gmp_dst, mp_srcptr __gmp_src, mp_size_t __gmp_size, mp_limb_t __gmp_n) __GMP_NOTHROW
   2153  1.1  christos {
   2154  1.1  christos   mp_limb_t  __gmp_c;
   2155  1.1  christos   __GMPN_ADD_1 (__gmp_c, __gmp_dst, __gmp_src, __gmp_size, __gmp_n);
   2156  1.1  christos   return __gmp_c;
   2157  1.1  christos }
   2158  1.1  christos #endif
   2159  1.1  christos 
   2160  1.1  christos #if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpn_cmp)
   2161  1.1  christos #if ! defined (__GMP_FORCE_mpn_cmp)
   2162  1.1  christos __GMP_EXTERN_INLINE
   2163  1.1  christos #endif
   2164  1.1  christos int
   2165  1.1  christos mpn_cmp (mp_srcptr __gmp_xp, mp_srcptr __gmp_yp, mp_size_t __gmp_size) __GMP_NOTHROW
   2166  1.1  christos {
   2167  1.1  christos   int __gmp_result;
   2168  1.1  christos   __GMPN_CMP (__gmp_result, __gmp_xp, __gmp_yp, __gmp_size);
   2169  1.1  christos   return __gmp_result;
   2170  1.1  christos }
   2171  1.1  christos #endif
   2172  1.1  christos 
   2173  1.1  christos #if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpn_zero_p)
   2174  1.1  christos #if ! defined (__GMP_FORCE_mpn_zero_p)
   2175  1.1  christos __GMP_EXTERN_INLINE
   2176  1.1  christos #endif
   2177  1.1  christos int
   2178  1.1  christos mpn_zero_p (mp_srcptr __gmp_p, mp_size_t __gmp_n) __GMP_NOTHROW
   2179  1.1  christos {
   2180  1.1  christos   /* if (__GMP_LIKELY (__gmp_n > 0)) */
   2181  1.1  christos     do {
   2182  1.1  christos       if (__gmp_p[--__gmp_n] != 0)
   2183  1.1  christos 	return 0;
   2184  1.1  christos     } while (__gmp_n != 0);
   2185  1.1  christos   return 1;
   2186  1.1  christos }
   2187  1.1  christos #endif
   2188  1.1  christos 
   2189  1.1  christos #if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpn_sub)
   2190  1.1  christos #if ! defined (__GMP_FORCE_mpn_sub)
   2191  1.1  christos __GMP_EXTERN_INLINE
   2192  1.1  christos #endif
   2193  1.1  christos mp_limb_t
   2194  1.1  christos mpn_sub (mp_ptr __gmp_wp, mp_srcptr __gmp_xp, mp_size_t __gmp_xsize, mp_srcptr __gmp_yp, mp_size_t __gmp_ysize)
   2195  1.1  christos {
   2196  1.1  christos   mp_limb_t  __gmp_c;
   2197  1.1  christos   __GMPN_SUB (__gmp_c, __gmp_wp, __gmp_xp, __gmp_xsize, __gmp_yp, __gmp_ysize);
   2198  1.1  christos   return __gmp_c;
   2199  1.1  christos }
   2200  1.1  christos #endif
   2201  1.1  christos 
   2202  1.1  christos #if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpn_sub_1)
   2203  1.1  christos #if ! defined (__GMP_FORCE_mpn_sub_1)
   2204  1.1  christos __GMP_EXTERN_INLINE
   2205  1.1  christos #endif
   2206  1.1  christos mp_limb_t
   2207  1.1  christos mpn_sub_1 (mp_ptr __gmp_dst, mp_srcptr __gmp_src, mp_size_t __gmp_size, mp_limb_t __gmp_n) __GMP_NOTHROW
   2208  1.1  christos {
   2209  1.1  christos   mp_limb_t  __gmp_c;
   2210  1.1  christos   __GMPN_SUB_1 (__gmp_c, __gmp_dst, __gmp_src, __gmp_size, __gmp_n);
   2211  1.1  christos   return __gmp_c;
   2212  1.1  christos }
   2213  1.1  christos #endif
   2214  1.1  christos 
   2215  1.1  christos #if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpn_neg)
   2216  1.1  christos #if ! defined (__GMP_FORCE_mpn_neg)
   2217  1.1  christos __GMP_EXTERN_INLINE
   2218  1.1  christos #endif
   2219  1.1  christos mp_limb_t
   2220  1.1  christos mpn_neg (mp_ptr __gmp_rp, mp_srcptr __gmp_up, mp_size_t __gmp_n)
   2221  1.1  christos {
   2222  1.1  christos   while (*__gmp_up == 0) /* Low zero limbs are unchanged by negation. */
   2223  1.1  christos     {
   2224  1.1  christos       *__gmp_rp = 0;
   2225  1.1  christos       if (!--__gmp_n) /* All zero */
   2226  1.1  christos 	return 0;
   2227  1.1  christos       ++__gmp_up; ++__gmp_rp;
   2228  1.1  christos     }
   2229  1.1  christos 
   2230  1.1  christos   *__gmp_rp = (- *__gmp_up) & GMP_NUMB_MASK;
   2231  1.1  christos 
   2232  1.1  christos   if (--__gmp_n) /* Higher limbs get complemented. */
   2233  1.1  christos     mpn_com (++__gmp_rp, ++__gmp_up, __gmp_n);
   2234  1.1  christos 
   2235  1.1  christos   return 1;
   2236  1.1  christos }
   2237  1.1  christos #endif
   2238  1.1  christos 
   2239  1.1  christos #if defined (__cplusplus)
   2240  1.1  christos }
   2241  1.1  christos #endif
   2242  1.1  christos 
   2243  1.1  christos 
   2244  1.1  christos /* Allow faster testing for negative, zero, and positive.  */
   2245  1.1  christos #define mpz_sgn(Z) ((Z)->_mp_size < 0 ? -1 : (Z)->_mp_size > 0)
   2246  1.1  christos #define mpf_sgn(F) ((F)->_mp_size < 0 ? -1 : (F)->_mp_size > 0)
   2247  1.1  christos #define mpq_sgn(Q) ((Q)->_mp_num._mp_size < 0 ? -1 : (Q)->_mp_num._mp_size > 0)
   2248  1.1  christos 
   2249  1.1  christos /* When using GCC, optimize certain common comparisons.  */
   2250  1.1  christos #if defined (__GNUC__) && __GNUC__ >= 2
   2251  1.1  christos #define mpz_cmp_ui(Z,UI) \
   2252  1.1  christos   (__builtin_constant_p (UI) && (UI) == 0				\
   2253  1.1  christos    ? mpz_sgn (Z) : _mpz_cmp_ui (Z,UI))
   2254  1.1  christos #define mpz_cmp_si(Z,SI)						\
   2255  1.1  christos   (__builtin_constant_p ((SI) >= 0) && (SI) >= 0			\
   2256  1.1  christos    ? mpz_cmp_ui (Z, __GMP_CAST (unsigned long, SI))			\
   2257  1.1  christos    : _mpz_cmp_si (Z,SI))
   2258  1.1  christos #define mpq_cmp_ui(Q,NUI,DUI)					\
   2259  1.1  christos   (__builtin_constant_p (NUI) && (NUI) == 0 ? mpq_sgn (Q)	\
   2260  1.1  christos    : __builtin_constant_p ((NUI) == (DUI)) && (NUI) == (DUI)	\
   2261  1.1  christos    ? mpz_cmp (mpq_numref (Q), mpq_denref (Q))			\
   2262  1.1  christos    : _mpq_cmp_ui (Q,NUI,DUI))
   2263  1.1  christos #define mpq_cmp_si(q,n,d)				\
   2264  1.1  christos   (__builtin_constant_p ((n) >= 0) && (n) >= 0		\
   2265  1.1  christos    ? mpq_cmp_ui (q, __GMP_CAST (unsigned long, n), d)	\
   2266  1.1  christos    : _mpq_cmp_si (q, n, d))
   2267  1.1  christos #else
   2268  1.1  christos #define mpz_cmp_ui(Z,UI) _mpz_cmp_ui (Z,UI)
   2269  1.1  christos #define mpz_cmp_si(Z,UI) _mpz_cmp_si (Z,UI)
   2270  1.1  christos #define mpq_cmp_ui(Q,NUI,DUI) _mpq_cmp_ui (Q,NUI,DUI)
   2271  1.1  christos #define mpq_cmp_si(q,n,d)  _mpq_cmp_si(q,n,d)
   2272  1.1  christos #endif
   2273  1.1  christos 
   2274  1.1  christos 
   2275  1.1  christos /* Using "&" rather than "&&" means these can come out branch-free.  Every
   2276  1.1  christos    mpz_t has at least one limb allocated, so fetching the low limb is always
   2277  1.1  christos    allowed.  */
   2278  1.1  christos #define mpz_odd_p(z)   (((z)->_mp_size != 0) & __GMP_CAST (int, (z)->_mp_d[0]))
   2279  1.1  christos #define mpz_even_p(z)  (! mpz_odd_p (z))
   2280  1.1  christos 
   2281  1.1  christos 
   2282  1.1  christos /**************** C++ routines ****************/
   2283  1.1  christos 
   2284  1.1  christos #ifdef __cplusplus
   2285  1.1  christos __GMP_DECLSPEC_XX std::ostream& operator<< (std::ostream &, mpz_srcptr);
   2286  1.1  christos __GMP_DECLSPEC_XX std::ostream& operator<< (std::ostream &, mpq_srcptr);
   2287  1.1  christos __GMP_DECLSPEC_XX std::ostream& operator<< (std::ostream &, mpf_srcptr);
   2288  1.1  christos __GMP_DECLSPEC_XX std::istream& operator>> (std::istream &, mpz_ptr);
   2289  1.1  christos __GMP_DECLSPEC_XX std::istream& operator>> (std::istream &, mpq_ptr);
   2290  1.1  christos __GMP_DECLSPEC_XX std::istream& operator>> (std::istream &, mpf_ptr);
   2291  1.1  christos #endif
   2292  1.1  christos 
   2293  1.1  christos 
   2294  1.1  christos /* Source-level compatibility with GMP 2 and earlier. */
   2295  1.1  christos #define mpn_divmod(qp,np,nsize,dp,dsize) \
   2296  1.1  christos   mpn_divrem (qp, __GMP_CAST (mp_size_t, 0), np, nsize, dp, dsize)
   2297  1.1  christos 
   2298  1.1  christos /* Source-level compatibility with GMP 1.  */
   2299  1.1  christos #define mpz_mdiv	mpz_fdiv_q
   2300  1.1  christos #define mpz_mdivmod	mpz_fdiv_qr
   2301  1.1  christos #define mpz_mmod	mpz_fdiv_r
   2302  1.1  christos #define mpz_mdiv_ui	mpz_fdiv_q_ui
   2303  1.1  christos #define mpz_mdivmod_ui(q,r,n,d) \
   2304  1.1  christos   (((r) == 0) ? mpz_fdiv_q_ui (q,n,d) : mpz_fdiv_qr_ui (q,r,n,d))
   2305  1.1  christos #define mpz_mmod_ui(r,n,d) \
   2306  1.1  christos   (((r) == 0) ? mpz_fdiv_ui (n,d) : mpz_fdiv_r_ui (r,n,d))
   2307  1.1  christos 
   2308  1.1  christos /* Useful synonyms, but not quite compatible with GMP 1.  */
   2309  1.1  christos #define mpz_div		mpz_fdiv_q
   2310  1.1  christos #define mpz_divmod	mpz_fdiv_qr
   2311  1.1  christos #define mpz_div_ui	mpz_fdiv_q_ui
   2312  1.1  christos #define mpz_divmod_ui	mpz_fdiv_qr_ui
   2313  1.1  christos #define mpz_div_2exp	mpz_fdiv_q_2exp
   2314  1.1  christos #define mpz_mod_2exp	mpz_fdiv_r_2exp
   2315  1.1  christos 
   2316  1.1  christos enum
   2317  1.1  christos {
   2318  1.1  christos   GMP_ERROR_NONE = 0,
   2319  1.1  christos   GMP_ERROR_UNSUPPORTED_ARGUMENT = 1,
   2320  1.1  christos   GMP_ERROR_DIVISION_BY_ZERO = 2,
   2321  1.1  christos   GMP_ERROR_SQRT_OF_NEGATIVE = 4,
   2322  1.1  christos   GMP_ERROR_INVALID_ARGUMENT = 8
   2323  1.1  christos };
   2324  1.1  christos 
   2325  1.1  christos /* Define CC and CFLAGS which were used to build this version of GMP */
   2326  1.1  christos #define __GMP_CC "gcc"
   2327  1.1  christos #define __GMP_CFLAGS "-O2 -pedantic -mabi=n32"
   2328  1.1  christos 
   2329  1.1  christos /* Major version number is the value of __GNU_MP__ too, above. */
   2330  1.1  christos #define __GNU_MP_VERSION            6
   2331  1.1  christos #define __GNU_MP_VERSION_MINOR      2
   2332  1.1  christos #define __GNU_MP_VERSION_PATCHLEVEL 0
   2333  1.1  christos #define __GNU_MP_RELEASE (__GNU_MP_VERSION * 10000 + __GNU_MP_VERSION_MINOR * 100 + __GNU_MP_VERSION_PATCHLEVEL)
   2334  1.1  christos 
   2335  1.1  christos #define __GMP_H__
   2336  1.1  christos #endif /* __GMP_H__ */
   2337