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