w32tex
About: TeX Live provides a comprehensive TeX system including all the major TeX-related programs, macro packages, and fonts that are free software. Windows sources.
  Fossies Dox: w32tex-src.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

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