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