BWAPI
SPAR/AIModule/BWTA/vendors/CGAL/auxiliary/gmp/include/gmp.h
Go to the documentation of this file.
00001 /* Definitions for GNU multiple precision functions.   -*- mode: c -*-
00002 
00003 Copyright 1991, 1993, 1994, 1995, 1996, 1997, 1999, 2000, 2001, 2002, 2003,
00004 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
00005 
00006 This file is part of the GNU MP Library.
00007 
00008 The GNU MP Library is free software; you can redistribute it and/or modify
00009 it under the terms of the GNU Lesser General Public License as published by
00010 the Free Software Foundation; either version 3 of the License, or (at your
00011 option) any later version.
00012 
00013 The GNU MP Library is distributed in the hope that it will be useful, but
00014 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
00015 or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
00016 License for more details.
00017 
00018 You should have received a copy of the GNU Lesser General Public License
00019 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
00020 
00021 #ifndef __GMP_H__
00022 
00023 #if defined (__cplusplus)
00024 #include <iosfwd>   /* for std::istream, std::ostream, std::string */
00025 #include <cstdio>
00026 #endif
00027 
00028 
00029 #if ! defined (__GMP_WITHIN_CONFIGURE)
00030 #  if defined( _MSC_VER )
00031 #    if defined( _MT )
00032 // added by CGAL developers
00033 #      define __GMP_LIBGMP_DLL 1
00034 #    endif
00035 #    if defined( _WIN64 )
00036 #        define SIZEOF_MP_LIMB_T           8
00037 #        define _LONG_LONG_LIMB            1
00038 #    elif defined( _WIN32 )
00039 #        define SIZEOF_MP_LIMB_T           4
00040 #        ifdef _LONG_LONG_LIMB
00041 #          undef _LONG_LONG_LIMB
00042 #        endif
00043 #    else
00044 #        error This is the wrong version of gmp.h
00045 #    endif
00046 #  endif
00047 #  define GMP_LIMB_BITS            (SIZEOF_MP_LIMB_T << 3)
00048 #  define __GMP_BITS_PER_MP_LIMB   (SIZEOF_MP_LIMB_T << 3)
00049 #  define GMP_NAIL_BITS            0
00050 #endif
00051 #define GMP_NUMB_BITS     (GMP_LIMB_BITS - GMP_NAIL_BITS)
00052 #define GMP_NUMB_MASK     ((~ __GMP_CAST (mp_limb_t, 0)) >> GMP_NAIL_BITS)
00053 #define GMP_NUMB_MAX      GMP_NUMB_MASK
00054 #define GMP_NAIL_MASK     (~ GMP_NUMB_MASK)
00055 
00056 
00057 /* The following (everything under ifndef __GNU_MP__) must be identical in
00058    gmp.h and mp.h to allow both to be included in an application or during
00059    the library build.  */
00060 #ifndef __GNU_MP__
00061 #define __GNU_MP__ 4
00062 
00063 #define __need_size_t  /* tell gcc stddef.h we only want size_t */
00064 #if defined (__cplusplus)
00065 #include <cstddef>     /* for size_t */
00066 #else
00067 #include <stddef.h>    /* for size_t */
00068 #endif
00069 #undef __need_size_t
00070 
00071 
00072 
00073 /* __STDC__ - some ANSI compilers define this only to 0, hence the use of
00074        "defined" and not "__STDC__-0".  In particular Sun workshop C 5.0
00075        sets __STDC__ to 0, but requires "##" for token pasting.
00076 
00077    _AIX - gnu ansidecl.h asserts that all known AIX compilers are ANSI but
00078        don't always define __STDC__.
00079 
00080    __DECC - current versions of DEC C (5.9 for instance) for alpha are ANSI,
00081        but don't define __STDC__ in their default mode.  Don't know if old
00082        versions might have been K&R, but let's not worry about that unless
00083        someone is still using one.
00084 
00085    _mips - gnu ansidecl.h says the RISC/OS MIPS compiler is ANSI in SVR4
00086        mode, but doesn't define __STDC__.
00087 
00088    _MSC_VER - Microsoft C is ANSI, but __STDC__ is undefined unless the /Za
00089        option is given (in which case it's 1).
00090 
00091    _WIN32 - tested for by gnu ansidecl.h, no doubt on the assumption that
00092       all w32 compilers are ansi.
00093 
00094    Note: This same set of tests is used by gen-psqr.c and
00095    demos/expr/expr-impl.h, so if anything needs adding, then be sure to
00096    update those too.  */
00097 
00098 #if  defined (__STDC__)                                 \
00099   || defined (__cplusplus)                              \
00100   || defined (_AIX)                                     \
00101   || defined (__DECC)                                   \
00102   || (defined (__mips) && defined (_SYSTYPE_SVR4))      \
00103   || defined (_MSC_VER)                                 \
00104   || defined (_WIN32)
00105 #define __GMP_HAVE_CONST        1
00106 #define __GMP_HAVE_PROTOTYPES   1
00107 #define __GMP_HAVE_TOKEN_PASTE  1
00108 #else
00109 #define __GMP_HAVE_CONST        0
00110 #define __GMP_HAVE_PROTOTYPES   0
00111 #define __GMP_HAVE_TOKEN_PASTE  0
00112 #endif
00113 
00114 
00115 #if __GMP_HAVE_CONST
00116 #define __gmp_const   const
00117 #define __gmp_signed  signed
00118 #else
00119 #define __gmp_const
00120 #define __gmp_signed
00121 #endif
00122 
00123 
00124 /* __GMP_DECLSPEC supports Windows DLL versions of libgmp, and is empty in
00125    all other circumstances.
00126 
00127    When compiling objects for libgmp, __GMP_DECLSPEC is an export directive,
00128    or when compiling for an application it's an import directive.  The two
00129    cases are differentiated by __GMP_WITHIN_GMP defined by the GMP Makefiles
00130    (and not defined from an application).
00131 
00132    __GMP_DECLSPEC_XX is similarly used for libgmpxx.  __GMP_WITHIN_GMPXX
00133    indicates when building libgmpxx, and in that case libgmpxx functions are
00134    exports, but libgmp functions which might get called are imports.
00135 
00136    libmp.la uses __GMP_DECLSPEC, just as if it were libgmp.la.  libgmp and
00137    libmp don't call each other, so there's no conflict or confusion.
00138 
00139    Libtool DLL_EXPORT define is not used.
00140 
00141    There's no attempt to support GMP built both static and DLL.  Doing so
00142    would mean applications would have to tell us which of the two is going
00143    to be used when linking, and that seems very tedious and error prone if
00144    using GMP by hand, and equally tedious from a package since autoconf and
00145    automake don't give much help.
00146 
00147    __GMP_DECLSPEC is required on all documented global functions and
00148    variables, the various internals in gmp-impl.h etc can be left unadorned.
00149    But internals used by the test programs or speed measuring programs
00150    should have __GMP_DECLSPEC, and certainly constants or variables must
00151    have it or the wrong address will be resolved.
00152 
00153    In gcc __declspec can go at either the start or end of a prototype.
00154 
00155    In Microsoft C __declspec must go at the start, or after the type like
00156    void __declspec(...) *foo()".  There's no __dllexport or anything to
00157    guard against someone foolish #defining dllexport.  _export used to be
00158    available, but no longer.
00159 
00160    In Borland C _export still exists, but needs to go after the type, like
00161    "void _export foo();".  Would have to change the __GMP_DECLSPEC syntax to
00162    make use of that.  Probably more trouble than it's worth.  */
00163 
00164 #if defined (__GNUC__)
00165 #define __GMP_DECLSPEC_EXPORT  __declspec(__dllexport__)
00166 #define __GMP_DECLSPEC_IMPORT  __declspec(__dllimport__)
00167 #endif
00168 #if defined (_MSC_VER) || defined (__BORLANDC__)
00169 #define __GMP_DECLSPEC_EXPORT  __declspec(dllexport)
00170 #define __GMP_DECLSPEC_IMPORT  __declspec(dllimport)
00171 #endif
00172 #ifdef __WATCOMC__
00173 #define __GMP_DECLSPEC_EXPORT  __export
00174 #define __GMP_DECLSPEC_IMPORT  __import
00175 #endif
00176 #ifdef __IBMC__
00177 #define __GMP_DECLSPEC_EXPORT  _Export
00178 #define __GMP_DECLSPEC_IMPORT  _Import
00179 #endif
00180 
00181 #if __GMP_LIBGMP_DLL
00182 #if __GMP_WITHIN_GMP
00183 /* compiling to go into a DLL libgmp */
00184 #define __GMP_DECLSPEC  __GMP_DECLSPEC_EXPORT
00185 #else
00186 /* compiling to go into an application which will link to a DLL libgmp */
00187 #define __GMP_DECLSPEC  __GMP_DECLSPEC_IMPORT
00188 #endif
00189 #else
00190 /* all other cases */
00191 #define __GMP_DECLSPEC
00192 #endif
00193 
00194 
00195 #ifdef __GMP_SHORT_LIMB
00196 typedef unsigned int            mp_limb_t;
00197 typedef int                     mp_limb_signed_t;
00198 #else
00199 #ifdef _LONG_LONG_LIMB
00200 typedef unsigned long long int  mp_limb_t;
00201 typedef long long int           mp_limb_signed_t;
00202 #else
00203 typedef unsigned long int       mp_limb_t;
00204 typedef long int                mp_limb_signed_t;
00205 #endif
00206 #endif
00207 
00208 /* For reference, note that the name __mpz_struct gets into C++ mangled
00209    function names, which means although the "__" suggests an internal, we
00210    must leave this name for binary compatibility.  */
00211 typedef struct
00212 {
00213   int _mp_alloc;                /* Number of *limbs* allocated and pointed
00214                                    to by the _mp_d field.  */
00215   int _mp_size;                 /* abs(_mp_size) is the number of limbs the
00216                                    last field points to.  If _mp_size is
00217                                    negative this is a negative number.  */
00218   mp_limb_t *_mp_d;             /* Pointer to the limbs.  */
00219 } __mpz_struct;
00220 
00221 #endif /* __GNU_MP__ */
00222 
00223 
00224 typedef __mpz_struct MP_INT;    /* gmp 1 source compatibility */
00225 typedef __mpz_struct mpz_t[1];
00226 
00227 typedef mp_limb_t *             mp_ptr;
00228 typedef __gmp_const mp_limb_t * mp_srcptr;
00229 #if defined (_CRAY) && ! defined (_CRAYMPP)
00230 /* plain `int' is much faster (48 bits) */
00231 #define __GMP_MP_SIZE_T_INT     1
00232 typedef int                     mp_size_t;
00233 typedef int                     mp_exp_t;
00234 #else
00235 #define __GMP_MP_SIZE_T_INT     0
00236 typedef long int                mp_size_t;
00237 typedef long int                mp_exp_t;
00238 #endif
00239 
00240 typedef struct
00241 {
00242   __mpz_struct _mp_num;
00243   __mpz_struct _mp_den;
00244 } __mpq_struct;
00245 
00246 typedef __mpq_struct MP_RAT;    /* gmp 1 source compatibility */
00247 typedef __mpq_struct mpq_t[1];
00248 
00249 typedef struct
00250 {
00251   int _mp_prec;                 /* Max precision, in number of `mp_limb_t's.
00252                                    Set by mpf_init and modified by
00253                                    mpf_set_prec.  The area pointed to by the
00254                                    _mp_d field contains `prec' + 1 limbs.  */
00255   int _mp_size;                 /* abs(_mp_size) is the number of limbs the
00256                                    last field points to.  If _mp_size is
00257                                    negative this is a negative number.  */
00258   mp_exp_t _mp_exp;             /* Exponent, in the base of `mp_limb_t'.  */
00259   mp_limb_t *_mp_d;             /* Pointer to the limbs.  */
00260 } __mpf_struct;
00261 
00262 /* typedef __mpf_struct MP_FLOAT; */
00263 typedef __mpf_struct mpf_t[1];
00264 
00265 /* Available random number generation algorithms.  */
00266 typedef enum
00267 {
00268   GMP_RAND_ALG_DEFAULT = 0,
00269   GMP_RAND_ALG_LC = GMP_RAND_ALG_DEFAULT /* Linear congruential.  */
00270 } gmp_randalg_t;
00271 
00272 /* Random state struct.  */
00273 typedef struct
00274 {
00275   mpz_t _mp_seed;         /* _mp_d member points to state of the generator. */
00276   gmp_randalg_t _mp_alg;  /* Currently unused. */
00277   union {
00278     void *_mp_lc;         /* Pointer to function pointers structure.  */
00279   } _mp_algdata;
00280 } __gmp_randstate_struct;
00281 typedef __gmp_randstate_struct gmp_randstate_t[1];
00282 
00283 /* Types for function declarations in gmp files.  */
00284 /* ??? Should not pollute user name space with these ??? */
00285 typedef __gmp_const __mpz_struct *mpz_srcptr;
00286 typedef __mpz_struct *mpz_ptr;
00287 typedef __gmp_const __mpf_struct *mpf_srcptr;
00288 typedef __mpf_struct *mpf_ptr;
00289 typedef __gmp_const __mpq_struct *mpq_srcptr;
00290 typedef __mpq_struct *mpq_ptr;
00291 
00292 
00293 /* This is not wanted in mp.h, so put it outside the __GNU_MP__ common
00294    section. */
00295 #if __GMP_LIBGMP_DLL
00296 #if __GMP_WITHIN_GMPXX
00297 /* compiling to go into a DLL libgmpxx */
00298 #define __GMP_DECLSPEC_XX  __GMP_DECLSPEC_EXPORT
00299 #else
00300 /* compiling to go into a application which will link to a DLL libgmpxx */
00301 #define __GMP_DECLSPEC_XX  __GMP_DECLSPEC_IMPORT
00302 #endif
00303 #else
00304 /* all other cases */
00305 #define __GMP_DECLSPEC_XX
00306 #endif
00307 
00308 
00309 #if __GMP_HAVE_PROTOTYPES
00310 #define __GMP_PROTO(x) x
00311 #else
00312 #define __GMP_PROTO(x) ()
00313 #endif
00314 
00315 #ifndef __MPN
00316 #if __GMP_HAVE_TOKEN_PASTE
00317 #define __MPN(x) __gmpn_##x
00318 #else
00319 #define __MPN(x) __gmpn_x
00320 #endif
00321 #endif
00322 
00323 /* For reference, "defined(EOF)" cannot be used here.  In g++ 2.95.4,
00324    <iostream> defines EOF but not FILE.  */
00325 #if defined (FILE)                                              \
00326   || defined (H_STDIO)                                          \
00327   || defined (_H_STDIO)               /* AIX */                 \
00328   || defined (_STDIO_H)               /* glibc, Sun, SCO */     \
00329   || defined (_STDIO_H_)              /* BSD, OSF */            \
00330   || defined (__STDIO_H)              /* Borland */             \
00331   || defined (__STDIO_H__)            /* IRIX */                \
00332   || defined (_STDIO_INCLUDED)        /* HPUX */                \
00333   || defined (__dj_include_stdio_h_)  /* DJGPP */               \
00334   || defined (_FILE_DEFINED)          /* Microsoft */           \
00335   || defined (__STDIO__)              /* Apple MPW MrC */       \
00336   || defined (_MSL_STDIO_H)           /* Metrowerks */          \
00337   || defined (_STDIO_H_INCLUDED)      /* QNX4 */                \
00338   || defined (_ISO_STDIO_ISO_H)       /* Sun C++ */
00339 #define _GMP_H_HAVE_FILE 1
00340 #endif
00341 
00342 /* In ISO C, if a prototype involving "struct obstack *" is given without
00343    that structure defined, then the struct is scoped down to just the
00344    prototype, causing a conflict if it's subsequently defined for real.  So
00345    only give prototypes if we've got obstack.h.  */
00346 #if defined (_OBSTACK_H)   /* glibc <obstack.h> */
00347 #define _GMP_H_HAVE_OBSTACK 1
00348 #endif
00349 
00350 /* The prototypes for gmp_vprintf etc are provided only if va_list is
00351    available, via an application having included <stdarg.h> or <varargs.h>.
00352    Usually va_list is a typedef so can't be tested directly, but C99
00353    specifies that va_start is a macro (and it was normally a macro on past
00354    systems too), so look for that.
00355 
00356    <stdio.h> will define some sort of va_list for vprintf and vfprintf, but
00357    let's not bother trying to use that since it's not standard and since
00358    application uses for gmp_vprintf etc will almost certainly require the
00359    whole <stdarg.h> or <varargs.h> anyway.  */
00360 
00361 #ifdef va_start
00362 #define _GMP_H_HAVE_VA_LIST 1
00363 #endif
00364 
00365 /* Test for gcc >= maj.min, as per __GNUC_PREREQ in glibc */
00366 #if defined (__GNUC__) && defined (__GNUC_MINOR__)
00367 #define __GMP_GNUC_PREREQ(maj, min) \
00368   ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
00369 #else
00370 #define __GMP_GNUC_PREREQ(maj, min)  0
00371 #endif
00372 
00373 /* "pure" is in gcc 2.96 and up, see "(gcc)Function Attributes".  Basically
00374    it means a function does nothing but examine its arguments and memory
00375    (global or via arguments) to generate a return value, but changes nothing
00376    and has no side-effects.  __GMP_NO_ATTRIBUTE_CONST_PURE lets
00377    tune/common.c etc turn this off when trying to write timing loops.  */
00378 #if __GMP_GNUC_PREREQ (2,96) && ! defined (__GMP_NO_ATTRIBUTE_CONST_PURE)
00379 #define __GMP_ATTRIBUTE_PURE   __attribute__ ((__pure__))
00380 #else
00381 #define __GMP_ATTRIBUTE_PURE
00382 #endif
00383 
00384 
00385 /* __GMP_CAST allows us to use static_cast in C++, so our macros are clean
00386    to "g++ -Wold-style-cast".
00387 
00388    Casts in "extern inline" code within an extern "C" block don't induce
00389    these warnings, so __GMP_CAST only needs to be used on documented
00390    macros.  */
00391 
00392 #ifdef __cplusplus
00393 #define __GMP_CAST(type, expr)  (static_cast<type> (expr))
00394 #else
00395 #define __GMP_CAST(type, expr)  ((type) (expr))
00396 #endif
00397 
00398 
00399 /* An empty "throw ()" means the function doesn't throw any C++ exceptions,
00400    this can save some stack frame info in applications.
00401 
00402    Currently it's given only on functions which never divide-by-zero etc,
00403    don't allocate memory, and are expected to never need to allocate memory.
00404    This leaves open the possibility of a C++ throw from a future GMP
00405    exceptions scheme.
00406 
00407    mpz_set_ui etc are omitted to leave open the lazy allocation scheme
00408    described in doc/tasks.html.  mpz_get_d etc are omitted to leave open
00409    exceptions for float overflows.
00410 
00411    Note that __GMP_NOTHROW must be given on any inlines the same as on their
00412    prototypes (for g++ at least, where they're used together).  Note also
00413    that g++ 3.0 demands that __GMP_NOTHROW is before other attributes like
00414    __GMP_ATTRIBUTE_PURE.  */
00415 
00416 #if defined (__cplusplus)
00417 #define __GMP_NOTHROW  throw ()
00418 #else
00419 #define __GMP_NOTHROW
00420 #endif
00421 
00422 
00423 /* PORTME: What other compilers have a useful "extern inline"?  "static
00424    inline" would be an acceptable substitute if the compiler (or linker)
00425    discards unused statics.  */
00426 
00427  /* gcc has __inline__ in all modes, including strict ansi.  Give a prototype
00428     for an inline too, so as to correctly specify "dllimport" on windows, in
00429     case the function is called rather than inlined.
00430     GCC 4.3 and above with -std=c99 or -std=gnu99 implements ISO C99
00431     inline semantics, unless -fgnu89-inline is used.  */
00432 #ifdef __GNUC__
00433 #if (defined __GNUC_STDC_INLINE__) || (__GNUC__ == 4 && __GNUC_MINOR__ == 2)
00434 #define __GMP_EXTERN_INLINE extern __inline__ __attribute__ ((__gnu_inline__))
00435 #else
00436 #define __GMP_EXTERN_INLINE      extern __inline__
00437 #endif
00438 #define __GMP_INLINE_PROTOTYPES  1
00439 #endif
00440 
00441 /* DEC C (eg. version 5.9) supports "static __inline foo()", even in -std1
00442    strict ANSI mode.  Inlining is done even when not optimizing (ie. -O0
00443    mode, which is the default), but an unnecessary local copy of foo is
00444    emitted unless -O is used.  "extern __inline" is accepted, but the
00445    "extern" appears to be ignored, ie. it becomes a plain global function
00446    but which is inlined within its file.  Don't know if all old versions of
00447    DEC C supported __inline, but as a start let's do the right thing for
00448    current versions.  */
00449 #ifdef __DECC
00450 #define __GMP_EXTERN_INLINE  static __inline
00451 #endif
00452 
00453 /* SCO OpenUNIX 8 cc supports "static inline foo()" but not in -Xc strict
00454    ANSI mode (__STDC__ is 1 in that mode).  Inlining only actually takes
00455    place under -O.  Without -O "foo" seems to be emitted whether it's used
00456    or not, which is wasteful.  "extern inline foo()" isn't useful, the
00457    "extern" is apparently ignored, so foo is inlined if possible but also
00458    emitted as a global, which causes multiple definition errors when
00459    building a shared libgmp.  */
00460 #ifdef __SCO_VERSION__
00461 #if __SCO_VERSION__ > 400000000 && __STDC__ != 1 \
00462   && ! defined (__GMP_EXTERN_INLINE)
00463 #define __GMP_EXTERN_INLINE  static inline
00464 #endif
00465 #endif
00466 
00467 /* C++ always has "inline" and since it's a normal feature the linker should
00468    discard duplicate non-inlined copies, or if it doesn't then that's a
00469    problem for everyone, not just GMP.  */
00470 #if defined (__cplusplus) && ! defined (__GMP_EXTERN_INLINE)
00471 #define __GMP_EXTERN_INLINE  inline
00472 #endif
00473 
00474 /* Don't do any inlining within a configure run, since if the compiler ends
00475    up emitting copies of the code into the object file it can end up
00476    demanding the various support routines (like mpn_popcount) for linking,
00477    making the "alloca" test and perhaps others fail.  And on hppa ia64 a
00478    pre-release gcc 3.2 was seen not respecting the "extern" in "extern
00479    __inline__", triggering this problem too.  */
00480 #if defined (__GMP_WITHIN_CONFIGURE) && ! __GMP_WITHIN_CONFIGURE_INLINE
00481 #undef __GMP_EXTERN_INLINE
00482 #endif
00483 
00484 /* By default, don't give a prototype when there's going to be an inline
00485    version.  Note in particular that Cray C++ objects to the combination of
00486    prototype and inline.  */
00487 #ifdef __GMP_EXTERN_INLINE
00488 #ifndef __GMP_INLINE_PROTOTYPES
00489 #define __GMP_INLINE_PROTOTYPES  0
00490 #endif
00491 #else
00492 #define __GMP_INLINE_PROTOTYPES  1
00493 #endif
00494 
00495 
00496 #define __GMP_ABS(x)   ((x) >= 0 ? (x) : -(x))
00497 #define __GMP_MAX(h,i) ((h) > (i) ? (h) : (i))
00498 
00499 /* __GMP_USHRT_MAX is not "~ (unsigned short) 0" because short is promoted
00500    to int by "~".  */
00501 #define __GMP_UINT_MAX   (~ (unsigned) 0)
00502 #define __GMP_ULONG_MAX  (~ (unsigned long) 0)
00503 #define __GMP_USHRT_MAX  ((unsigned short) ~0)
00504 
00505 
00506 /* __builtin_expect is in gcc 3.0, and not in 2.95. */
00507 #if __GMP_GNUC_PREREQ (3,0)
00508 #define __GMP_LIKELY(cond)    __builtin_expect ((cond) != 0, 1)
00509 #define __GMP_UNLIKELY(cond)  __builtin_expect ((cond) != 0, 0)
00510 #else
00511 #define __GMP_LIKELY(cond)    (cond)
00512 #define __GMP_UNLIKELY(cond)  (cond)
00513 #endif
00514 
00515 #ifdef _CRAY
00516 #define __GMP_CRAY_Pragma(str)  _Pragma (str)
00517 #else
00518 #define __GMP_CRAY_Pragma(str)
00519 #endif
00520 
00521 
00522 /* Allow direct user access to numerator and denominator of a mpq_t object.  */
00523 #define mpq_numref(Q) (&((Q)->_mp_num))
00524 #define mpq_denref(Q) (&((Q)->_mp_den))
00525 
00526 
00527 #if defined (__cplusplus)
00528 extern "C" {
00529 using std::FILE;
00530 #endif
00531 
00532 #define mp_set_memory_functions __gmp_set_memory_functions
00533 __GMP_DECLSPEC void mp_set_memory_functions __GMP_PROTO ((void *(*) (size_t),
00534                                       void *(*) (void *, size_t, size_t),
00535                                       void (*) (void *, size_t))) __GMP_NOTHROW;
00536 
00537 #define mp_get_memory_functions __gmp_get_memory_functions
00538 __GMP_DECLSPEC void mp_get_memory_functions __GMP_PROTO ((void *(**) (size_t),
00539                                       void *(**) (void *, size_t, size_t),
00540                                       void (**) (void *, size_t))) __GMP_NOTHROW;
00541 
00542 #define mp_bits_per_limb __gmp_bits_per_limb
00543 __GMP_DECLSPEC extern __gmp_const int mp_bits_per_limb;
00544 
00545 #define gmp_errno __gmp_errno
00546 __GMP_DECLSPEC extern int gmp_errno;
00547 
00548 #define gmp_version __gmp_version
00549 __GMP_DECLSPEC extern __gmp_const char * __gmp_const gmp_version;
00550 
00551 
00552 /**************** Random number routines.  ****************/
00553 
00554 /* obsolete */
00555 #define gmp_randinit __gmp_randinit
00556 __GMP_DECLSPEC void gmp_randinit __GMP_PROTO ((gmp_randstate_t, gmp_randalg_t, ...));
00557 
00558 #define gmp_randinit_default __gmp_randinit_default
00559 __GMP_DECLSPEC void gmp_randinit_default __GMP_PROTO ((gmp_randstate_t));
00560 
00561 #define gmp_randinit_lc_2exp __gmp_randinit_lc_2exp
00562 __GMP_DECLSPEC void gmp_randinit_lc_2exp __GMP_PROTO ((gmp_randstate_t,
00563                                    mpz_srcptr, unsigned long int,
00564                                    unsigned long int));
00565 
00566 #define gmp_randinit_lc_2exp_size __gmp_randinit_lc_2exp_size
00567 __GMP_DECLSPEC int gmp_randinit_lc_2exp_size __GMP_PROTO ((gmp_randstate_t, unsigned long));
00568 
00569 #define gmp_randinit_mt __gmp_randinit_mt
00570 __GMP_DECLSPEC void gmp_randinit_mt __GMP_PROTO ((gmp_randstate_t));
00571 
00572 #define gmp_randinit_set __gmp_randinit_set
00573 void gmp_randinit_set __GMP_PROTO ((gmp_randstate_t, __gmp_const __gmp_randstate_struct *));
00574 
00575 #define gmp_randseed __gmp_randseed
00576 __GMP_DECLSPEC void gmp_randseed __GMP_PROTO ((gmp_randstate_t, mpz_srcptr));
00577 
00578 #define gmp_randseed_ui __gmp_randseed_ui
00579 __GMP_DECLSPEC void gmp_randseed_ui __GMP_PROTO ((gmp_randstate_t, unsigned long int));
00580 
00581 #define gmp_randclear __gmp_randclear
00582 __GMP_DECLSPEC void gmp_randclear __GMP_PROTO ((gmp_randstate_t));
00583 
00584 #define gmp_urandomb_ui __gmp_urandomb_ui
00585 unsigned long gmp_urandomb_ui __GMP_PROTO ((gmp_randstate_t, unsigned long));
00586 
00587 #define gmp_urandomm_ui __gmp_urandomm_ui
00588 unsigned long gmp_urandomm_ui __GMP_PROTO ((gmp_randstate_t, unsigned long));
00589 
00590 
00591 /**************** Formatted output routines.  ****************/
00592 
00593 #define gmp_asprintf __gmp_asprintf
00594 __GMP_DECLSPEC int gmp_asprintf __GMP_PROTO ((char **, __gmp_const char *, ...));
00595 
00596 #define gmp_fprintf __gmp_fprintf
00597 #ifdef _GMP_H_HAVE_FILE
00598 __GMP_DECLSPEC int gmp_fprintf __GMP_PROTO ((FILE *, __gmp_const char *, ...));
00599 #endif
00600 
00601 #define gmp_obstack_printf __gmp_obstack_printf
00602 #if defined (_GMP_H_HAVE_OBSTACK)
00603 __GMP_DECLSPEC int gmp_obstack_printf __GMP_PROTO ((struct obstack *, __gmp_const char *, ...));
00604 #endif
00605 
00606 #define gmp_obstack_vprintf __gmp_obstack_vprintf
00607 #if defined (_GMP_H_HAVE_OBSTACK) && defined (_GMP_H_HAVE_VA_LIST)
00608 __GMP_DECLSPEC int gmp_obstack_vprintf __GMP_PROTO ((struct obstack *, __gmp_const char *, va_list));
00609 #endif
00610 
00611 #define gmp_printf __gmp_printf
00612 __GMP_DECLSPEC int gmp_printf __GMP_PROTO ((__gmp_const char *, ...));
00613 
00614 #define gmp_snprintf __gmp_snprintf
00615 __GMP_DECLSPEC int gmp_snprintf __GMP_PROTO ((char *, size_t, __gmp_const char *, ...));
00616 
00617 #define gmp_sprintf __gmp_sprintf
00618 __GMP_DECLSPEC int gmp_sprintf __GMP_PROTO ((char *, __gmp_const char *, ...));
00619 
00620 #define gmp_vasprintf __gmp_vasprintf
00621 #if defined (_GMP_H_HAVE_VA_LIST)
00622 __GMP_DECLSPEC int gmp_vasprintf __GMP_PROTO ((char **, __gmp_const char *, va_list));
00623 #endif
00624 
00625 #define gmp_vfprintf __gmp_vfprintf
00626 #if defined (_GMP_H_HAVE_FILE) && defined (_GMP_H_HAVE_VA_LIST)
00627 __GMP_DECLSPEC int gmp_vfprintf __GMP_PROTO ((FILE *, __gmp_const char *, va_list));
00628 #endif
00629 
00630 #define gmp_vprintf __gmp_vprintf
00631 #if defined (_GMP_H_HAVE_VA_LIST)
00632 __GMP_DECLSPEC int gmp_vprintf __GMP_PROTO ((__gmp_const char *, va_list));
00633 #endif
00634 
00635 #define gmp_vsnprintf __gmp_vsnprintf
00636 #if defined (_GMP_H_HAVE_VA_LIST)
00637 __GMP_DECLSPEC int gmp_vsnprintf __GMP_PROTO ((char *, size_t, __gmp_const char *, va_list));
00638 #endif
00639 
00640 #define gmp_vsprintf __gmp_vsprintf
00641 #if defined (_GMP_H_HAVE_VA_LIST)
00642 __GMP_DECLSPEC int gmp_vsprintf __GMP_PROTO ((char *, __gmp_const char *, va_list));
00643 #endif
00644 
00645 
00646 /**************** Formatted input routines.  ****************/
00647 
00648 #define gmp_fscanf __gmp_fscanf
00649 #ifdef _GMP_H_HAVE_FILE
00650 __GMP_DECLSPEC int gmp_fscanf __GMP_PROTO ((FILE *, __gmp_const char *, ...));
00651 #endif
00652 
00653 #define gmp_scanf __gmp_scanf
00654 __GMP_DECLSPEC int gmp_scanf __GMP_PROTO ((__gmp_const char *, ...));
00655 
00656 #define gmp_sscanf __gmp_sscanf
00657 __GMP_DECLSPEC int gmp_sscanf __GMP_PROTO ((__gmp_const char *, __gmp_const char *, ...));
00658 
00659 #define gmp_vfscanf __gmp_vfscanf
00660 #if defined (_GMP_H_HAVE_FILE) && defined (_GMP_H_HAVE_VA_LIST)
00661 __GMP_DECLSPEC int gmp_vfscanf __GMP_PROTO ((FILE *, __gmp_const char *, va_list));
00662 #endif
00663 
00664 #define gmp_vscanf __gmp_vscanf
00665 #if defined (_GMP_H_HAVE_VA_LIST)
00666 __GMP_DECLSPEC int gmp_vscanf __GMP_PROTO ((__gmp_const char *, va_list));
00667 #endif
00668 
00669 #define gmp_vsscanf __gmp_vsscanf
00670 #if defined (_GMP_H_HAVE_VA_LIST)
00671 __GMP_DECLSPEC int gmp_vsscanf __GMP_PROTO ((__gmp_const char *, __gmp_const char *, va_list));
00672 #endif
00673 
00674 
00675 /**************** Integer (i.e. Z) routines.  ****************/
00676 
00677 #define _mpz_realloc __gmpz_realloc
00678 #define mpz_realloc __gmpz_realloc
00679 __GMP_DECLSPEC void *_mpz_realloc __GMP_PROTO ((mpz_ptr, mp_size_t));
00680 
00681 #define mpz_abs __gmpz_abs
00682 #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_abs)
00683 __GMP_DECLSPEC void mpz_abs __GMP_PROTO ((mpz_ptr, mpz_srcptr));
00684 #endif
00685 
00686 #define mpz_add __gmpz_add
00687 __GMP_DECLSPEC void mpz_add __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
00688 
00689 #define mpz_add_ui __gmpz_add_ui
00690 __GMP_DECLSPEC void mpz_add_ui __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
00691 
00692 #define mpz_addmul __gmpz_addmul
00693 __GMP_DECLSPEC void mpz_addmul __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
00694 
00695 #define mpz_addmul_ui __gmpz_addmul_ui
00696 __GMP_DECLSPEC void mpz_addmul_ui __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
00697 
00698 #define mpz_and __gmpz_and
00699 __GMP_DECLSPEC void mpz_and __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
00700 
00701 #define mpz_array_init __gmpz_array_init
00702 __GMP_DECLSPEC void mpz_array_init __GMP_PROTO ((mpz_ptr, mp_size_t, mp_size_t));
00703 
00704 #define mpz_bin_ui __gmpz_bin_ui
00705 __GMP_DECLSPEC void mpz_bin_ui __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
00706 
00707 #define mpz_bin_uiui __gmpz_bin_uiui
00708 __GMP_DECLSPEC void mpz_bin_uiui __GMP_PROTO ((mpz_ptr, unsigned long int, unsigned long int));
00709 
00710 #define mpz_cdiv_q __gmpz_cdiv_q
00711 __GMP_DECLSPEC void mpz_cdiv_q __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
00712 
00713 #define mpz_cdiv_q_2exp __gmpz_cdiv_q_2exp
00714 __GMP_DECLSPEC void mpz_cdiv_q_2exp __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long));
00715 
00716 #define mpz_cdiv_q_ui __gmpz_cdiv_q_ui
00717 __GMP_DECLSPEC unsigned long int mpz_cdiv_q_ui __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
00718 
00719 #define mpz_cdiv_qr __gmpz_cdiv_qr
00720 __GMP_DECLSPEC void mpz_cdiv_qr __GMP_PROTO ((mpz_ptr, mpz_ptr, mpz_srcptr, mpz_srcptr));
00721 
00722 #define mpz_cdiv_qr_ui __gmpz_cdiv_qr_ui
00723 __GMP_DECLSPEC unsigned long int mpz_cdiv_qr_ui __GMP_PROTO ((mpz_ptr, mpz_ptr, mpz_srcptr, unsigned long int));
00724 
00725 #define mpz_cdiv_r __gmpz_cdiv_r
00726 __GMP_DECLSPEC void mpz_cdiv_r __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
00727 
00728 #define mpz_cdiv_r_2exp __gmpz_cdiv_r_2exp
00729 __GMP_DECLSPEC void mpz_cdiv_r_2exp __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long));
00730 
00731 #define mpz_cdiv_r_ui __gmpz_cdiv_r_ui
00732 __GMP_DECLSPEC unsigned long int mpz_cdiv_r_ui __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
00733 
00734 #define mpz_cdiv_ui __gmpz_cdiv_ui
00735 __GMP_DECLSPEC unsigned long int mpz_cdiv_ui __GMP_PROTO ((mpz_srcptr, unsigned long int)) __GMP_ATTRIBUTE_PURE;
00736 
00737 #define mpz_clear __gmpz_clear
00738 __GMP_DECLSPEC void mpz_clear __GMP_PROTO ((mpz_ptr));
00739 
00740 #define mpz_clrbit __gmpz_clrbit
00741 __GMP_DECLSPEC void mpz_clrbit __GMP_PROTO ((mpz_ptr, unsigned long int));
00742 
00743 #define mpz_cmp __gmpz_cmp
00744 __GMP_DECLSPEC int mpz_cmp __GMP_PROTO ((mpz_srcptr, mpz_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
00745 
00746 #define mpz_cmp_d __gmpz_cmp_d
00747 __GMP_DECLSPEC int mpz_cmp_d __GMP_PROTO ((mpz_srcptr, double)) __GMP_ATTRIBUTE_PURE;
00748 
00749 #define _mpz_cmp_si __gmpz_cmp_si
00750 __GMP_DECLSPEC int _mpz_cmp_si __GMP_PROTO ((mpz_srcptr, signed long int)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
00751 
00752 #define _mpz_cmp_ui __gmpz_cmp_ui
00753 __GMP_DECLSPEC int _mpz_cmp_ui __GMP_PROTO ((mpz_srcptr, unsigned long int)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
00754 
00755 #define mpz_cmpabs __gmpz_cmpabs
00756 __GMP_DECLSPEC int mpz_cmpabs __GMP_PROTO ((mpz_srcptr, mpz_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
00757 
00758 #define mpz_cmpabs_d __gmpz_cmpabs_d
00759 __GMP_DECLSPEC int mpz_cmpabs_d __GMP_PROTO ((mpz_srcptr, double)) __GMP_ATTRIBUTE_PURE;
00760 
00761 #define mpz_cmpabs_ui __gmpz_cmpabs_ui
00762 __GMP_DECLSPEC int mpz_cmpabs_ui __GMP_PROTO ((mpz_srcptr, unsigned long int)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
00763 
00764 #define mpz_com __gmpz_com
00765 __GMP_DECLSPEC void mpz_com __GMP_PROTO ((mpz_ptr, mpz_srcptr));
00766 
00767 #define mpz_combit __gmpz_combit
00768 __GMP_DECLSPEC void mpz_combit __GMP_PROTO ((mpz_ptr, unsigned long int));
00769 
00770 #define mpz_congruent_p __gmpz_congruent_p
00771 __GMP_DECLSPEC int mpz_congruent_p __GMP_PROTO ((mpz_srcptr, mpz_srcptr, mpz_srcptr)) __GMP_ATTRIBUTE_PURE;
00772 
00773 #define mpz_congruent_2exp_p __gmpz_congruent_2exp_p
00774 __GMP_DECLSPEC int mpz_congruent_2exp_p __GMP_PROTO ((mpz_srcptr, mpz_srcptr, unsigned long)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
00775 
00776 #define mpz_congruent_ui_p __gmpz_congruent_ui_p
00777 __GMP_DECLSPEC int mpz_congruent_ui_p __GMP_PROTO ((mpz_srcptr, unsigned long, unsigned long)) __GMP_ATTRIBUTE_PURE;
00778 
00779 #define mpz_divexact __gmpz_divexact
00780 __GMP_DECLSPEC void mpz_divexact __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
00781 
00782 #define mpz_divexact_ui __gmpz_divexact_ui
00783 __GMP_DECLSPEC void mpz_divexact_ui __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long));
00784 
00785 #define mpz_divisible_p __gmpz_divisible_p
00786 __GMP_DECLSPEC int mpz_divisible_p __GMP_PROTO ((mpz_srcptr, mpz_srcptr)) __GMP_ATTRIBUTE_PURE;
00787 
00788 #define mpz_divisible_ui_p __gmpz_divisible_ui_p
00789 __GMP_DECLSPEC int mpz_divisible_ui_p __GMP_PROTO ((mpz_srcptr, unsigned long)) __GMP_ATTRIBUTE_PURE;
00790 
00791 #define mpz_divisible_2exp_p __gmpz_divisible_2exp_p
00792 __GMP_DECLSPEC int mpz_divisible_2exp_p __GMP_PROTO ((mpz_srcptr, unsigned long)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
00793 
00794 #define mpz_dump __gmpz_dump
00795 __GMP_DECLSPEC void mpz_dump __GMP_PROTO ((mpz_srcptr));
00796 
00797 #define mpz_export __gmpz_export
00798 __GMP_DECLSPEC void *mpz_export __GMP_PROTO ((void *, size_t *, int, size_t, int, size_t, mpz_srcptr));
00799 
00800 #define mpz_fac_ui __gmpz_fac_ui
00801 __GMP_DECLSPEC void mpz_fac_ui __GMP_PROTO ((mpz_ptr, unsigned long int));
00802 
00803 #define mpz_fdiv_q __gmpz_fdiv_q
00804 __GMP_DECLSPEC void mpz_fdiv_q __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
00805 
00806 #define mpz_fdiv_q_2exp __gmpz_fdiv_q_2exp
00807 __GMP_DECLSPEC void mpz_fdiv_q_2exp __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
00808 
00809 #define mpz_fdiv_q_ui __gmpz_fdiv_q_ui
00810 __GMP_DECLSPEC unsigned long int mpz_fdiv_q_ui __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
00811 
00812 #define mpz_fdiv_qr __gmpz_fdiv_qr
00813 __GMP_DECLSPEC void mpz_fdiv_qr __GMP_PROTO ((mpz_ptr, mpz_ptr, mpz_srcptr, mpz_srcptr));
00814 
00815 #define mpz_fdiv_qr_ui __gmpz_fdiv_qr_ui
00816 __GMP_DECLSPEC unsigned long int mpz_fdiv_qr_ui __GMP_PROTO ((mpz_ptr, mpz_ptr, mpz_srcptr, unsigned long int));
00817 
00818 #define mpz_fdiv_r __gmpz_fdiv_r
00819 __GMP_DECLSPEC void mpz_fdiv_r __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
00820 
00821 #define mpz_fdiv_r_2exp __gmpz_fdiv_r_2exp
00822 __GMP_DECLSPEC void mpz_fdiv_r_2exp __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
00823 
00824 #define mpz_fdiv_r_ui __gmpz_fdiv_r_ui
00825 __GMP_DECLSPEC unsigned long int mpz_fdiv_r_ui __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
00826 
00827 #define mpz_fdiv_ui __gmpz_fdiv_ui
00828 __GMP_DECLSPEC unsigned long int mpz_fdiv_ui __GMP_PROTO ((mpz_srcptr, unsigned long int)) __GMP_ATTRIBUTE_PURE;
00829 
00830 #define mpz_fib_ui __gmpz_fib_ui
00831 __GMP_DECLSPEC void mpz_fib_ui __GMP_PROTO ((mpz_ptr, unsigned long int));
00832 
00833 #define mpz_fib2_ui __gmpz_fib2_ui
00834 __GMP_DECLSPEC void mpz_fib2_ui __GMP_PROTO ((mpz_ptr, mpz_ptr, unsigned long int));
00835 
00836 #define mpz_fits_sint_p __gmpz_fits_sint_p
00837 __GMP_DECLSPEC int mpz_fits_sint_p __GMP_PROTO ((mpz_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
00838 
00839 #define mpz_fits_slong_p __gmpz_fits_slong_p
00840 __GMP_DECLSPEC int mpz_fits_slong_p __GMP_PROTO ((mpz_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
00841 
00842 #define mpz_fits_sshort_p __gmpz_fits_sshort_p
00843 __GMP_DECLSPEC int mpz_fits_sshort_p __GMP_PROTO ((mpz_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
00844 
00845 #define mpz_fits_uint_p __gmpz_fits_uint_p
00846 #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_fits_uint_p)
00847 __GMP_DECLSPEC int mpz_fits_uint_p __GMP_PROTO ((mpz_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
00848 #endif
00849 
00850 #define mpz_fits_ulong_p __gmpz_fits_ulong_p
00851 #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_fits_ulong_p)
00852 __GMP_DECLSPEC int mpz_fits_ulong_p __GMP_PROTO ((mpz_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
00853 #endif
00854 
00855 #define mpz_fits_ushort_p __gmpz_fits_ushort_p
00856 #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_fits_ushort_p)
00857 __GMP_DECLSPEC int mpz_fits_ushort_p __GMP_PROTO ((mpz_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
00858 #endif
00859 
00860 #define mpz_gcd __gmpz_gcd
00861 __GMP_DECLSPEC void mpz_gcd __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
00862 
00863 #define mpz_gcd_ui __gmpz_gcd_ui
00864 __GMP_DECLSPEC unsigned long int mpz_gcd_ui __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
00865 
00866 #define mpz_gcdext __gmpz_gcdext
00867 __GMP_DECLSPEC void mpz_gcdext __GMP_PROTO ((mpz_ptr, mpz_ptr, mpz_ptr, mpz_srcptr, mpz_srcptr));
00868 
00869 #define mpz_get_d __gmpz_get_d
00870 __GMP_DECLSPEC double mpz_get_d __GMP_PROTO ((mpz_srcptr)) __GMP_ATTRIBUTE_PURE;
00871 
00872 #define mpz_get_d_2exp __gmpz_get_d_2exp
00873 __GMP_DECLSPEC double mpz_get_d_2exp __GMP_PROTO ((signed long int *, mpz_srcptr));
00874 
00875 #define mpz_get_si __gmpz_get_si
00876 __GMP_DECLSPEC /* signed */ long int mpz_get_si __GMP_PROTO ((mpz_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
00877 
00878 #define mpz_get_str __gmpz_get_str
00879 __GMP_DECLSPEC char *mpz_get_str __GMP_PROTO ((char *, int, mpz_srcptr));
00880 
00881 #define mpz_get_ui __gmpz_get_ui
00882 #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_get_ui)
00883 __GMP_DECLSPEC unsigned long int mpz_get_ui __GMP_PROTO ((mpz_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
00884 #endif
00885 
00886 #define mpz_getlimbn __gmpz_getlimbn
00887 #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_getlimbn)
00888 __GMP_DECLSPEC mp_limb_t mpz_getlimbn __GMP_PROTO ((mpz_srcptr, mp_size_t)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
00889 #endif
00890 
00891 #define mpz_hamdist __gmpz_hamdist
00892 __GMP_DECLSPEC unsigned long int mpz_hamdist __GMP_PROTO ((mpz_srcptr, mpz_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
00893 
00894 #define mpz_import __gmpz_import
00895 __GMP_DECLSPEC void mpz_import __GMP_PROTO ((mpz_ptr, size_t, int, size_t, int, size_t, __gmp_const void *));
00896 
00897 #define mpz_init __gmpz_init
00898 __GMP_DECLSPEC void mpz_init __GMP_PROTO ((mpz_ptr));
00899 
00900 #define mpz_init2 __gmpz_init2
00901 __GMP_DECLSPEC void mpz_init2 __GMP_PROTO ((mpz_ptr, unsigned long));
00902 
00903 #define mpz_init_set __gmpz_init_set
00904 __GMP_DECLSPEC void mpz_init_set __GMP_PROTO ((mpz_ptr, mpz_srcptr));
00905 
00906 #define mpz_init_set_d __gmpz_init_set_d
00907 __GMP_DECLSPEC void mpz_init_set_d __GMP_PROTO ((mpz_ptr, double));
00908 
00909 #define mpz_init_set_si __gmpz_init_set_si
00910 __GMP_DECLSPEC void mpz_init_set_si __GMP_PROTO ((mpz_ptr, signed long int));
00911 
00912 #define mpz_init_set_str __gmpz_init_set_str
00913 __GMP_DECLSPEC int mpz_init_set_str __GMP_PROTO ((mpz_ptr, __gmp_const char *, int));
00914 
00915 #define mpz_init_set_ui __gmpz_init_set_ui
00916 __GMP_DECLSPEC void mpz_init_set_ui __GMP_PROTO ((mpz_ptr, unsigned long int));
00917 
00918 #define mpz_inp_raw __gmpz_inp_raw
00919 #ifdef _GMP_H_HAVE_FILE
00920 __GMP_DECLSPEC size_t mpz_inp_raw __GMP_PROTO ((mpz_ptr, FILE *));
00921 #endif
00922 
00923 #define mpz_inp_str __gmpz_inp_str
00924 #ifdef _GMP_H_HAVE_FILE
00925 __GMP_DECLSPEC size_t mpz_inp_str __GMP_PROTO ((mpz_ptr, FILE *, int));
00926 #endif
00927 
00928 #define mpz_invert __gmpz_invert
00929 __GMP_DECLSPEC int mpz_invert __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
00930 
00931 #define mpz_ior __gmpz_ior
00932 __GMP_DECLSPEC void mpz_ior __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
00933 
00934 #define mpz_jacobi __gmpz_jacobi
00935 __GMP_DECLSPEC int mpz_jacobi __GMP_PROTO ((mpz_srcptr, mpz_srcptr)) __GMP_ATTRIBUTE_PURE;
00936 
00937 #define mpz_kronecker mpz_jacobi  /* alias */
00938 
00939 #define mpz_kronecker_si __gmpz_kronecker_si
00940 __GMP_DECLSPEC int mpz_kronecker_si __GMP_PROTO ((mpz_srcptr, long)) __GMP_ATTRIBUTE_PURE;
00941 
00942 #define mpz_kronecker_ui __gmpz_kronecker_ui
00943 __GMP_DECLSPEC int mpz_kronecker_ui __GMP_PROTO ((mpz_srcptr, unsigned long)) __GMP_ATTRIBUTE_PURE;
00944 
00945 #define mpz_si_kronecker __gmpz_si_kronecker
00946 __GMP_DECLSPEC int mpz_si_kronecker __GMP_PROTO ((long, mpz_srcptr)) __GMP_ATTRIBUTE_PURE;
00947 
00948 #define mpz_ui_kronecker __gmpz_ui_kronecker
00949 __GMP_DECLSPEC int mpz_ui_kronecker __GMP_PROTO ((unsigned long, mpz_srcptr)) __GMP_ATTRIBUTE_PURE;
00950 
00951 #define mpz_lcm __gmpz_lcm
00952 __GMP_DECLSPEC void mpz_lcm __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
00953 
00954 #define mpz_lcm_ui __gmpz_lcm_ui
00955 __GMP_DECLSPEC void mpz_lcm_ui __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long));
00956 
00957 #define mpz_legendre mpz_jacobi  /* alias */
00958 
00959 #define mpz_lucnum_ui __gmpz_lucnum_ui
00960 __GMP_DECLSPEC void mpz_lucnum_ui __GMP_PROTO ((mpz_ptr, unsigned long int));
00961 
00962 #define mpz_lucnum2_ui __gmpz_lucnum2_ui
00963 __GMP_DECLSPEC void mpz_lucnum2_ui __GMP_PROTO ((mpz_ptr, mpz_ptr, unsigned long int));
00964 
00965 #define mpz_millerrabin __gmpz_millerrabin
00966 __GMP_DECLSPEC int mpz_millerrabin __GMP_PROTO ((mpz_srcptr, int)) __GMP_ATTRIBUTE_PURE;
00967 
00968 #define mpz_mod __gmpz_mod
00969 __GMP_DECLSPEC void mpz_mod __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
00970 
00971 #define mpz_mod_ui mpz_fdiv_r_ui /* same as fdiv_r because divisor unsigned */
00972 
00973 #define mpz_mul __gmpz_mul
00974 __GMP_DECLSPEC void mpz_mul __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
00975 
00976 #define mpz_mul_2exp __gmpz_mul_2exp
00977 __GMP_DECLSPEC void mpz_mul_2exp __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
00978 
00979 #define mpz_mul_si __gmpz_mul_si
00980 __GMP_DECLSPEC void mpz_mul_si __GMP_PROTO ((mpz_ptr, mpz_srcptr, long int));
00981 
00982 #define mpz_mul_ui __gmpz_mul_ui
00983 __GMP_DECLSPEC void mpz_mul_ui __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
00984 
00985 #define mpz_neg __gmpz_neg
00986 #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_neg)
00987 __GMP_DECLSPEC void mpz_neg __GMP_PROTO ((mpz_ptr, mpz_srcptr));
00988 #endif
00989 
00990 #define mpz_nextprime __gmpz_nextprime
00991 __GMP_DECLSPEC void mpz_nextprime __GMP_PROTO ((mpz_ptr, mpz_srcptr));
00992 
00993 #define mpz_out_raw __gmpz_out_raw
00994 #ifdef _GMP_H_HAVE_FILE
00995 __GMP_DECLSPEC size_t mpz_out_raw __GMP_PROTO ((FILE *, mpz_srcptr));
00996 #endif
00997 
00998 #define mpz_out_str __gmpz_out_str
00999 #ifdef _GMP_H_HAVE_FILE
01000 __GMP_DECLSPEC size_t mpz_out_str __GMP_PROTO ((FILE *, int, mpz_srcptr));
01001 #endif
01002 
01003 #define mpz_perfect_power_p __gmpz_perfect_power_p
01004 __GMP_DECLSPEC int mpz_perfect_power_p __GMP_PROTO ((mpz_srcptr)) __GMP_ATTRIBUTE_PURE;
01005 
01006 #define mpz_perfect_square_p __gmpz_perfect_square_p
01007 #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_perfect_square_p)
01008 __GMP_DECLSPEC int mpz_perfect_square_p __GMP_PROTO ((mpz_srcptr)) __GMP_ATTRIBUTE_PURE;
01009 #endif
01010 
01011 #define mpz_popcount __gmpz_popcount
01012 #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_popcount)
01013 __GMP_DECLSPEC unsigned long int mpz_popcount __GMP_PROTO ((mpz_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
01014 #endif
01015 
01016 #define mpz_pow_ui __gmpz_pow_ui
01017 __GMP_DECLSPEC void mpz_pow_ui __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
01018 
01019 #define mpz_powm __gmpz_powm
01020 __GMP_DECLSPEC void mpz_powm __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr, mpz_srcptr));
01021 
01022 #define mpz_powm_ui __gmpz_powm_ui
01023 __GMP_DECLSPEC void mpz_powm_ui __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int, mpz_srcptr));
01024 
01025 #define mpz_probab_prime_p __gmpz_probab_prime_p
01026 __GMP_DECLSPEC int mpz_probab_prime_p __GMP_PROTO ((mpz_srcptr, int)) __GMP_ATTRIBUTE_PURE;
01027 
01028 #define mpz_random __gmpz_random
01029 __GMP_DECLSPEC void mpz_random __GMP_PROTO ((mpz_ptr, mp_size_t));
01030 
01031 #define mpz_random2 __gmpz_random2
01032 __GMP_DECLSPEC void mpz_random2 __GMP_PROTO ((mpz_ptr, mp_size_t));
01033 
01034 #define mpz_realloc2 __gmpz_realloc2
01035 __GMP_DECLSPEC void mpz_realloc2 __GMP_PROTO ((mpz_ptr, unsigned long));
01036 
01037 #define mpz_remove __gmpz_remove
01038 __GMP_DECLSPEC unsigned long int mpz_remove __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
01039 
01040 #define mpz_root __gmpz_root
01041 __GMP_DECLSPEC int mpz_root __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
01042 
01043 #define mpz_rootrem __gmpz_rootrem
01044 __GMP_DECLSPEC void mpz_rootrem __GMP_PROTO ((mpz_ptr,mpz_ptr, mpz_srcptr, unsigned long int));
01045 
01046 #define mpz_rrandomb __gmpz_rrandomb
01047 __GMP_DECLSPEC void mpz_rrandomb __GMP_PROTO ((mpz_ptr, gmp_randstate_t, unsigned long int));
01048 
01049 #define mpz_scan0 __gmpz_scan0
01050 __GMP_DECLSPEC unsigned long int mpz_scan0 __GMP_PROTO ((mpz_srcptr, unsigned long int)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
01051 
01052 #define mpz_scan1 __gmpz_scan1
01053 __GMP_DECLSPEC unsigned long int mpz_scan1 __GMP_PROTO ((mpz_srcptr, unsigned long int)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
01054 
01055 #define mpz_set __gmpz_set
01056 __GMP_DECLSPEC void mpz_set __GMP_PROTO ((mpz_ptr, mpz_srcptr));
01057 
01058 #define mpz_set_d __gmpz_set_d
01059 __GMP_DECLSPEC void mpz_set_d __GMP_PROTO ((mpz_ptr, double));
01060 
01061 #define mpz_set_f __gmpz_set_f
01062 __GMP_DECLSPEC void mpz_set_f __GMP_PROTO ((mpz_ptr, mpf_srcptr));
01063 
01064 #define mpz_set_q __gmpz_set_q
01065 #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_set_q)
01066 __GMP_DECLSPEC void mpz_set_q __GMP_PROTO ((mpz_ptr, mpq_srcptr));
01067 #endif
01068 
01069 #define mpz_set_si __gmpz_set_si
01070 __GMP_DECLSPEC void mpz_set_si __GMP_PROTO ((mpz_ptr, signed long int));
01071 
01072 #define mpz_set_str __gmpz_set_str
01073 __GMP_DECLSPEC int mpz_set_str __GMP_PROTO ((mpz_ptr, __gmp_const char *, int));
01074 
01075 #define mpz_set_ui __gmpz_set_ui
01076 __GMP_DECLSPEC void mpz_set_ui __GMP_PROTO ((mpz_ptr, unsigned long int));
01077 
01078 #define mpz_setbit __gmpz_setbit
01079 __GMP_DECLSPEC void mpz_setbit __GMP_PROTO ((mpz_ptr, unsigned long int));
01080 
01081 #define mpz_size __gmpz_size
01082 #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_size)
01083 __GMP_DECLSPEC size_t mpz_size __GMP_PROTO ((mpz_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
01084 #endif
01085 
01086 #define mpz_sizeinbase __gmpz_sizeinbase
01087 __GMP_DECLSPEC size_t mpz_sizeinbase __GMP_PROTO ((mpz_srcptr, int)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
01088 
01089 #define mpz_sqrt __gmpz_sqrt
01090 __GMP_DECLSPEC void mpz_sqrt __GMP_PROTO ((mpz_ptr, mpz_srcptr));
01091 
01092 #define mpz_sqrtrem __gmpz_sqrtrem
01093 __GMP_DECLSPEC void mpz_sqrtrem __GMP_PROTO ((mpz_ptr, mpz_ptr, mpz_srcptr));
01094 
01095 #define mpz_sub __gmpz_sub
01096 __GMP_DECLSPEC void mpz_sub __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
01097 
01098 #define mpz_sub_ui __gmpz_sub_ui
01099 __GMP_DECLSPEC void mpz_sub_ui __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
01100 
01101 #define mpz_ui_sub __gmpz_ui_sub
01102 __GMP_DECLSPEC void mpz_ui_sub __GMP_PROTO ((mpz_ptr, unsigned long int, mpz_srcptr));
01103 
01104 #define mpz_submul __gmpz_submul
01105 __GMP_DECLSPEC void mpz_submul __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
01106 
01107 #define mpz_submul_ui __gmpz_submul_ui
01108 __GMP_DECLSPEC void mpz_submul_ui __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
01109 
01110 #define mpz_swap __gmpz_swap
01111 __GMP_DECLSPEC void mpz_swap __GMP_PROTO ((mpz_ptr, mpz_ptr)) __GMP_NOTHROW;
01112 
01113 #define mpz_tdiv_ui __gmpz_tdiv_ui
01114 __GMP_DECLSPEC unsigned long int mpz_tdiv_ui __GMP_PROTO ((mpz_srcptr, unsigned long int)) __GMP_ATTRIBUTE_PURE;
01115 
01116 #define mpz_tdiv_q __gmpz_tdiv_q
01117 __GMP_DECLSPEC void mpz_tdiv_q __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
01118 
01119 #define mpz_tdiv_q_2exp __gmpz_tdiv_q_2exp
01120 __GMP_DECLSPEC void mpz_tdiv_q_2exp __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
01121 
01122 #define mpz_tdiv_q_ui __gmpz_tdiv_q_ui
01123 __GMP_DECLSPEC unsigned long int mpz_tdiv_q_ui __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
01124 
01125 #define mpz_tdiv_qr __gmpz_tdiv_qr
01126 __GMP_DECLSPEC void mpz_tdiv_qr __GMP_PROTO ((mpz_ptr, mpz_ptr, mpz_srcptr, mpz_srcptr));
01127 
01128 #define mpz_tdiv_qr_ui __gmpz_tdiv_qr_ui
01129 __GMP_DECLSPEC unsigned long int mpz_tdiv_qr_ui __GMP_PROTO ((mpz_ptr, mpz_ptr, mpz_srcptr, unsigned long int));
01130 
01131 #define mpz_tdiv_r __gmpz_tdiv_r
01132 __GMP_DECLSPEC void mpz_tdiv_r __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
01133 
01134 #define mpz_tdiv_r_2exp __gmpz_tdiv_r_2exp
01135 __GMP_DECLSPEC void mpz_tdiv_r_2exp __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
01136 
01137 #define mpz_tdiv_r_ui __gmpz_tdiv_r_ui
01138 __GMP_DECLSPEC unsigned long int mpz_tdiv_r_ui __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
01139 
01140 #define mpz_tstbit __gmpz_tstbit
01141 __GMP_DECLSPEC int mpz_tstbit __GMP_PROTO ((mpz_srcptr, unsigned long int)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
01142 
01143 #define mpz_ui_pow_ui __gmpz_ui_pow_ui
01144 __GMP_DECLSPEC void mpz_ui_pow_ui __GMP_PROTO ((mpz_ptr, unsigned long int, unsigned long int));
01145 
01146 #define mpz_urandomb __gmpz_urandomb
01147 __GMP_DECLSPEC void mpz_urandomb __GMP_PROTO ((mpz_ptr, gmp_randstate_t, unsigned long int));
01148 
01149 #define mpz_urandomm __gmpz_urandomm
01150 __GMP_DECLSPEC void mpz_urandomm __GMP_PROTO ((mpz_ptr, gmp_randstate_t, mpz_srcptr));
01151 
01152 #define mpz_xor __gmpz_xor
01153 #define mpz_eor __gmpz_xor
01154 __GMP_DECLSPEC void mpz_xor __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
01155 
01156 
01157 /**************** Rational (i.e. Q) routines.  ****************/
01158 
01159 #define mpq_abs __gmpq_abs
01160 #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpq_abs)
01161 __GMP_DECLSPEC void mpq_abs __GMP_PROTO ((mpq_ptr, mpq_srcptr));
01162 #endif
01163 
01164 #define mpq_add __gmpq_add
01165 __GMP_DECLSPEC void mpq_add __GMP_PROTO ((mpq_ptr, mpq_srcptr, mpq_srcptr));
01166 
01167 #define mpq_canonicalize __gmpq_canonicalize
01168 __GMP_DECLSPEC void mpq_canonicalize __GMP_PROTO ((mpq_ptr));
01169 
01170 #define mpq_clear __gmpq_clear
01171 __GMP_DECLSPEC void mpq_clear __GMP_PROTO ((mpq_ptr));
01172 
01173 #define mpq_cmp __gmpq_cmp
01174 __GMP_DECLSPEC int mpq_cmp __GMP_PROTO ((mpq_srcptr, mpq_srcptr)) __GMP_ATTRIBUTE_PURE;
01175 
01176 #define _mpq_cmp_si __gmpq_cmp_si
01177 __GMP_DECLSPEC int _mpq_cmp_si __GMP_PROTO ((mpq_srcptr, long, unsigned long)) __GMP_ATTRIBUTE_PURE;
01178 
01179 #define _mpq_cmp_ui __gmpq_cmp_ui
01180 __GMP_DECLSPEC int _mpq_cmp_ui __GMP_PROTO ((mpq_srcptr, unsigned long int, unsigned long int)) __GMP_ATTRIBUTE_PURE;
01181 
01182 #define mpq_div __gmpq_div
01183 __GMP_DECLSPEC void mpq_div __GMP_PROTO ((mpq_ptr, mpq_srcptr, mpq_srcptr));
01184 
01185 #define mpq_div_2exp __gmpq_div_2exp
01186 __GMP_DECLSPEC void mpq_div_2exp __GMP_PROTO ((mpq_ptr, mpq_srcptr, unsigned long));
01187 
01188 #define mpq_equal __gmpq_equal
01189 __GMP_DECLSPEC int mpq_equal __GMP_PROTO ((mpq_srcptr, mpq_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
01190 
01191 #define mpq_get_num __gmpq_get_num
01192 __GMP_DECLSPEC void mpq_get_num __GMP_PROTO ((mpz_ptr, mpq_srcptr));
01193 
01194 #define mpq_get_den __gmpq_get_den
01195 __GMP_DECLSPEC void mpq_get_den __GMP_PROTO ((mpz_ptr, mpq_srcptr));
01196 
01197 #define mpq_get_d __gmpq_get_d
01198 __GMP_DECLSPEC double mpq_get_d __GMP_PROTO ((mpq_srcptr)) __GMP_ATTRIBUTE_PURE;
01199 
01200 #define mpq_get_str __gmpq_get_str
01201 __GMP_DECLSPEC char *mpq_get_str __GMP_PROTO ((char *, int, mpq_srcptr));
01202 
01203 #define mpq_init __gmpq_init
01204 __GMP_DECLSPEC void mpq_init __GMP_PROTO ((mpq_ptr));
01205 
01206 #define mpq_inp_str __gmpq_inp_str
01207 #ifdef _GMP_H_HAVE_FILE
01208 __GMP_DECLSPEC size_t mpq_inp_str __GMP_PROTO ((mpq_ptr, FILE *, int));
01209 #endif
01210 
01211 #define mpq_inv __gmpq_inv
01212 __GMP_DECLSPEC void mpq_inv __GMP_PROTO ((mpq_ptr, mpq_srcptr));
01213 
01214 #define mpq_mul __gmpq_mul
01215 __GMP_DECLSPEC void mpq_mul __GMP_PROTO ((mpq_ptr, mpq_srcptr, mpq_srcptr));
01216 
01217 #define mpq_mul_2exp __gmpq_mul_2exp
01218 __GMP_DECLSPEC void mpq_mul_2exp __GMP_PROTO ((mpq_ptr, mpq_srcptr, unsigned long));
01219 
01220 #define mpq_neg __gmpq_neg
01221 #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpq_neg)
01222 __GMP_DECLSPEC void mpq_neg __GMP_PROTO ((mpq_ptr, mpq_srcptr));
01223 #endif
01224 
01225 #define mpq_out_str __gmpq_out_str
01226 #ifdef _GMP_H_HAVE_FILE
01227 __GMP_DECLSPEC size_t mpq_out_str __GMP_PROTO ((FILE *, int, mpq_srcptr));
01228 #endif
01229 
01230 #define mpq_set __gmpq_set
01231 __GMP_DECLSPEC void mpq_set __GMP_PROTO ((mpq_ptr, mpq_srcptr));
01232 
01233 #define mpq_set_d __gmpq_set_d
01234 __GMP_DECLSPEC void mpq_set_d __GMP_PROTO ((mpq_ptr, double));
01235 
01236 #define mpq_set_den __gmpq_set_den
01237 __GMP_DECLSPEC void mpq_set_den __GMP_PROTO ((mpq_ptr, mpz_srcptr));
01238 
01239 #define mpq_set_f __gmpq_set_f
01240 __GMP_DECLSPEC void mpq_set_f __GMP_PROTO ((mpq_ptr, mpf_srcptr));
01241 
01242 #define mpq_set_num __gmpq_set_num
01243 __GMP_DECLSPEC void mpq_set_num __GMP_PROTO ((mpq_ptr, mpz_srcptr));
01244 
01245 #define mpq_set_si __gmpq_set_si
01246 __GMP_DECLSPEC void mpq_set_si __GMP_PROTO ((mpq_ptr, signed long int, unsigned long int));
01247 
01248 #define mpq_set_str __gmpq_set_str
01249 __GMP_DECLSPEC int mpq_set_str __GMP_PROTO ((mpq_ptr, __gmp_const char *, int));
01250 
01251 #define mpq_set_ui __gmpq_set_ui
01252 __GMP_DECLSPEC void mpq_set_ui __GMP_PROTO ((mpq_ptr, unsigned long int, unsigned long int));
01253 
01254 #define mpq_set_z __gmpq_set_z
01255 __GMP_DECLSPEC void mpq_set_z __GMP_PROTO ((mpq_ptr, mpz_srcptr));
01256 
01257 #define mpq_sub __gmpq_sub
01258 __GMP_DECLSPEC void mpq_sub __GMP_PROTO ((mpq_ptr, mpq_srcptr, mpq_srcptr));
01259 
01260 #define mpq_swap __gmpq_swap
01261 __GMP_DECLSPEC void mpq_swap __GMP_PROTO ((mpq_ptr, mpq_ptr)) __GMP_NOTHROW;
01262 
01263 
01264 /**************** Float (i.e. F) routines.  ****************/
01265 
01266 #define mpf_abs __gmpf_abs
01267 __GMP_DECLSPEC void mpf_abs __GMP_PROTO ((mpf_ptr, mpf_srcptr));
01268 
01269 #define mpf_add __gmpf_add
01270 __GMP_DECLSPEC void mpf_add __GMP_PROTO ((mpf_ptr, mpf_srcptr, mpf_srcptr));
01271 
01272 #define mpf_add_ui __gmpf_add_ui
01273 __GMP_DECLSPEC void mpf_add_ui __GMP_PROTO ((mpf_ptr, mpf_srcptr, unsigned long int));
01274 #define mpf_ceil __gmpf_ceil
01275 __GMP_DECLSPEC void mpf_ceil __GMP_PROTO ((mpf_ptr, mpf_srcptr));
01276 
01277 #define mpf_clear __gmpf_clear
01278 __GMP_DECLSPEC void mpf_clear __GMP_PROTO ((mpf_ptr));
01279 
01280 #define mpf_cmp __gmpf_cmp
01281 __GMP_DECLSPEC int mpf_cmp __GMP_PROTO ((mpf_srcptr, mpf_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
01282 
01283 #define mpf_cmp_d __gmpf_cmp_d
01284 __GMP_DECLSPEC int mpf_cmp_d __GMP_PROTO ((mpf_srcptr, double)) __GMP_ATTRIBUTE_PURE;
01285 
01286 #define mpf_cmp_si __gmpf_cmp_si
01287 __GMP_DECLSPEC int mpf_cmp_si __GMP_PROTO ((mpf_srcptr, signed long int)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
01288 
01289 #define mpf_cmp_ui __gmpf_cmp_ui
01290 __GMP_DECLSPEC int mpf_cmp_ui __GMP_PROTO ((mpf_srcptr, unsigned long int)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
01291 
01292 #define mpf_div __gmpf_div
01293 __GMP_DECLSPEC void mpf_div __GMP_PROTO ((mpf_ptr, mpf_srcptr, mpf_srcptr));
01294 
01295 #define mpf_div_2exp __gmpf_div_2exp
01296 __GMP_DECLSPEC void mpf_div_2exp __GMP_PROTO ((mpf_ptr, mpf_srcptr, unsigned long int));
01297 
01298 #define mpf_div_ui __gmpf_div_ui
01299 __GMP_DECLSPEC void mpf_div_ui __GMP_PROTO ((mpf_ptr, mpf_srcptr, unsigned long int));
01300 
01301 #define mpf_dump __gmpf_dump
01302 __GMP_DECLSPEC void mpf_dump __GMP_PROTO ((mpf_srcptr));
01303 
01304 #define mpf_eq __gmpf_eq
01305 __GMP_DECLSPEC int mpf_eq __GMP_PROTO ((mpf_srcptr, mpf_srcptr, unsigned long int)) __GMP_ATTRIBUTE_PURE;
01306 
01307 #define mpf_fits_sint_p __gmpf_fits_sint_p
01308 __GMP_DECLSPEC int mpf_fits_sint_p __GMP_PROTO ((mpf_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
01309 
01310 #define mpf_fits_slong_p __gmpf_fits_slong_p
01311 __GMP_DECLSPEC int mpf_fits_slong_p __GMP_PROTO ((mpf_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
01312 
01313 #define mpf_fits_sshort_p __gmpf_fits_sshort_p
01314 __GMP_DECLSPEC int mpf_fits_sshort_p __GMP_PROTO ((mpf_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
01315 
01316 #define mpf_fits_uint_p __gmpf_fits_uint_p
01317 __GMP_DECLSPEC int mpf_fits_uint_p __GMP_PROTO ((mpf_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
01318 
01319 #define mpf_fits_ulong_p __gmpf_fits_ulong_p
01320 __GMP_DECLSPEC int mpf_fits_ulong_p __GMP_PROTO ((mpf_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
01321 
01322 #define mpf_fits_ushort_p __gmpf_fits_ushort_p
01323 __GMP_DECLSPEC int mpf_fits_ushort_p __GMP_PROTO ((mpf_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
01324 
01325 #define mpf_floor __gmpf_floor
01326 __GMP_DECLSPEC void mpf_floor __GMP_PROTO ((mpf_ptr, mpf_srcptr));
01327 
01328 #define mpf_get_d __gmpf_get_d
01329 __GMP_DECLSPEC double mpf_get_d __GMP_PROTO ((mpf_srcptr)) __GMP_ATTRIBUTE_PURE;
01330 
01331 #define mpf_get_d_2exp __gmpf_get_d_2exp
01332 __GMP_DECLSPEC double mpf_get_d_2exp __GMP_PROTO ((signed long int *, mpf_srcptr));
01333 
01334 #define mpf_get_default_prec __gmpf_get_default_prec
01335 __GMP_DECLSPEC unsigned long int mpf_get_default_prec __GMP_PROTO ((void)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
01336 
01337 #define mpf_get_prec __gmpf_get_prec
01338 __GMP_DECLSPEC unsigned long int mpf_get_prec __GMP_PROTO ((mpf_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
01339 
01340 #define mpf_get_si __gmpf_get_si
01341 __GMP_DECLSPEC long mpf_get_si __GMP_PROTO ((mpf_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
01342 
01343 #define mpf_get_str __gmpf_get_str
01344 __GMP_DECLSPEC char *mpf_get_str __GMP_PROTO ((char *, mp_exp_t *, int, size_t, mpf_srcptr));
01345 
01346 #define mpf_get_ui __gmpf_get_ui
01347 __GMP_DECLSPEC unsigned long mpf_get_ui __GMP_PROTO ((mpf_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
01348 
01349 #define mpf_init __gmpf_init
01350 __GMP_DECLSPEC void mpf_init __GMP_PROTO ((mpf_ptr));
01351 
01352 #define mpf_init2 __gmpf_init2
01353 __GMP_DECLSPEC void mpf_init2 __GMP_PROTO ((mpf_ptr, unsigned long int));
01354 
01355 #define mpf_init_set __gmpf_init_set
01356 __GMP_DECLSPEC void mpf_init_set __GMP_PROTO ((mpf_ptr, mpf_srcptr));
01357 
01358 #define mpf_init_set_d __gmpf_init_set_d
01359 __GMP_DECLSPEC void mpf_init_set_d __GMP_PROTO ((mpf_ptr, double));
01360 
01361 #define mpf_init_set_si __gmpf_init_set_si
01362 __GMP_DECLSPEC void mpf_init_set_si __GMP_PROTO ((mpf_ptr, signed long int));
01363 
01364 #define mpf_init_set_str __gmpf_init_set_str
01365 __GMP_DECLSPEC int mpf_init_set_str __GMP_PROTO ((mpf_ptr, __gmp_const char *, int));
01366 
01367 #define mpf_init_set_ui __gmpf_init_set_ui
01368 __GMP_DECLSPEC void mpf_init_set_ui __GMP_PROTO ((mpf_ptr, unsigned long int));
01369 
01370 #define mpf_inp_str __gmpf_inp_str
01371 #ifdef _GMP_H_HAVE_FILE
01372 __GMP_DECLSPEC size_t mpf_inp_str __GMP_PROTO ((mpf_ptr, FILE *, int));
01373 #endif
01374 
01375 #define mpf_integer_p __gmpf_integer_p
01376 __GMP_DECLSPEC int mpf_integer_p __GMP_PROTO ((mpf_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
01377 
01378 #define mpf_mul __gmpf_mul
01379 __GMP_DECLSPEC void mpf_mul __GMP_PROTO ((mpf_ptr, mpf_srcptr, mpf_srcptr));
01380 
01381 #define mpf_mul_2exp __gmpf_mul_2exp
01382 __GMP_DECLSPEC void mpf_mul_2exp __GMP_PROTO ((mpf_ptr, mpf_srcptr, unsigned long int));
01383 
01384 #define mpf_mul_ui __gmpf_mul_ui
01385 __GMP_DECLSPEC void mpf_mul_ui __GMP_PROTO ((mpf_ptr, mpf_srcptr, unsigned long int));
01386 
01387 #define mpf_neg __gmpf_neg
01388 __GMP_DECLSPEC void mpf_neg __GMP_PROTO ((mpf_ptr, mpf_srcptr));
01389 
01390 #define mpf_out_str __gmpf_out_str
01391 #ifdef _GMP_H_HAVE_FILE
01392 __GMP_DECLSPEC size_t mpf_out_str __GMP_PROTO ((FILE *, int, size_t, mpf_srcptr));
01393 #endif
01394 
01395 #define mpf_pow_ui __gmpf_pow_ui
01396 __GMP_DECLSPEC void mpf_pow_ui __GMP_PROTO ((mpf_ptr, mpf_srcptr, unsigned long int));
01397 
01398 #define mpf_random2 __gmpf_random2
01399 __GMP_DECLSPEC void mpf_random2 __GMP_PROTO ((mpf_ptr, mp_size_t, mp_exp_t));
01400 
01401 #define mpf_reldiff __gmpf_reldiff
01402 __GMP_DECLSPEC void mpf_reldiff __GMP_PROTO ((mpf_ptr, mpf_srcptr, mpf_srcptr));
01403 
01404 #define mpf_set __gmpf_set
01405 __GMP_DECLSPEC void mpf_set __GMP_PROTO ((mpf_ptr, mpf_srcptr));
01406 
01407 #define mpf_set_d __gmpf_set_d
01408 __GMP_DECLSPEC void mpf_set_d __GMP_PROTO ((mpf_ptr, double));
01409 
01410 #define mpf_set_default_prec __gmpf_set_default_prec
01411 __GMP_DECLSPEC void mpf_set_default_prec __GMP_PROTO ((unsigned long int)) __GMP_NOTHROW;
01412 
01413 #define mpf_set_prec __gmpf_set_prec
01414 __GMP_DECLSPEC void mpf_set_prec __GMP_PROTO ((mpf_ptr, unsigned long int));
01415 
01416 #define mpf_set_prec_raw __gmpf_set_prec_raw
01417 __GMP_DECLSPEC void mpf_set_prec_raw __GMP_PROTO ((mpf_ptr, unsigned long int)) __GMP_NOTHROW;
01418 
01419 #define mpf_set_q __gmpf_set_q
01420 __GMP_DECLSPEC void mpf_set_q __GMP_PROTO ((mpf_ptr, mpq_srcptr));
01421 
01422 #define mpf_set_si __gmpf_set_si
01423 __GMP_DECLSPEC void mpf_set_si __GMP_PROTO ((mpf_ptr, signed long int));
01424 
01425 #define mpf_set_str __gmpf_set_str
01426 __GMP_DECLSPEC int mpf_set_str __GMP_PROTO ((mpf_ptr, __gmp_const char *, int));
01427 
01428 #define mpf_set_ui __gmpf_set_ui
01429 __GMP_DECLSPEC void mpf_set_ui __GMP_PROTO ((mpf_ptr, unsigned long int));
01430 
01431 #define mpf_set_z __gmpf_set_z
01432 __GMP_DECLSPEC void mpf_set_z __GMP_PROTO ((mpf_ptr, mpz_srcptr));
01433 
01434 #define mpf_size __gmpf_size
01435 __GMP_DECLSPEC size_t mpf_size __GMP_PROTO ((mpf_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
01436 
01437 #define mpf_sqrt __gmpf_sqrt
01438 __GMP_DECLSPEC void mpf_sqrt __GMP_PROTO ((mpf_ptr, mpf_srcptr));
01439 
01440 #define mpf_sqrt_ui __gmpf_sqrt_ui
01441 __GMP_DECLSPEC void mpf_sqrt_ui __GMP_PROTO ((mpf_ptr, unsigned long int));
01442 
01443 #define mpf_sub __gmpf_sub
01444 __GMP_DECLSPEC void mpf_sub __GMP_PROTO ((mpf_ptr, mpf_srcptr, mpf_srcptr));
01445 
01446 #define mpf_sub_ui __gmpf_sub_ui
01447 __GMP_DECLSPEC void mpf_sub_ui __GMP_PROTO ((mpf_ptr, mpf_srcptr, unsigned long int));
01448 
01449 #define mpf_swap __gmpf_swap
01450 __GMP_DECLSPEC void mpf_swap __GMP_PROTO ((mpf_ptr, mpf_ptr)) __GMP_NOTHROW;
01451 
01452 #define mpf_trunc __gmpf_trunc
01453 __GMP_DECLSPEC void mpf_trunc __GMP_PROTO ((mpf_ptr, mpf_srcptr));
01454 
01455 #define mpf_ui_div __gmpf_ui_div
01456 __GMP_DECLSPEC void mpf_ui_div __GMP_PROTO ((mpf_ptr, unsigned long int, mpf_srcptr));
01457 
01458 #define mpf_ui_sub __gmpf_ui_sub
01459 __GMP_DECLSPEC void mpf_ui_sub __GMP_PROTO ((mpf_ptr, unsigned long int, mpf_srcptr));
01460 
01461 #define mpf_urandomb __gmpf_urandomb
01462 __GMP_DECLSPEC void mpf_urandomb __GMP_PROTO ((mpf_t, gmp_randstate_t, unsigned long int));
01463 
01464 
01465 /************ Low level positive-integer (i.e. N) routines.  ************/
01466 
01467 /* This is ugly, but we need to make user calls reach the prefixed function. */
01468 
01469 #define mpn_add __MPN(add)
01470 #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpn_add)
01471 __GMP_DECLSPEC mp_limb_t mpn_add __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr,mp_size_t));
01472 #endif
01473 
01474 #define mpn_add_1 __MPN(add_1)
01475 #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpn_add_1)
01476 __GMP_DECLSPEC mp_limb_t mpn_add_1 __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t)) __GMP_NOTHROW;
01477 #endif
01478 
01479 #define mpn_add_n __MPN(add_n)
01480 __GMP_DECLSPEC mp_limb_t mpn_add_n __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t));
01481 
01482 #define mpn_addmul_1 __MPN(addmul_1)
01483 __GMP_DECLSPEC mp_limb_t mpn_addmul_1 __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t));
01484 
01485 #define mpn_bdivmod __MPN(bdivmod)
01486 __GMP_DECLSPEC mp_limb_t mpn_bdivmod __GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, unsigned long int));
01487 
01488 #define mpn_cmp __MPN(cmp)
01489 #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpn_cmp)
01490 __GMP_DECLSPEC int mpn_cmp __GMP_PROTO ((mp_srcptr, mp_srcptr, mp_size_t)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
01491 #endif
01492 
01493 #define mpn_divexact_by3(dst,src,size) \
01494   mpn_divexact_by3c (dst, src, size, __GMP_CAST (mp_limb_t, 0))
01495 
01496 #define mpn_divexact_by3c __MPN(divexact_by3c)
01497 __GMP_DECLSPEC mp_limb_t mpn_divexact_by3c __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t));
01498 
01499 #define mpn_divmod_1(qp,np,nsize,dlimb) \
01500   mpn_divrem_1 (qp, __GMP_CAST (mp_size_t, 0), np, nsize, dlimb)
01501 
01502 #define mpn_divrem __MPN(divrem)
01503 __GMP_DECLSPEC mp_limb_t mpn_divrem __GMP_PROTO ((mp_ptr, mp_size_t, mp_ptr, mp_size_t, mp_srcptr, mp_size_t));
01504 
01505 #define mpn_divrem_1 __MPN(divrem_1)
01506 __GMP_DECLSPEC mp_limb_t mpn_divrem_1 __GMP_PROTO ((mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t));
01507 
01508 #define mpn_divrem_2 __MPN(divrem_2)
01509 __GMP_DECLSPEC mp_limb_t mpn_divrem_2 __GMP_PROTO ((mp_ptr, mp_size_t, mp_ptr, mp_size_t, mp_srcptr));
01510 
01511 #define mpn_gcd __MPN(gcd)
01512 __GMP_DECLSPEC mp_size_t mpn_gcd __GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t, mp_ptr, mp_size_t));
01513 
01514 #define mpn_gcd_1 __MPN(gcd_1)
01515 __GMP_DECLSPEC mp_limb_t mpn_gcd_1 __GMP_PROTO ((mp_srcptr, mp_size_t, mp_limb_t)) __GMP_ATTRIBUTE_PURE;
01516 
01517 #define mpn_gcdext __MPN(gcdext)
01518 __GMP_DECLSPEC mp_size_t mpn_gcdext __GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t *, mp_ptr, mp_size_t, mp_ptr, mp_size_t));
01519 
01520 #define mpn_get_str __MPN(get_str)
01521 __GMP_DECLSPEC size_t mpn_get_str __GMP_PROTO ((unsigned char *, int, mp_ptr, mp_size_t));
01522 
01523 #define mpn_hamdist __MPN(hamdist)
01524 __GMP_DECLSPEC unsigned long int mpn_hamdist __GMP_PROTO ((mp_srcptr, mp_srcptr, mp_size_t)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
01525 
01526 #define mpn_lshift __MPN(lshift)
01527 __GMP_DECLSPEC mp_limb_t mpn_lshift __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, unsigned int));
01528 
01529 #define mpn_mod_1 __MPN(mod_1)
01530 __GMP_DECLSPEC mp_limb_t mpn_mod_1 __GMP_PROTO ((mp_srcptr, mp_size_t, mp_limb_t)) __GMP_ATTRIBUTE_PURE;
01531 
01532 #define mpn_mul __MPN(mul)
01533 __GMP_DECLSPEC mp_limb_t mpn_mul __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t));
01534 
01535 #define mpn_mul_1 __MPN(mul_1)
01536 __GMP_DECLSPEC mp_limb_t mpn_mul_1 __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t));
01537 
01538 #define mpn_mul_n __MPN(mul_n)
01539 __GMP_DECLSPEC void mpn_mul_n __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t));
01540 
01541 #define mpn_perfect_square_p __MPN(perfect_square_p)
01542 __GMP_DECLSPEC int mpn_perfect_square_p __GMP_PROTO ((mp_srcptr, mp_size_t)) __GMP_ATTRIBUTE_PURE;
01543 
01544 #define mpn_popcount __MPN(popcount)
01545 __GMP_DECLSPEC unsigned long int mpn_popcount __GMP_PROTO ((mp_srcptr, mp_size_t)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
01546 
01547 #define mpn_pow_1 __MPN(pow_1)
01548 __GMP_DECLSPEC mp_size_t mpn_pow_1 __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_ptr));
01549 
01550 /* undocumented now, but retained here for upward compatibility */
01551 #define mpn_preinv_mod_1 __MPN(preinv_mod_1)
01552 __GMP_DECLSPEC mp_limb_t mpn_preinv_mod_1 __GMP_PROTO ((mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t)) __GMP_ATTRIBUTE_PURE;
01553 
01554 #define mpn_random __MPN(random)
01555 __GMP_DECLSPEC void mpn_random __GMP_PROTO ((mp_ptr, mp_size_t));
01556 
01557 #define mpn_random2 __MPN(random2)
01558 __GMP_DECLSPEC void mpn_random2 __GMP_PROTO ((mp_ptr, mp_size_t));
01559 
01560 #define mpn_rshift __MPN(rshift)
01561 __GMP_DECLSPEC mp_limb_t mpn_rshift __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, unsigned int));
01562 
01563 #define mpn_scan0 __MPN(scan0)
01564 __GMP_DECLSPEC unsigned long int mpn_scan0 __GMP_PROTO ((mp_srcptr, unsigned long int)) __GMP_ATTRIBUTE_PURE;
01565 
01566 #define mpn_scan1 __MPN(scan1)
01567 __GMP_DECLSPEC unsigned long int mpn_scan1 __GMP_PROTO ((mp_srcptr, unsigned long int)) __GMP_ATTRIBUTE_PURE;
01568 
01569 #define mpn_set_str __MPN(set_str)
01570 __GMP_DECLSPEC mp_size_t mpn_set_str __GMP_PROTO ((mp_ptr, __gmp_const unsigned char *, size_t, int));
01571 
01572 #define mpn_sqrtrem __MPN(sqrtrem)
01573 __GMP_DECLSPEC mp_size_t mpn_sqrtrem __GMP_PROTO ((mp_ptr, mp_ptr, mp_srcptr, mp_size_t));
01574 
01575 #define mpn_sub __MPN(sub)
01576 #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpn_sub)
01577 __GMP_DECLSPEC mp_limb_t mpn_sub __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr,mp_size_t));
01578 #endif
01579 
01580 #define mpn_sub_1 __MPN(sub_1)
01581 #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpn_sub_1)
01582 __GMP_DECLSPEC mp_limb_t mpn_sub_1 __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t)) __GMP_NOTHROW;
01583 #endif
01584 
01585 #define mpn_sub_n __MPN(sub_n)
01586 __GMP_DECLSPEC mp_limb_t mpn_sub_n __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t));
01587 
01588 #define mpn_submul_1 __MPN(submul_1)
01589 __GMP_DECLSPEC mp_limb_t mpn_submul_1 __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t));
01590 
01591 #define mpn_tdiv_qr __MPN(tdiv_qr)
01592 __GMP_DECLSPEC void mpn_tdiv_qr __GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t));
01593 
01594 
01595 /**************** mpz inlines ****************/
01596 
01597 /* The following are provided as inlines where possible, but always exist as
01598    library functions too, for binary compatibility.
01599 
01600    Within gmp itself this inlining generally isn't relied on, since it
01601    doesn't get done for all compilers, whereas if something is worth
01602    inlining then it's worth arranging always.
01603 
01604    There are two styles of inlining here.  When the same bit of code is
01605    wanted for the inline as for the library version, then __GMP_FORCE_foo
01606    arranges for that code to be emitted and the __GMP_EXTERN_INLINE
01607    directive suppressed, eg. mpz_fits_uint_p.  When a different bit of code
01608    is wanted for the inline than for the library version, then
01609    __GMP_FORCE_foo arranges the inline to be suppressed, eg. mpz_abs.  */
01610 
01611 #if defined (__GMP_EXTERN_INLINE) && ! defined (__GMP_FORCE_mpz_abs)
01612 __GMP_EXTERN_INLINE void
01613 mpz_abs (mpz_ptr __gmp_w, mpz_srcptr __gmp_u)
01614 {
01615   if (__gmp_w != __gmp_u)
01616     mpz_set (__gmp_w, __gmp_u);
01617   __gmp_w->_mp_size = __GMP_ABS (__gmp_w->_mp_size);
01618 }
01619 #endif
01620 
01621 #if GMP_NAIL_BITS == 0
01622 #define __GMPZ_FITS_UTYPE_P(z,maxval)                                   \
01623   mp_size_t  __gmp_n = z->_mp_size;                                     \
01624   mp_ptr  __gmp_p = z->_mp_d;                                           \
01625   return (__gmp_n == 0 || (__gmp_n == 1 && __gmp_p[0] <= maxval));
01626 #else
01627 #define __GMPZ_FITS_UTYPE_P(z,maxval)                                   \
01628   mp_size_t  __gmp_n = z->_mp_size;                                     \
01629   mp_ptr  __gmp_p = z->_mp_d;                                           \
01630   return (__gmp_n == 0 || (__gmp_n == 1 && __gmp_p[0] <= maxval)        \
01631           || (__gmp_n == 2 && __gmp_p[1] <= ((mp_limb_t) maxval >> GMP_NUMB_BITS)));
01632 #endif
01633 
01634 #if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpz_fits_uint_p)
01635 #if ! defined (__GMP_FORCE_mpz_fits_uint_p)
01636 __GMP_EXTERN_INLINE
01637 #endif
01638 int
01639 mpz_fits_uint_p (mpz_srcptr __gmp_z) __GMP_NOTHROW
01640 {
01641   __GMPZ_FITS_UTYPE_P (__gmp_z, __GMP_UINT_MAX);
01642 }
01643 #endif
01644 
01645 #if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpz_fits_ulong_p)
01646 #if ! defined (__GMP_FORCE_mpz_fits_ulong_p)
01647 __GMP_EXTERN_INLINE
01648 #endif
01649 int
01650 mpz_fits_ulong_p (mpz_srcptr __gmp_z) __GMP_NOTHROW
01651 {
01652   __GMPZ_FITS_UTYPE_P (__gmp_z, __GMP_ULONG_MAX);
01653 }
01654 #endif
01655 
01656 #if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpz_fits_ushort_p)
01657 #if ! defined (__GMP_FORCE_mpz_fits_ushort_p)
01658 __GMP_EXTERN_INLINE
01659 #endif
01660 int
01661 mpz_fits_ushort_p (mpz_srcptr __gmp_z) __GMP_NOTHROW
01662 {
01663   __GMPZ_FITS_UTYPE_P (__gmp_z, __GMP_USHRT_MAX);
01664 }
01665 #endif
01666 
01667 #if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpz_get_ui)
01668 #if ! defined (__GMP_FORCE_mpz_get_ui)
01669 __GMP_EXTERN_INLINE
01670 #endif
01671 unsigned long
01672 mpz_get_ui (mpz_srcptr __gmp_z) __GMP_NOTHROW
01673 {
01674   mp_ptr __gmp_p = __gmp_z->_mp_d;
01675   mp_size_t __gmp_n = __gmp_z->_mp_size;
01676   mp_limb_t __gmp_l = __gmp_p[0];
01677   /* This is a "#if" rather than a plain "if" so as to avoid gcc warnings
01678      about "<< GMP_NUMB_BITS" exceeding the type size, and to avoid Borland
01679      C++ 6.0 warnings about condition always true for something like
01680      "__GMP_ULONG_MAX < GMP_NUMB_MASK".  */
01681 #if GMP_NAIL_BITS == 0 || defined (_LONG_LONG_LIMB)
01682   /* limb==long and no nails, or limb==longlong, one limb is enough */
01683   return (__gmp_n != 0 ? __gmp_l : 0);
01684 #else
01685   /* limb==long and nails, need two limbs when available */
01686   __gmp_n = __GMP_ABS (__gmp_n);
01687   if (__gmp_n <= 1)
01688     return (__gmp_n != 0 ? __gmp_l : 0);
01689   else
01690     return __gmp_l + (__gmp_p[1] << GMP_NUMB_BITS);
01691 #endif
01692 }
01693 #endif
01694 
01695 #if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpz_getlimbn)
01696 #if ! defined (__GMP_FORCE_mpz_getlimbn)
01697 __GMP_EXTERN_INLINE
01698 #endif
01699 mp_limb_t
01700 mpz_getlimbn (mpz_srcptr __gmp_z, mp_size_t __gmp_n) __GMP_NOTHROW
01701 {
01702   mp_limb_t  __gmp_result = 0;
01703   if (__GMP_LIKELY (__gmp_n >= 0 && __gmp_n < __GMP_ABS (__gmp_z->_mp_size)))
01704     __gmp_result = __gmp_z->_mp_d[__gmp_n];
01705   return __gmp_result;
01706 }
01707 #endif
01708 
01709 #if defined (__GMP_EXTERN_INLINE) && ! defined (__GMP_FORCE_mpz_neg)
01710 __GMP_EXTERN_INLINE void
01711 mpz_neg (mpz_ptr __gmp_w, mpz_srcptr __gmp_u)
01712 {
01713   if (__gmp_w != __gmp_u)
01714     mpz_set (__gmp_w, __gmp_u);
01715   __gmp_w->_mp_size = - __gmp_w->_mp_size;
01716 }
01717 #endif
01718 
01719 #if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpz_perfect_square_p)
01720 #if ! defined (__GMP_FORCE_mpz_perfect_square_p)
01721 __GMP_EXTERN_INLINE
01722 #endif
01723 int
01724 mpz_perfect_square_p (mpz_srcptr __gmp_a)
01725 {
01726   mp_size_t __gmp_asize;
01727   int       __gmp_result;
01728 
01729   __gmp_asize = __gmp_a->_mp_size;
01730   __gmp_result = (__gmp_asize >= 0);  /* zero is a square, negatives are not */
01731   if (__GMP_LIKELY (__gmp_asize > 0))
01732     __gmp_result = mpn_perfect_square_p (__gmp_a->_mp_d, __gmp_asize);
01733   return __gmp_result;
01734 }
01735 #endif
01736 
01737 #if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpz_popcount)
01738 #if ! defined (__GMP_FORCE_mpz_popcount)
01739 __GMP_EXTERN_INLINE
01740 #endif
01741 unsigned long
01742 mpz_popcount (mpz_srcptr __gmp_u) __GMP_NOTHROW
01743 {
01744   mp_size_t      __gmp_usize;
01745   unsigned long  __gmp_result;
01746 
01747   __gmp_usize = __gmp_u->_mp_size;
01748   __gmp_result = (__gmp_usize < 0 ? __GMP_ULONG_MAX : 0);
01749   if (__GMP_LIKELY (__gmp_usize > 0))
01750     __gmp_result =  mpn_popcount (__gmp_u->_mp_d, __gmp_usize);
01751   return __gmp_result;
01752 }
01753 #endif
01754 
01755 #if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpz_set_q)
01756 #if ! defined (__GMP_FORCE_mpz_set_q)
01757 __GMP_EXTERN_INLINE
01758 #endif
01759 void
01760 mpz_set_q (mpz_ptr __gmp_w, mpq_srcptr __gmp_u)
01761 {
01762   mpz_tdiv_q (__gmp_w, mpq_numref (__gmp_u), mpq_denref (__gmp_u));
01763 }
01764 #endif
01765 
01766 #if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpz_size)
01767 #if ! defined (__GMP_FORCE_mpz_size)
01768 __GMP_EXTERN_INLINE
01769 #endif
01770 size_t
01771 mpz_size (mpz_srcptr __gmp_z) __GMP_NOTHROW
01772 {
01773   return __GMP_ABS (__gmp_z->_mp_size);
01774 }
01775 #endif
01776 
01777 
01778 /**************** mpq inlines ****************/
01779 
01780 #if defined (__GMP_EXTERN_INLINE) && ! defined (__GMP_FORCE_mpq_abs)
01781 __GMP_EXTERN_INLINE void
01782 mpq_abs (mpq_ptr __gmp_w, mpq_srcptr __gmp_u)
01783 {
01784   if (__gmp_w != __gmp_u)
01785     mpq_set (__gmp_w, __gmp_u);
01786   __gmp_w->_mp_num._mp_size = __GMP_ABS (__gmp_w->_mp_num._mp_size);
01787 }
01788 #endif
01789 
01790 #if defined (__GMP_EXTERN_INLINE) && ! defined (__GMP_FORCE_mpq_neg)
01791 __GMP_EXTERN_INLINE void
01792 mpq_neg (mpq_ptr __gmp_w, mpq_srcptr __gmp_u)
01793 {
01794   if (__gmp_w != __gmp_u)
01795     mpq_set (__gmp_w, __gmp_u);
01796   __gmp_w->_mp_num._mp_size = - __gmp_w->_mp_num._mp_size;
01797 }
01798 #endif
01799 
01800 
01801 /**************** mpn inlines ****************/
01802 
01803 /* The comments with __GMPN_ADD_1 below apply here too.
01804 
01805    The test for FUNCTION returning 0 should predict well.  If it's assumed
01806    {yp,ysize} will usually have a random number of bits then the high limb
01807    won't be full and a carry out will occur a good deal less than 50% of the
01808    time.
01809 
01810    ysize==0 isn't a documented feature, but is used internally in a few
01811    places.
01812 
01813    Producing cout last stops it using up a register during the main part of
01814    the calculation, though gcc (as of 3.0) on an "if (mpn_add (...))"
01815    doesn't seem able to move the true and false legs of the conditional up
01816    to the two places cout is generated.  */
01817 
01818 #define __GMPN_AORS(cout, wp, xp, xsize, yp, ysize, FUNCTION, TEST)     \
01819   do {                                                                  \
01820     mp_size_t  __gmp_i;                                                 \
01821     mp_limb_t  __gmp_x;                                                 \
01822                                                                         \
01823     /* ASSERT ((ysize) >= 0); */                                        \
01824     /* ASSERT ((xsize) >= (ysize)); */                                  \
01825     /* ASSERT (MPN_SAME_OR_SEPARATE2_P (wp, xsize, xp, xsize)); */      \
01826     /* ASSERT (MPN_SAME_OR_SEPARATE2_P (wp, xsize, yp, ysize)); */      \
01827                                                                         \
01828     __gmp_i = (ysize);                                                  \
01829     if (__gmp_i != 0)                                                   \
01830       {                                                                 \
01831         if (FUNCTION (wp, xp, yp, __gmp_i))                             \
01832           {                                                             \
01833             do                                                          \
01834               {                                                         \
01835                 if (__gmp_i >= (xsize))                                 \
01836                   {                                                     \
01837                     (cout) = 1;                                         \
01838                     goto __gmp_done;                                    \
01839                   }                                                     \
01840                 __gmp_x = (xp)[__gmp_i];                                \
01841               }                                                         \
01842             while (TEST);                                               \
01843           }                                                             \
01844       }                                                                 \
01845     if ((wp) != (xp))                                                   \
01846       __GMPN_COPY_REST (wp, xp, xsize, __gmp_i);                        \
01847     (cout) = 0;                                                         \
01848   __gmp_done:                                                           \
01849     ;                                                                   \
01850   } while (0)
01851 
01852 #define __GMPN_ADD(cout, wp, xp, xsize, yp, ysize)              \
01853   __GMPN_AORS (cout, wp, xp, xsize, yp, ysize, mpn_add_n,       \
01854                (((wp)[__gmp_i++] = (__gmp_x + 1) & GMP_NUMB_MASK) == 0))
01855 #define __GMPN_SUB(cout, wp, xp, xsize, yp, ysize)              \
01856   __GMPN_AORS (cout, wp, xp, xsize, yp, ysize, mpn_sub_n,       \
01857                (((wp)[__gmp_i++] = (__gmp_x - 1) & GMP_NUMB_MASK), __gmp_x == 0))
01858 
01859 
01860 /* The use of __gmp_i indexing is designed to ensure a compile time src==dst
01861    remains nice and clear to the compiler, so that __GMPN_COPY_REST can
01862    disappear, and the load/add/store gets a chance to become a
01863    read-modify-write on CISC CPUs.
01864 
01865    Alternatives:
01866 
01867    Using a pair of pointers instead of indexing would be possible, but gcc
01868    isn't able to recognise compile-time src==dst in that case, even when the
01869    pointers are incremented more or less together.  Other compilers would
01870    very likely have similar difficulty.
01871 
01872    gcc could use "if (__builtin_constant_p(src==dst) && src==dst)" or
01873    similar to detect a compile-time src==dst.  This works nicely on gcc
01874    2.95.x, it's not good on gcc 3.0 where __builtin_constant_p(p==p) seems
01875    to be always false, for a pointer p.  But the current code form seems
01876    good enough for src==dst anyway.
01877 
01878    gcc on x86 as usual doesn't give particularly good flags handling for the
01879    carry/borrow detection.  It's tempting to want some multi instruction asm
01880    blocks to help it, and this was tried, but in truth there's only a few
01881    instructions to save and any gain is all too easily lost by register
01882    juggling setting up for the asm.  */
01883 
01884 #if GMP_NAIL_BITS == 0
01885 #define __GMPN_AORS_1(cout, dst, src, n, v, OP, CB)             \
01886   do {                                                          \
01887     mp_size_t  __gmp_i;                                         \
01888     mp_limb_t  __gmp_x, __gmp_r;                                \
01889                                                                 \
01890     /* ASSERT ((n) >= 1); */                                    \
01891     /* ASSERT (MPN_SAME_OR_SEPARATE_P (dst, src, n)); */        \
01892                                                                 \
01893     __gmp_x = (src)[0];                                         \
01894     __gmp_r = __gmp_x OP (v);                                   \
01895     (dst)[0] = __gmp_r;                                         \
01896     if (CB (__gmp_r, __gmp_x, (v)))                             \
01897       {                                                         \
01898         (cout) = 1;                                             \
01899         for (__gmp_i = 1; __gmp_i < (n);)                       \
01900           {                                                     \
01901             __gmp_x = (src)[__gmp_i];                           \
01902             __gmp_r = __gmp_x OP 1;                             \
01903             (dst)[__gmp_i] = __gmp_r;                           \
01904             ++__gmp_i;                                          \
01905             if (!CB (__gmp_r, __gmp_x, 1))                      \
01906               {                                                 \
01907                 if ((src) != (dst))                             \
01908                   __GMPN_COPY_REST (dst, src, n, __gmp_i);      \
01909                 (cout) = 0;                                     \
01910                 break;                                          \
01911               }                                                 \
01912           }                                                     \
01913       }                                                         \
01914     else                                                        \
01915       {                                                         \
01916         if ((src) != (dst))                                     \
01917           __GMPN_COPY_REST (dst, src, n, 1);                    \
01918         (cout) = 0;                                             \
01919       }                                                         \
01920   } while (0)
01921 #endif
01922 
01923 #if GMP_NAIL_BITS >= 1
01924 #define __GMPN_AORS_1(cout, dst, src, n, v, OP, CB)             \
01925   do {                                                          \
01926     mp_size_t  __gmp_i;                                         \
01927     mp_limb_t  __gmp_x, __gmp_r;                                \
01928                                                                 \
01929     /* ASSERT ((n) >= 1); */                                    \
01930     /* ASSERT (MPN_SAME_OR_SEPARATE_P (dst, src, n)); */        \
01931                                                                 \
01932     __gmp_x = (src)[0];                                         \
01933     __gmp_r = __gmp_x OP (v);                                   \
01934     (dst)[0] = __gmp_r & GMP_NUMB_MASK;                         \
01935     if (__gmp_r >> GMP_NUMB_BITS != 0)                          \
01936       {                                                         \
01937         (cout) = 1;                                             \
01938         for (__gmp_i = 1; __gmp_i < (n);)                       \
01939           {                                                     \
01940             __gmp_x = (src)[__gmp_i];                           \
01941             __gmp_r = __gmp_x OP 1;                             \
01942             (dst)[__gmp_i] = __gmp_r & GMP_NUMB_MASK;           \
01943             ++__gmp_i;                                          \
01944             if (__gmp_r >> GMP_NUMB_BITS == 0)                  \
01945               {                                                 \
01946                 if ((src) != (dst))                             \
01947                   __GMPN_COPY_REST (dst, src, n, __gmp_i);      \
01948                 (cout) = 0;                                     \
01949                 break;                                          \
01950               }                                                 \
01951           }                                                     \
01952       }                                                         \
01953     else                                                        \
01954       {                                                         \
01955         if ((src) != (dst))                                     \
01956           __GMPN_COPY_REST (dst, src, n, 1);                    \
01957         (cout) = 0;                                             \
01958       }                                                         \
01959   } while (0)
01960 #endif
01961 
01962 #define __GMPN_ADDCB(r,x,y) ((r) < (y))
01963 #define __GMPN_SUBCB(r,x,y) ((x) < (y))
01964 
01965 #define __GMPN_ADD_1(cout, dst, src, n, v)           \
01966   __GMPN_AORS_1(cout, dst, src, n, v, +, __GMPN_ADDCB)
01967 #define __GMPN_SUB_1(cout, dst, src, n, v)           \
01968   __GMPN_AORS_1(cout, dst, src, n, v, -, __GMPN_SUBCB)
01969 
01970 
01971 /* Compare {xp,size} and {yp,size}, setting "result" to positive, zero or
01972    negative.  size==0 is allowed.  On random data usually only one limb will
01973    need to be examined to get a result, so it's worth having it inline.  */
01974 #define __GMPN_CMP(result, xp, yp, size)                                \
01975   do {                                                                  \
01976     mp_size_t  __gmp_i;                                                 \
01977     mp_limb_t  __gmp_x, __gmp_y;                                        \
01978                                                                         \
01979     /* ASSERT ((size) >= 0); */                                         \
01980                                                                         \
01981     (result) = 0;                                                       \
01982     __gmp_i = (size);                                                   \
01983     while (--__gmp_i >= 0)                                              \
01984       {                                                                 \
01985         __gmp_x = (xp)[__gmp_i];                                        \
01986         __gmp_y = (yp)[__gmp_i];                                        \
01987         if (__gmp_x != __gmp_y)                                         \
01988           {                                                             \
01989             /* Cannot use __gmp_x - __gmp_y, may overflow an "int" */   \
01990             (result) = (__gmp_x > __gmp_y ? 1 : -1);                    \
01991             break;                                                      \
01992           }                                                             \
01993       }                                                                 \
01994   } while (0)
01995 
01996 
01997 #if defined (__GMPN_COPY) && ! defined (__GMPN_COPY_REST)
01998 #define __GMPN_COPY_REST(dst, src, size, start)                 \
01999   do {                                                          \
02000     /* ASSERT ((start) >= 0); */                                \
02001     /* ASSERT ((start) <= (size)); */                           \
02002     __GMPN_COPY ((dst)+(start), (src)+(start), (size)-(start)); \
02003   } while (0)
02004 #endif
02005 
02006 /* Copy {src,size} to {dst,size}, starting at "start".  This is designed to
02007    keep the indexing dst[j] and src[j] nice and simple for __GMPN_ADD_1,
02008    __GMPN_ADD, etc.  */
02009 #if ! defined (__GMPN_COPY_REST)
02010 #define __GMPN_COPY_REST(dst, src, size, start)                 \
02011   do {                                                          \
02012     mp_size_t __gmp_j;                                          \
02013     /* ASSERT ((size) >= 0); */                                 \
02014     /* ASSERT ((start) >= 0); */                                \
02015     /* ASSERT ((start) <= (size)); */                           \
02016     /* ASSERT (MPN_SAME_OR_SEPARATE_P (dst, src, size)); */     \
02017     __GMP_CRAY_Pragma ("_CRI ivdep");                           \
02018     for (__gmp_j = (start); __gmp_j < (size); __gmp_j++)        \
02019       (dst)[__gmp_j] = (src)[__gmp_j];                          \
02020   } while (0)
02021 #endif
02022 
02023 /* Enhancement: Use some of the smarter code from gmp-impl.h.  Maybe use
02024    mpn_copyi if there's a native version, and if we don't mind demanding
02025    binary compatibility for it (on targets which use it).  */
02026 
02027 #if ! defined (__GMPN_COPY)
02028 #define __GMPN_COPY(dst, src, size)   __GMPN_COPY_REST (dst, src, size, 0)
02029 #endif
02030 
02031 
02032 #if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpn_add)
02033 #if ! defined (__GMP_FORCE_mpn_add)
02034 __GMP_EXTERN_INLINE
02035 #endif
02036 mp_limb_t
02037 mpn_add (mp_ptr __gmp_wp, mp_srcptr __gmp_xp, mp_size_t __gmp_xsize, mp_srcptr __gmp_yp, mp_size_t __gmp_ysize)
02038 {
02039   mp_limb_t  __gmp_c;
02040   __GMPN_ADD (__gmp_c, __gmp_wp, __gmp_xp, __gmp_xsize, __gmp_yp, __gmp_ysize);
02041   return __gmp_c;
02042 }
02043 #endif
02044 
02045 #if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpn_add_1)
02046 #if ! defined (__GMP_FORCE_mpn_add_1)
02047 __GMP_EXTERN_INLINE
02048 #endif
02049 mp_limb_t
02050 mpn_add_1 (mp_ptr __gmp_dst, mp_srcptr __gmp_src, mp_size_t __gmp_size, mp_limb_t __gmp_n) __GMP_NOTHROW
02051 {
02052   mp_limb_t  __gmp_c;
02053   __GMPN_ADD_1 (__gmp_c, __gmp_dst, __gmp_src, __gmp_size, __gmp_n);
02054   return __gmp_c;
02055 }
02056 #endif
02057 
02058 #if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpn_cmp)
02059 #if ! defined (__GMP_FORCE_mpn_cmp)
02060 __GMP_EXTERN_INLINE
02061 #endif
02062 int
02063 mpn_cmp (mp_srcptr __gmp_xp, mp_srcptr __gmp_yp, mp_size_t __gmp_size) __GMP_NOTHROW
02064 {
02065   int __gmp_result;
02066   __GMPN_CMP (__gmp_result, __gmp_xp, __gmp_yp, __gmp_size);
02067   return __gmp_result;
02068 }
02069 #endif
02070 
02071 #if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpn_sub)
02072 #if ! defined (__GMP_FORCE_mpn_sub)
02073 __GMP_EXTERN_INLINE
02074 #endif
02075 mp_limb_t
02076 mpn_sub (mp_ptr __gmp_wp, mp_srcptr __gmp_xp, mp_size_t __gmp_xsize, mp_srcptr __gmp_yp, mp_size_t __gmp_ysize)
02077 {
02078   mp_limb_t  __gmp_c;
02079   __GMPN_SUB (__gmp_c, __gmp_wp, __gmp_xp, __gmp_xsize, __gmp_yp, __gmp_ysize);
02080   return __gmp_c;
02081 }
02082 #endif
02083 
02084 #if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpn_sub_1)
02085 #if ! defined (__GMP_FORCE_mpn_sub_1)
02086 __GMP_EXTERN_INLINE
02087 #endif
02088 mp_limb_t
02089 mpn_sub_1 (mp_ptr __gmp_dst, mp_srcptr __gmp_src, mp_size_t __gmp_size, mp_limb_t __gmp_n) __GMP_NOTHROW
02090 {
02091   mp_limb_t  __gmp_c;
02092   __GMPN_SUB_1 (__gmp_c, __gmp_dst, __gmp_src, __gmp_size, __gmp_n);
02093   return __gmp_c;
02094 }
02095 #endif
02096 
02097 #if defined (__cplusplus)
02098 }
02099 #endif
02100 
02101 
02102 /* Allow faster testing for negative, zero, and positive.  */
02103 #define mpz_sgn(Z) ((Z)->_mp_size < 0 ? -1 : (Z)->_mp_size > 0)
02104 #define mpf_sgn(F) ((F)->_mp_size < 0 ? -1 : (F)->_mp_size > 0)
02105 #define mpq_sgn(Q) ((Q)->_mp_num._mp_size < 0 ? -1 : (Q)->_mp_num._mp_size > 0)
02106 
02107 /* When using GCC, optimize certain common comparisons.  */
02108 #if defined (__GNUC__)
02109 #define mpz_cmp_ui(Z,UI) \
02110   (__builtin_constant_p (UI) && (UI) == 0                               \
02111    ? mpz_sgn (Z) : _mpz_cmp_ui (Z,UI))
02112 #define mpz_cmp_si(Z,SI) \
02113   (__builtin_constant_p (SI) && (SI) == 0 ? mpz_sgn (Z)                 \
02114    : __builtin_constant_p (SI) && (SI) > 0                              \
02115     ? _mpz_cmp_ui (Z, __GMP_CAST (unsigned long int, SI))               \
02116    : _mpz_cmp_si (Z,SI))
02117 #define mpq_cmp_ui(Q,NUI,DUI) \
02118   (__builtin_constant_p (NUI) && (NUI) == 0                             \
02119    ? mpq_sgn (Q) : _mpq_cmp_ui (Q,NUI,DUI))
02120 #define mpq_cmp_si(q,n,d)                       \
02121   (__builtin_constant_p ((n) >= 0) && (n) >= 0  \
02122    ? mpq_cmp_ui (q, __GMP_CAST (unsigned long, n), d) \
02123    : _mpq_cmp_si (q, n, d))
02124 #else
02125 #define mpz_cmp_ui(Z,UI) _mpz_cmp_ui (Z,UI)
02126 #define mpz_cmp_si(Z,UI) _mpz_cmp_si (Z,UI)
02127 #define mpq_cmp_ui(Q,NUI,DUI) _mpq_cmp_ui (Q,NUI,DUI)
02128 #define mpq_cmp_si(q,n,d)  _mpq_cmp_si(q,n,d)
02129 #endif
02130 
02131 
02132 /* Using "&" rather than "&&" means these can come out branch-free.  Every
02133    mpz_t has at least one limb allocated, so fetching the low limb is always
02134    allowed.  */
02135 #define mpz_odd_p(z)   (((z)->_mp_size != 0) & __GMP_CAST (int, (z)->_mp_d[0]))
02136 #define mpz_even_p(z)  (! mpz_odd_p (z))
02137 
02138 
02139 /**************** C++ routines ****************/
02140 
02141 #ifdef __cplusplus
02142 __GMP_DECLSPEC_XX std::ostream& operator<< (std::ostream &, mpz_srcptr);
02143 __GMP_DECLSPEC_XX std::ostream& operator<< (std::ostream &, mpq_srcptr);
02144 __GMP_DECLSPEC_XX std::ostream& operator<< (std::ostream &, mpf_srcptr);
02145 __GMP_DECLSPEC_XX std::istream& operator>> (std::istream &, mpz_ptr);
02146 __GMP_DECLSPEC_XX std::istream& operator>> (std::istream &, mpq_ptr);
02147 __GMP_DECLSPEC_XX std::istream& operator>> (std::istream &, mpf_ptr);
02148 #endif
02149 
02150 
02151 /* Source-level compatibility with GMP 2 and earlier. */
02152 #define mpn_divmod(qp,np,nsize,dp,dsize) \
02153   mpn_divrem (qp, __GMP_CAST (mp_size_t, 0), np, nsize, dp, dsize)
02154 
02155 /* Source-level compatibility with GMP 1.  */
02156 #define mpz_mdiv        mpz_fdiv_q
02157 #define mpz_mdivmod     mpz_fdiv_qr
02158 #define mpz_mmod        mpz_fdiv_r
02159 #define mpz_mdiv_ui     mpz_fdiv_q_ui
02160 #define mpz_mdivmod_ui(q,r,n,d) \
02161   (((r) == 0) ? mpz_fdiv_q_ui (q,n,d) : mpz_fdiv_qr_ui (q,r,n,d))
02162 #define mpz_mmod_ui(r,n,d) \
02163   (((r) == 0) ? mpz_fdiv_ui (n,d) : mpz_fdiv_r_ui (r,n,d))
02164 
02165 /* Useful synonyms, but not quite compatible with GMP 1.  */
02166 #define mpz_div         mpz_fdiv_q
02167 #define mpz_divmod      mpz_fdiv_qr
02168 #define mpz_div_ui      mpz_fdiv_q_ui
02169 #define mpz_divmod_ui   mpz_fdiv_qr_ui
02170 #define mpz_div_2exp    mpz_fdiv_q_2exp
02171 #define mpz_mod_2exp    mpz_fdiv_r_2exp
02172 
02173 enum
02174 {
02175   GMP_ERROR_NONE = 0,
02176   GMP_ERROR_UNSUPPORTED_ARGUMENT = 1,
02177   GMP_ERROR_DIVISION_BY_ZERO = 2,
02178   GMP_ERROR_SQRT_OF_NEGATIVE = 4,
02179   GMP_ERROR_INVALID_ARGUMENT = 8
02180 };
02181 
02182 /* Define CC and CFLAGS which were used to build this version of GMP */
02183 #define __GMP_CC "@CC@"
02184 #define __GMP_CFLAGS "@CFLAGS@"
02185 
02186 /* Major version number is the value of __GNU_MP__ too, above and in mp.h. */
02187 #define __GNU_MP_VERSION 4
02188 #define __GNU_MP_VERSION_MINOR 2
02189 #define __GNU_MP_VERSION_PATCHLEVEL 4
02190 
02191 #define __GMP_H__
02192 #endif /* __GMP_H__ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines