1
/* Definitions for GNU multiple precision functions. -*- mode: c -*-
3
Copyright 1991, 1993, 1994, 1995, 1996, 1997, 1999, 2000, 2001, 2002
4
Free Software Foundation, Inc.
6
This file is part of the GNU MP Library.
8
The GNU MP Library is free software; you can redistribute it and/or modify
9
it under the terms of the GNU Lesser General Public License as published by
10
the Free Software Foundation; either version 2.1 of the License, or (at your
11
option) any later version.
13
The GNU MP Library is distributed in the hope that it will be useful, but
14
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
16
License for more details.
18
You should have received a copy of the GNU Lesser General Public License
19
along with the GNU MP Library; see the file COPYING.LIB. If not, write to
20
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
21
MA 02111-1307, USA. */
26
/* Instantiated by configure, for internal use only. */
27
#if ! __GMP_WITHIN_CONFIGURE
28
#define __GMP_BITS_PER_MP_LIMB @__GMP_BITS_PER_MP_LIMB@
29
#define __GMP_HAVE_HOST_CPU_FAMILY_power @__GMP_HAVE_HOST_CPU_FAMILY_power@
30
#define __GMP_HAVE_HOST_CPU_FAMILY_powerpc @__GMP_HAVE_HOST_CPU_FAMILY_powerpc@
34
/* The following (everything under ifndef __GNU_MP__) must be identical in
35
gmp.h and mp.h to allow both to be included in an application or during
44
/* Instantiated by configure, for internal use only */
45
#if ! __GMP_WITHIN_CONFIGURE
48
/* Whether static, shared or both has been built. */
49
#define __GMP_LIBGMP_STATIC @__GMP_LIBGMP_STATIC@
50
#define __GMP_LIBGMP_SHARED @__GMP_LIBGMP_SHARED@
54
/* __STDC__ - some ANSI compilers define this only to 0, hence the use of
55
"defined" and not "__STDC__-0". In particular Sun workshop C 5.0
56
sets __STDC__ to 0, but requires "##" for token pasting.
58
_AIX - gnu ansidecl.h asserts that all known AIX compilers are ANSI but
59
don't always define __STDC__.
61
_mips - gnu ansidecl.h says the RISC/OS MIPS compiler is ANSI in SVR4
62
mode, but doesn't define __STDC__.
64
_MSC_VER - Microsoft C is ANSI, but __STDC__ is undefined unless the /Za
65
option is given (in which case it's 1).
67
_WIN32 - tested for by gnu ansidecl.h, no doubt on the assumption that
68
all w32 compilers are ansi. */
70
#if defined (__STDC__) \
71
|| defined (__cplusplus) \
74
|| (defined (__mips) && defined (_SYSTYPE_SVR4)) \
75
|| defined (_MSC_VER) \
77
#define __GMP_HAVE_CONST 1
78
#define __GMP_HAVE_PROTOTYPES 1
79
#define __GMP_HAVE_TOKEN_PASTE 1
81
#define __GMP_HAVE_CONST 0
82
#define __GMP_HAVE_PROTOTYPES 0
83
#define __GMP_HAVE_TOKEN_PASTE 0
88
#define __gmp_const const
89
#define __gmp_signed signed
96
/* __GMP_DECLSPEC marks a function or variable for import or export for a
97
windows DLL, or is empty on other systems.
99
When building GMP, libtool gives us DLL_EXPORT when making objects that
100
will go into a DLL and hence should have export directives. Notice
101
DLL_EXPORT is only tested under __GMP_WITHIN_GMP, since if some other
102
libtool based package is using gmp.h then DLL_EXPORT will be telling it
105
When compiling an application, __GMP_LIBGMP_SHARED indicates whether the
106
installed GMP is a DLL or not. For a DLL we use import directives.
108
There's no attempt here to support GMP installed both static and DLL,
109
doing so would mean applications would have to tell us which of the two
110
is going to be used, and that seems very tedious and error prone when
111
using GMP by hand, and equally tedious from a package since autoconf and
112
automake don't give much help.
114
Note that __GMP_DECLSPEC is only wanted on documented global functions
115
and variables. Internals in gmp-impl.h etc should be left unadorned and
116
won't be visible to applications using a DLL.
118
For testing on a non-windows system, __GMP_DECLSPEC can be set to
119
__attribute__ ((section ("foo"))) or similar, and the resulting objects
120
checked with readelf or whatever to see if all the expected globals have
121
ended up with that attribute.
123
PORTME: What does Borland use? */
125
#if defined (__GNUC__) || defined (_MSC_VER)
126
#define __GMP_DECLSPEC_EXPORT __declspec(dllexport)
127
#define __GMP_DECLSPEC_IMPORT __declspec(dllimport)
130
#define __GMP_DECLSPEC_EXPORT __export
131
#define __GMP_DECLSPEC_IMPORT __import
134
#define __GMP_DECLSPEC_EXPORT _Export
135
#define __GMP_DECLSPEC_IMPORT _Import
140
#define __GMP_DECLSPEC __GMP_DECLSPEC_EXPORT
143
#if defined (_WIN32) && __GMP_LIBGMP_SHARED
144
#define __GMP_DECLSPEC __GMP_DECLSPEC_IMPORT
148
#ifndef __GMP_DECLSPEC
149
#define __GMP_DECLSPEC
154
typedef unsigned int mp_limb_t;
155
typedef int mp_limb_signed_t;
157
#ifdef _LONG_LONG_LIMB
158
typedef unsigned long long int mp_limb_t;
159
typedef long long int mp_limb_signed_t;
161
typedef unsigned long int mp_limb_t;
162
typedef long int mp_limb_signed_t;
166
typedef mp_limb_t * mp_ptr;
167
typedef __gmp_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;
174
#define __GMP_MP_SIZE_T_INT 0
175
typedef long int mp_size_t;
176
typedef long int mp_exp_t;
181
int _mp_alloc; /* Number of *limbs* allocated and pointed
182
to by the _mp_d field. */
183
int _mp_size; /* abs(_mp_size) is the number of limbs the
184
last field points to. If _mp_size is
185
negative this is a negative number. */
186
mp_limb_t *_mp_d; /* Pointer to the limbs. */
188
#endif /* __GNU_MP__ */
190
typedef __mpz_struct MP_INT;
191
typedef __mpz_struct mpz_t[1];
195
__mpz_struct _mp_num;
196
__mpz_struct _mp_den;
199
typedef __mpq_struct MP_RAT;
200
typedef __mpq_struct mpq_t[1];
204
int _mp_prec; /* Max precision, in number of `mp_limb_t's.
205
Set by mpf_init and modified by
206
mpf_set_prec. The area pointed to by the
207
_mp_d field contains `prec' + 1 limbs. */
208
int _mp_size; /* abs(_mp_size) is the number of limbs the
209
last field points to. If _mp_size is
210
negative this is a negative number. */
211
mp_exp_t _mp_exp; /* Exponent, in the base of `mp_limb_t'. */
212
mp_limb_t *_mp_d; /* Pointer to the limbs. */
215
/* typedef __mpf_struct MP_FLOAT; */
216
typedef __mpf_struct mpf_t[1];
218
/* Available random number generation algorithms. */
221
GMP_RAND_ALG_DEFAULT = 0,
222
GMP_RAND_ALG_LC = GMP_RAND_ALG_DEFAULT /* Linear congruential. */
225
/* Linear congruential data struct. */
227
mpz_t _mp_a; /* Multiplier. */
228
unsigned long int _mp_c; /* Adder. */
229
mpz_t _mp_m; /* Modulus (valid only if m2exp == 0). */
230
unsigned long int _mp_m2exp; /* If != 0, modulus is 2 ^ m2exp. */
233
/* Random state struct. */
236
mpz_t _mp_seed; /* Current seed. */
237
gmp_randalg_t _mp_alg; /* Algorithm used. */
238
union { /* Algorithm specific data. */
239
__gmp_randata_lc *_mp_lc; /* Linear congruential. */
241
} __gmp_randstate_struct;
242
typedef __gmp_randstate_struct gmp_randstate_t[1];
244
/* Types for function declarations in gmp files. */
245
/* ??? Should not pollute user name space with these ??? */
246
typedef __gmp_const __mpz_struct *mpz_srcptr;
247
typedef __mpz_struct *mpz_ptr;
248
typedef __gmp_const __mpf_struct *mpf_srcptr;
249
typedef __mpf_struct *mpf_ptr;
250
typedef __gmp_const __mpq_struct *mpq_srcptr;
251
typedef __mpq_struct *mpq_ptr;
254
#if __GMP_HAVE_PROTOTYPES
262
#if __GMP_HAVE_TOKEN_PASTE
263
#define __MPN(x) __gmpn_##x
265
#define __MPN(x) __gmpn_/**/x
270
|| defined (H_STDIO) \
271
|| defined (_H_STDIO) /* AIX */ \
272
|| defined (_STDIO_H) /* glibc, Sun, SCO */ \
273
|| defined (_STDIO_H_) /* BSD, OSF */ \
274
|| defined (__STDIO_H__) /* IRIX */ \
275
|| defined (_STDIO_INCLUDED) /* HPUX */ \
276
|| defined (__dj_include_stdio_h_) /* DJGPP */ \
277
|| defined (_FILE_DEFINED) /* Microsoft */ \
278
|| defined (__STDIO__) /* Apple MPW MrC */
279
#define _GMP_H_HAVE_FILE 1
282
/* In ISO C, if a prototype involving "struct obstack *" is given without
283
that structure defined, then the struct is scoped down to just the
284
prototype, causing a conflict if it's subsequently defined for real. So
285
only give prototypes if we've got obstack.h. */
286
#if defined (_OBSTACK_H) /* glibc <obstack.h> */
287
#define _GMP_H_HAVE_OBSTACK 1
290
/* The prototypes for gmp_vprintf etc are provided only if va_list is
291
available, via an application having included <stdarg.h> or <varargs.h>.
292
Usually va_list is a typedef so can't be tested directly, but va_start is
293
almost certainly a macro, so look for that.
295
<stdio.h> will define some sort of va_list for vprintf and vfprintf, but
296
let's not bother trying to use that since it's not standard and since
297
application uses for gmp_vprintf etc will almost certainly require the
298
whole <stdarg.h> or <varargs.h> anyway. */
301
#define _GMP_H_HAVE_VA_LIST 1
304
/* Test for gcc >= maj.min, as per __GNUC_PREREQ in glibc */
305
#if defined (__GNUC__) && defined (__GNUC_MINOR__)
306
#define __GMP_GNUC_PREREQ(maj, min) \
307
((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
309
#define __GMP_GNUC_PREREQ(maj, min) 0
312
/* "pure" is in gcc 2.96 and up, see "(gcc)Function Attributes". Basically
313
it means a function does nothing but examine its arguments and memory
314
(global or via arguments) to generate a return value, but changes nothing
315
and has no side-effects. */
316
#if __GMP_GNUC_PREREQ (2,96)
317
#define __GMP_ATTRIBUTE_PURE __attribute__ ((__pure__))
319
#define __GMP_ATTRIBUTE_PURE
323
/* PORTME: What other compilers have a useful "extern inline"? "static
324
inline" would be an acceptable substitute if the compiler (or linker)
325
discards unused statics. */
327
/* gcc has __inline__ in all modes, including strict ansi. Give a prototype
328
for an inline too, so as to correctly specify "dllimport" on windows, in
329
case the function is called rather than inlined. */
331
#define __GMP_EXTERN_INLINE extern __inline__
332
#define __GMP_INLINE_PROTOTYPES 1
335
/* SCO OpenUNIX 8 cc supports "static inline foo()" but not in -Xc strict
336
ANSI mode (__STDC__ is 1 in that mode). Inlining only actually takes
337
place under -O. Without -O "foo" seems to be emitted whether it's used
338
or not, which is wasteful. "extern inline foo()" isn't useful, the
339
"extern" is apparently ignored, so foo is inlined if possible but also
340
emitted as a global, which causes multiple definition errors when
341
building a shared libgmp. */
342
#if __SCO_VERSION__ > 400000000 && __STDC__ != 1 \
343
&& ! defined (__GMP_EXTERN_INLINE)
344
#define __GMP_EXTERN_INLINE static inline
347
/* C++ always has "inline" and since it's a normal feature the linker should
348
discard duplicate non-inlined copies, or if it doesn't then that's a
349
problem for everyone, not just GMP. */
350
#if defined (__cplusplus) && ! defined (__GMP_EXTERN_INLINE)
351
#define __GMP_EXTERN_INLINE inline
354
/* By default, don't give a prototype when there's going to be an inline
355
version. Note in particular that Cray C++ objects to the combination of
356
prototype and inline. */
357
#ifdef __GMP_EXTERN_INLINE
358
#ifndef __GMP_INLINE_PROTOTYPES
359
#define __GMP_INLINE_PROTOTYPES 0
362
#define __GMP_INLINE_PROTOTYPES 1
366
#define __GMP_ABS(x) ((x) >= 0 ? (x) : -(x))
367
#define __GMP_MAX(h,i) ((h) > (i) ? (h) : (i))
369
#define __GMP_UINT_MAX (~ (unsigned) 0)
370
#define __GMP_ULONG_MAX (~ (unsigned long) 0)
371
#define __GMP_USHRT_MAX ((unsigned short) ~0)
374
/* Allow direct user access to numerator and denominator of a mpq_t object. */
375
#define mpq_numref(Q) (&((Q)->_mp_num))
376
#define mpq_denref(Q) (&((Q)->_mp_den))
379
#if defined (__cplusplus)
383
#define mp_set_memory_functions __gmp_set_memory_functions
384
__GMP_DECLSPEC void mp_set_memory_functions _PROTO ((void *(*) (size_t),
385
void *(*) (void *, size_t, size_t),
386
void (*) (void *, size_t)));
388
#define mp_bits_per_limb __gmp_bits_per_limb
389
__GMP_DECLSPEC extern __gmp_const int mp_bits_per_limb;
391
/* the following for internal use only */
392
__GMP_DECLSPEC extern void * (*__gmp_allocate_func) _PROTO ((size_t));
393
__GMP_DECLSPEC extern void * (*__gmp_reallocate_func) _PROTO ((void *, size_t, size_t));
394
__GMP_DECLSPEC extern void (*__gmp_free_func) _PROTO ((void *, size_t));
397
/**************** Random number routines. ****************/
400
#define gmp_randinit __gmp_randinit
401
__GMP_DECLSPEC void gmp_randinit _PROTO ((gmp_randstate_t, gmp_randalg_t, ...));
403
#define gmp_randinit_default __gmp_randinit_default
404
__GMP_DECLSPEC void gmp_randinit_default _PROTO ((gmp_randstate_t));
406
#define gmp_randinit_lc __gmp_randinit_lc
407
__GMP_DECLSPEC void gmp_randinit_lc _PROTO ((gmp_randstate_t,
408
mpz_srcptr, unsigned long int, mpz_srcptr));
410
#define gmp_randinit_lc_2exp __gmp_randinit_lc_2exp
411
__GMP_DECLSPEC void gmp_randinit_lc_2exp _PROTO ((gmp_randstate_t,
412
mpz_srcptr, unsigned long int,
415
#define gmp_randinit_lc_2exp_size __gmp_randinit_lc_2exp_size
416
__GMP_DECLSPEC int gmp_randinit_lc_2exp_size _PROTO ((gmp_randstate_t, unsigned long));
418
#define gmp_randseed __gmp_randseed
419
__GMP_DECLSPEC void gmp_randseed _PROTO ((gmp_randstate_t, mpz_srcptr));
421
#define gmp_randseed_ui __gmp_randseed_ui
422
__GMP_DECLSPEC void gmp_randseed_ui _PROTO ((gmp_randstate_t, unsigned long int));
424
#define gmp_randclear __gmp_randclear
425
__GMP_DECLSPEC void gmp_randclear _PROTO ((gmp_randstate_t));
428
/**************** Formatted output routines. ****************/
430
#define gmp_asprintf __gmp_asprintf
431
__GMP_DECLSPEC int gmp_asprintf _PROTO ((char **, const char *, ...));
433
#define gmp_fprintf __gmp_fprintf
435
__GMP_DECLSPEC int gmp_fprintf _PROTO ((FILE *, const char *, ...));
438
#define gmp_obstack_printf __gmp_obstack_printf
439
#if _GMP_H_HAVE_OBSTACK
440
__GMP_DECLSPEC int gmp_obstack_printf _PROTO ((struct obstack *, const char *, ...));
443
#define gmp_obstack_vprintf __gmp_obstack_vprintf
444
#if _GMP_H_HAVE_OBSTACK && _GMP_H_HAVE_VA_LIST
445
__GMP_DECLSPEC int gmp_obstack_vprintf _PROTO ((struct obstack *, const char *, va_list));
448
#define gmp_printf __gmp_printf
449
__GMP_DECLSPEC int gmp_printf _PROTO ((const char *, ...));
451
#define gmp_snprintf __gmp_snprintf
452
__GMP_DECLSPEC int gmp_snprintf _PROTO ((char *, size_t, const char *, ...));
454
#define gmp_sprintf __gmp_sprintf
455
__GMP_DECLSPEC int gmp_sprintf _PROTO ((char *, const char *, ...));
457
#define gmp_vasprintf __gmp_vasprintf
458
#if _GMP_H_HAVE_VA_LIST
459
__GMP_DECLSPEC int gmp_vasprintf _PROTO ((char **, const char *, va_list));
462
#define gmp_vfprintf __gmp_vfprintf
463
#if _GMP_H_HAVE_FILE && _GMP_H_HAVE_VA_LIST
464
__GMP_DECLSPEC int gmp_vfprintf _PROTO ((FILE *, const char *, va_list));
467
#define gmp_vprintf __gmp_vprintf
468
#if _GMP_H_HAVE_VA_LIST
469
__GMP_DECLSPEC int gmp_vprintf _PROTO ((const char *, va_list));
472
#define gmp_vsnprintf __gmp_vsnprintf
473
#if _GMP_H_HAVE_VA_LIST
474
__GMP_DECLSPEC int gmp_vsnprintf _PROTO ((char *, size_t, const char *, va_list));
477
#define gmp_vsprintf __gmp_vsprintf
478
#if _GMP_H_HAVE_VA_LIST
479
__GMP_DECLSPEC int gmp_vsprintf _PROTO ((char *, const char *, va_list));
483
/**************** Formatted input routines. ****************/
485
#define gmp_fscanf __gmp_fscanf
487
__GMP_DECLSPEC int gmp_fscanf _PROTO ((FILE *, const char *, ...));
490
#define gmp_scanf __gmp_scanf
491
__GMP_DECLSPEC int gmp_scanf _PROTO ((const char *, ...));
493
#define gmp_sscanf __gmp_sscanf
494
__GMP_DECLSPEC int gmp_sscanf _PROTO ((const char *, const char *, ...));
496
#define gmp_vfscanf __gmp_vfscanf
497
#if _GMP_H_HAVE_FILE && _GMP_H_HAVE_VA_LIST
498
__GMP_DECLSPEC int gmp_vfscanf _PROTO ((FILE *, const char *, va_list));
501
#define gmp_vscanf __gmp_vscanf
502
#if _GMP_H_HAVE_VA_LIST
503
__GMP_DECLSPEC int gmp_vscanf _PROTO ((const char *, va_list));
506
#define gmp_vsscanf __gmp_vsscanf
507
#if _GMP_H_HAVE_VA_LIST
508
__GMP_DECLSPEC int gmp_vsscanf _PROTO ((const char *, const char *, va_list));
512
/**************** Integer (i.e. Z) routines. ****************/
514
#define _mpz_realloc __gmpz_realloc
515
#define mpz_realloc __gmpz_realloc
516
__GMP_DECLSPEC void *_mpz_realloc _PROTO ((mpz_ptr, mp_size_t));
518
#define mpz_abs __gmpz_abs
519
#if __GMP_INLINE_PROTOTYPES || __GMP_FORCE_mpz_abs
520
__GMP_DECLSPEC void mpz_abs _PROTO ((mpz_ptr, mpz_srcptr));
523
#define mpz_add __gmpz_add
524
__GMP_DECLSPEC void mpz_add _PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
526
#define mpz_add_ui __gmpz_add_ui
527
__GMP_DECLSPEC void mpz_add_ui _PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
529
#define mpz_addmul __gmpz_addmul
530
__GMP_DECLSPEC void mpz_addmul _PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
532
#define mpz_addmul_ui __gmpz_addmul_ui
533
__GMP_DECLSPEC void mpz_addmul_ui _PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
535
#define mpz_and __gmpz_and
536
__GMP_DECLSPEC void mpz_and _PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
538
#define mpz_array_init __gmpz_array_init
539
__GMP_DECLSPEC void mpz_array_init _PROTO ((mpz_ptr, mp_size_t, mp_size_t));
541
#define mpz_bin_ui __gmpz_bin_ui
542
__GMP_DECLSPEC void mpz_bin_ui _PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
544
#define mpz_bin_uiui __gmpz_bin_uiui
545
__GMP_DECLSPEC void mpz_bin_uiui _PROTO ((mpz_ptr, unsigned long int, unsigned long int));
547
#define mpz_cdiv_q __gmpz_cdiv_q
548
__GMP_DECLSPEC void mpz_cdiv_q _PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
550
#define mpz_cdiv_q_2exp __gmpz_cdiv_q_2exp
551
__GMP_DECLSPEC void mpz_cdiv_q_2exp _PROTO ((mpz_ptr, mpz_srcptr, unsigned long));
553
#define mpz_cdiv_q_ui __gmpz_cdiv_q_ui
554
__GMP_DECLSPEC unsigned long int mpz_cdiv_q_ui _PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
556
#define mpz_cdiv_qr __gmpz_cdiv_qr
557
__GMP_DECLSPEC void mpz_cdiv_qr _PROTO ((mpz_ptr, mpz_ptr, mpz_srcptr, mpz_srcptr));
559
#define mpz_cdiv_qr_ui __gmpz_cdiv_qr_ui
560
__GMP_DECLSPEC unsigned long int mpz_cdiv_qr_ui _PROTO ((mpz_ptr, mpz_ptr, mpz_srcptr, unsigned long int));
562
#define mpz_cdiv_r __gmpz_cdiv_r
563
__GMP_DECLSPEC void mpz_cdiv_r _PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
565
#define mpz_cdiv_r_2exp __gmpz_cdiv_r_2exp
566
__GMP_DECLSPEC void mpz_cdiv_r_2exp _PROTO ((mpz_ptr, mpz_srcptr, unsigned long));
568
#define mpz_cdiv_r_ui __gmpz_cdiv_r_ui
569
__GMP_DECLSPEC unsigned long int mpz_cdiv_r_ui _PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
571
#define mpz_cdiv_ui __gmpz_cdiv_ui
572
__GMP_DECLSPEC unsigned long int mpz_cdiv_ui _PROTO ((mpz_srcptr, unsigned long int)) __GMP_ATTRIBUTE_PURE;
574
#define mpz_clear __gmpz_clear
575
__GMP_DECLSPEC void mpz_clear _PROTO ((mpz_ptr));
577
#define mpz_clrbit __gmpz_clrbit
578
__GMP_DECLSPEC void mpz_clrbit _PROTO ((mpz_ptr, unsigned long int));
580
#define mpz_cmp __gmpz_cmp
581
__GMP_DECLSPEC int mpz_cmp _PROTO ((mpz_srcptr, mpz_srcptr)) __GMP_ATTRIBUTE_PURE;
583
#define mpz_cmp_d __gmpz_cmp_d
584
__GMP_DECLSPEC int mpz_cmp_d _PROTO ((mpz_srcptr, double)) __GMP_ATTRIBUTE_PURE;
586
#define _mpz_cmp_si __gmpz_cmp_si
587
__GMP_DECLSPEC int _mpz_cmp_si _PROTO ((mpz_srcptr, signed long int)) __GMP_ATTRIBUTE_PURE;
589
#define _mpz_cmp_ui __gmpz_cmp_ui
590
__GMP_DECLSPEC int _mpz_cmp_ui _PROTO ((mpz_srcptr, unsigned long int)) __GMP_ATTRIBUTE_PURE;
592
#define mpz_cmpabs __gmpz_cmpabs
593
__GMP_DECLSPEC int mpz_cmpabs _PROTO ((mpz_srcptr, mpz_srcptr)) __GMP_ATTRIBUTE_PURE;
595
#define mpz_cmpabs_d __gmpz_cmpabs_d
596
__GMP_DECLSPEC int mpz_cmpabs_d _PROTO ((mpz_srcptr, double)) __GMP_ATTRIBUTE_PURE;
598
#define mpz_cmpabs_ui __gmpz_cmpabs_ui
599
__GMP_DECLSPEC int mpz_cmpabs_ui _PROTO ((mpz_srcptr, unsigned long int)) __GMP_ATTRIBUTE_PURE;
601
#define mpz_com __gmpz_com
602
__GMP_DECLSPEC void mpz_com _PROTO ((mpz_ptr, mpz_srcptr));
604
#define mpz_congruent_p __gmpz_congruent_p
605
__GMP_DECLSPEC int mpz_congruent_p _PROTO ((mpz_srcptr, mpz_srcptr, mpz_srcptr)) __GMP_ATTRIBUTE_PURE;
607
#define mpz_congruent_2exp_p __gmpz_congruent_2exp_p
608
__GMP_DECLSPEC int mpz_congruent_2exp_p _PROTO ((mpz_srcptr, mpz_srcptr, unsigned long)) __GMP_ATTRIBUTE_PURE;
610
#define mpz_congruent_ui_p __gmpz_congruent_ui_p
611
__GMP_DECLSPEC int mpz_congruent_ui_p _PROTO ((mpz_srcptr, unsigned long, unsigned long)) __GMP_ATTRIBUTE_PURE;
613
#define mpz_divexact __gmpz_divexact
614
__GMP_DECLSPEC void mpz_divexact _PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
616
#define mpz_divexact_ui __gmpz_divexact_ui
617
__GMP_DECLSPEC void mpz_divexact_ui _PROTO ((mpz_ptr, mpz_srcptr, unsigned long));
619
#define mpz_divisible_p __gmpz_divisible_p
620
__GMP_DECLSPEC int mpz_divisible_p _PROTO ((mpz_srcptr, mpz_srcptr)) __GMP_ATTRIBUTE_PURE;
622
#define mpz_divisible_ui_p __gmpz_divisible_ui_p
623
__GMP_DECLSPEC int mpz_divisible_ui_p _PROTO ((mpz_srcptr, unsigned long)) __GMP_ATTRIBUTE_PURE;
625
#define mpz_divisible_2exp_p __gmpz_divisible_2exp_p
626
__GMP_DECLSPEC int mpz_divisible_2exp_p _PROTO ((mpz_srcptr, unsigned long)) __GMP_ATTRIBUTE_PURE;
628
#define mpz_dump __gmpz_dump
629
__GMP_DECLSPEC void mpz_dump _PROTO ((mpz_srcptr));
631
#define mpz_fac_ui __gmpz_fac_ui
632
__GMP_DECLSPEC void mpz_fac_ui _PROTO ((mpz_ptr, unsigned long int));
634
#define mpz_fdiv_q __gmpz_fdiv_q
635
__GMP_DECLSPEC void mpz_fdiv_q _PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
637
#define mpz_fdiv_q_2exp __gmpz_fdiv_q_2exp
638
__GMP_DECLSPEC void mpz_fdiv_q_2exp _PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
640
#define mpz_fdiv_q_ui __gmpz_fdiv_q_ui
641
__GMP_DECLSPEC unsigned long int mpz_fdiv_q_ui _PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
643
#define mpz_fdiv_qr __gmpz_fdiv_qr
644
__GMP_DECLSPEC void mpz_fdiv_qr _PROTO ((mpz_ptr, mpz_ptr, mpz_srcptr, mpz_srcptr));
646
#define mpz_fdiv_qr_ui __gmpz_fdiv_qr_ui
647
__GMP_DECLSPEC unsigned long int mpz_fdiv_qr_ui _PROTO ((mpz_ptr, mpz_ptr, mpz_srcptr, unsigned long int));
649
#define mpz_fdiv_r __gmpz_fdiv_r
650
__GMP_DECLSPEC void mpz_fdiv_r _PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
652
#define mpz_fdiv_r_2exp __gmpz_fdiv_r_2exp
653
__GMP_DECLSPEC void mpz_fdiv_r_2exp _PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
655
#define mpz_fdiv_r_ui __gmpz_fdiv_r_ui
656
__GMP_DECLSPEC unsigned long int mpz_fdiv_r_ui _PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
658
#define mpz_fdiv_ui __gmpz_fdiv_ui
659
__GMP_DECLSPEC unsigned long int mpz_fdiv_ui _PROTO ((mpz_srcptr, unsigned long int)) __GMP_ATTRIBUTE_PURE;
661
#define mpz_fib_ui __gmpz_fib_ui
662
__GMP_DECLSPEC void mpz_fib_ui _PROTO ((mpz_ptr, unsigned long int));
664
#define mpz_fib2_ui __gmpz_fib2_ui
665
__GMP_DECLSPEC void mpz_fib2_ui _PROTO ((mpz_ptr, mpz_ptr, unsigned long int));
667
#define mpz_fits_sint_p __gmpz_fits_sint_p
668
__GMP_DECLSPEC int mpz_fits_sint_p _PROTO ((mpz_srcptr)) __GMP_ATTRIBUTE_PURE;
670
#define mpz_fits_slong_p __gmpz_fits_slong_p
671
__GMP_DECLSPEC int mpz_fits_slong_p _PROTO ((mpz_srcptr)) __GMP_ATTRIBUTE_PURE;
673
#define mpz_fits_sshort_p __gmpz_fits_sshort_p
674
__GMP_DECLSPEC int mpz_fits_sshort_p _PROTO ((mpz_srcptr)) __GMP_ATTRIBUTE_PURE;
676
#define mpz_fits_uint_p __gmpz_fits_uint_p
677
#if __GMP_INLINE_PROTOTYPES || __GMP_FORCE_mpz_fits_uint_p
678
__GMP_DECLSPEC int mpz_fits_uint_p _PROTO ((mpz_srcptr)) __GMP_ATTRIBUTE_PURE;
681
#define mpz_fits_ulong_p __gmpz_fits_ulong_p
682
#if __GMP_INLINE_PROTOTYPES || __GMP_FORCE_mpz_fits_ulong_p
683
__GMP_DECLSPEC int mpz_fits_ulong_p _PROTO ((mpz_srcptr)) __GMP_ATTRIBUTE_PURE;
686
#define mpz_fits_ushort_p __gmpz_fits_ushort_p
687
#if __GMP_INLINE_PROTOTYPES || __GMP_FORCE_mpz_fits_ushort_p
688
__GMP_DECLSPEC int mpz_fits_ushort_p _PROTO ((mpz_srcptr)) __GMP_ATTRIBUTE_PURE;
691
#define mpz_gcd __gmpz_gcd
692
__GMP_DECLSPEC void mpz_gcd _PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
694
#define mpz_gcd_ui __gmpz_gcd_ui
695
__GMP_DECLSPEC unsigned long int mpz_gcd_ui _PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
697
#define mpz_gcdext __gmpz_gcdext
698
__GMP_DECLSPEC void mpz_gcdext _PROTO ((mpz_ptr, mpz_ptr, mpz_ptr, mpz_srcptr, mpz_srcptr));
700
#define mpz_get_d __gmpz_get_d
701
__GMP_DECLSPEC double mpz_get_d _PROTO ((mpz_srcptr)) __GMP_ATTRIBUTE_PURE;
703
#define mpz_get_d_2exp __gmpz_get_d_2exp
704
__GMP_DECLSPEC double mpz_get_d_2exp _PROTO ((signed long int *, mpz_srcptr));
706
#define mpz_get_si __gmpz_get_si
707
__GMP_DECLSPEC /* signed */ long int mpz_get_si _PROTO ((mpz_srcptr)) __GMP_ATTRIBUTE_PURE;
709
#define mpz_get_str __gmpz_get_str
710
__GMP_DECLSPEC char *mpz_get_str _PROTO ((char *, int, mpz_srcptr));
712
#define mpz_get_ui __gmpz_get_ui
713
#if __GMP_INLINE_PROTOTYPES || __GMP_FORCE_mpz_get_ui
714
__GMP_DECLSPEC unsigned long int mpz_get_ui _PROTO ((mpz_srcptr)) __GMP_ATTRIBUTE_PURE;
717
#define mpz_getlimbn __gmpz_getlimbn
718
#if __GMP_INLINE_PROTOTYPES || __GMP_FORCE_mpz_getlimbn
719
__GMP_DECLSPEC mp_limb_t mpz_getlimbn _PROTO ((mpz_srcptr, mp_size_t)) __GMP_ATTRIBUTE_PURE;
722
#define mpz_hamdist __gmpz_hamdist
723
__GMP_DECLSPEC unsigned long int mpz_hamdist _PROTO ((mpz_srcptr, mpz_srcptr)) __GMP_ATTRIBUTE_PURE;
725
#define mpz_init __gmpz_init
726
__GMP_DECLSPEC void mpz_init _PROTO ((mpz_ptr));
728
#define mpz_init2 __gmpz_init2
729
__GMP_DECLSPEC void mpz_init2 _PROTO ((mpz_ptr, unsigned long));
731
#define mpz_init_set __gmpz_init_set
732
__GMP_DECLSPEC void mpz_init_set _PROTO ((mpz_ptr, mpz_srcptr));
734
#define mpz_init_set_d __gmpz_init_set_d
735
__GMP_DECLSPEC void mpz_init_set_d _PROTO ((mpz_ptr, double));
737
#define mpz_init_set_si __gmpz_init_set_si
738
__GMP_DECLSPEC void mpz_init_set_si _PROTO ((mpz_ptr, signed long int));
740
#define mpz_init_set_str __gmpz_init_set_str
741
__GMP_DECLSPEC int mpz_init_set_str _PROTO ((mpz_ptr, __gmp_const char *, int));
743
#define mpz_init_set_ui __gmpz_init_set_ui
744
__GMP_DECLSPEC void mpz_init_set_ui _PROTO ((mpz_ptr, unsigned long int));
746
#define mpz_inp_raw __gmpz_inp_raw
747
#ifdef _GMP_H_HAVE_FILE
748
__GMP_DECLSPEC size_t mpz_inp_raw _PROTO ((mpz_ptr, FILE *));
751
#define mpz_inp_str __gmpz_inp_str
752
#ifdef _GMP_H_HAVE_FILE
753
__GMP_DECLSPEC size_t mpz_inp_str _PROTO ((mpz_ptr, FILE *, int));
756
#define mpz_invert __gmpz_invert
757
__GMP_DECLSPEC int mpz_invert _PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
759
#define mpz_ior __gmpz_ior
760
__GMP_DECLSPEC void mpz_ior _PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
762
#define mpz_jacobi __gmpz_jacobi
763
__GMP_DECLSPEC int mpz_jacobi _PROTO ((mpz_srcptr, mpz_srcptr)) __GMP_ATTRIBUTE_PURE;
765
#define mpz_kronecker mpz_jacobi /* alias */
767
#define mpz_kronecker_si __gmpz_kronecker_si
768
__GMP_DECLSPEC int mpz_kronecker_si _PROTO ((mpz_srcptr, long)) __GMP_ATTRIBUTE_PURE;
770
#define mpz_kronecker_ui __gmpz_kronecker_ui
771
__GMP_DECLSPEC int mpz_kronecker_ui _PROTO ((mpz_srcptr, unsigned long)) __GMP_ATTRIBUTE_PURE;
773
#define mpz_si_kronecker __gmpz_si_kronecker
774
__GMP_DECLSPEC int mpz_si_kronecker _PROTO ((long, mpz_srcptr)) __GMP_ATTRIBUTE_PURE;
776
#define mpz_ui_kronecker __gmpz_ui_kronecker
777
__GMP_DECLSPEC int mpz_ui_kronecker _PROTO ((unsigned long, mpz_srcptr)) __GMP_ATTRIBUTE_PURE;
779
#define mpz_lcm __gmpz_lcm
780
__GMP_DECLSPEC void mpz_lcm _PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
782
#define mpz_lcm_ui __gmpz_lcm_ui
783
__GMP_DECLSPEC void mpz_lcm_ui _PROTO ((mpz_ptr, mpz_srcptr, unsigned long));
785
#define mpz_legendre mpz_jacobi /* alias */
787
#define mpz_lucnum_ui __gmpz_lucnum_ui
788
__GMP_DECLSPEC void mpz_lucnum_ui _PROTO ((mpz_ptr, unsigned long int));
790
#define mpz_lucnum2_ui __gmpz_lucnum2_ui
791
__GMP_DECLSPEC void mpz_lucnum2_ui _PROTO ((mpz_ptr, mpz_ptr, unsigned long int));
793
#define mpz_millerrabin __gmpz_millerrabin
794
__GMP_DECLSPEC int mpz_millerrabin _PROTO ((mpz_srcptr, int)) __GMP_ATTRIBUTE_PURE;
796
#define mpz_mod __gmpz_mod
797
__GMP_DECLSPEC void mpz_mod _PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
799
#define mpz_mul __gmpz_mul
800
__GMP_DECLSPEC void mpz_mul _PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
802
#define mpz_mul_2exp __gmpz_mul_2exp
803
__GMP_DECLSPEC void mpz_mul_2exp _PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
805
#define mpz_mul_si __gmpz_mul_si
806
__GMP_DECLSPEC void mpz_mul_si _PROTO ((mpz_ptr, mpz_srcptr, long int));
808
#define mpz_mul_ui __gmpz_mul_ui
809
__GMP_DECLSPEC void mpz_mul_ui _PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
811
#define mpz_neg __gmpz_neg
812
#if __GMP_INLINE_PROTOTYPES || __GMP_FORCE_mpz_neg
813
__GMP_DECLSPEC void mpz_neg _PROTO ((mpz_ptr, mpz_srcptr));
816
#define mpz_nextprime __gmpz_nextprime
817
__GMP_DECLSPEC void mpz_nextprime _PROTO ((mpz_ptr, mpz_srcptr));
819
#define mpz_out_raw __gmpz_out_raw
820
#ifdef _GMP_H_HAVE_FILE
821
__GMP_DECLSPEC size_t mpz_out_raw _PROTO ((FILE *, mpz_srcptr));
824
#define mpz_out_str __gmpz_out_str
825
#ifdef _GMP_H_HAVE_FILE
826
__GMP_DECLSPEC size_t mpz_out_str _PROTO ((FILE *, int, mpz_srcptr));
829
#define mpz_perfect_power_p __gmpz_perfect_power_p
830
__GMP_DECLSPEC int mpz_perfect_power_p _PROTO ((mpz_srcptr)) __GMP_ATTRIBUTE_PURE;
832
#define mpz_perfect_square_p __gmpz_perfect_square_p
833
#if __GMP_INLINE_PROTOTYPES || __GMP_FORCE_mpz_perfect_square_p
834
__GMP_DECLSPEC int mpz_perfect_square_p _PROTO ((mpz_srcptr)) __GMP_ATTRIBUTE_PURE;
837
#define mpz_popcount __gmpz_popcount
838
#if __GMP_INLINE_PROTOTYPES || __GMP_FORCE_mpz_popcount
839
__GMP_DECLSPEC unsigned long int mpz_popcount _PROTO ((mpz_srcptr)) __GMP_ATTRIBUTE_PURE;
842
#define mpz_pow_ui __gmpz_pow_ui
843
__GMP_DECLSPEC void mpz_pow_ui _PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
845
#define mpz_powm __gmpz_powm
846
__GMP_DECLSPEC void mpz_powm _PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr, mpz_srcptr));
848
#define mpz_powm_ui __gmpz_powm_ui
849
__GMP_DECLSPEC void mpz_powm_ui _PROTO ((mpz_ptr, mpz_srcptr, unsigned long int, mpz_srcptr));
851
#define mpz_probab_prime_p __gmpz_probab_prime_p
852
__GMP_DECLSPEC int mpz_probab_prime_p _PROTO ((mpz_srcptr, int)) __GMP_ATTRIBUTE_PURE;
854
#define mpz_random __gmpz_random
855
__GMP_DECLSPEC void mpz_random _PROTO ((mpz_ptr, mp_size_t));
857
#define mpz_random2 __gmpz_random2
858
__GMP_DECLSPEC void mpz_random2 _PROTO ((mpz_ptr, mp_size_t));
860
#define mpz_realloc2 __gmpz_realloc2
861
__GMP_DECLSPEC void mpz_realloc2 _PROTO ((mpz_ptr, unsigned long));
863
#define mpz_remove __gmpz_remove
864
__GMP_DECLSPEC unsigned long int mpz_remove _PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
866
#define mpz_root __gmpz_root
867
__GMP_DECLSPEC int mpz_root _PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
869
#define mpz_rrandomb __gmpz_rrandomb
870
__GMP_DECLSPEC void mpz_rrandomb _PROTO ((mpz_ptr, gmp_randstate_t, unsigned long int));
872
#define mpz_scan0 __gmpz_scan0
873
__GMP_DECLSPEC unsigned long int mpz_scan0 _PROTO ((mpz_srcptr, unsigned long int)) __GMP_ATTRIBUTE_PURE;
875
#define mpz_scan1 __gmpz_scan1
876
__GMP_DECLSPEC unsigned long int mpz_scan1 _PROTO ((mpz_srcptr, unsigned long int)) __GMP_ATTRIBUTE_PURE;
878
#define mpz_set __gmpz_set
879
__GMP_DECLSPEC void mpz_set _PROTO ((mpz_ptr, mpz_srcptr));
881
#define mpz_set_d __gmpz_set_d
882
__GMP_DECLSPEC void mpz_set_d _PROTO ((mpz_ptr, double));
884
#define mpz_set_f __gmpz_set_f
885
__GMP_DECLSPEC void mpz_set_f _PROTO ((mpz_ptr, mpf_srcptr));
887
#define mpz_set_q __gmpz_set_q
888
#if __GMP_INLINE_PROTOTYPES || __GMP_FORCE_mpz_set_q
889
__GMP_DECLSPEC void mpz_set_q _PROTO ((mpz_ptr, mpq_srcptr));
892
#define mpz_set_si __gmpz_set_si
893
__GMP_DECLSPEC void mpz_set_si _PROTO ((mpz_ptr, signed long int));
895
#define mpz_set_str __gmpz_set_str
896
__GMP_DECLSPEC int mpz_set_str _PROTO ((mpz_ptr, __gmp_const char *, int));
898
#define mpz_set_ui __gmpz_set_ui
899
__GMP_DECLSPEC void mpz_set_ui _PROTO ((mpz_ptr, unsigned long int));
901
#define mpz_setbit __gmpz_setbit
902
__GMP_DECLSPEC void mpz_setbit _PROTO ((mpz_ptr, unsigned long int));
904
#define mpz_size __gmpz_size
905
#if __GMP_INLINE_PROTOTYPES || __GMP_FORCE_mpz_size
906
__GMP_DECLSPEC size_t mpz_size _PROTO ((mpz_srcptr)) __GMP_ATTRIBUTE_PURE;
909
#define mpz_sizeinbase __gmpz_sizeinbase
910
__GMP_DECLSPEC size_t mpz_sizeinbase _PROTO ((mpz_srcptr, int)) __GMP_ATTRIBUTE_PURE;
912
#define mpz_sqrt __gmpz_sqrt
913
__GMP_DECLSPEC void mpz_sqrt _PROTO ((mpz_ptr, mpz_srcptr));
915
#define mpz_sqrtrem __gmpz_sqrtrem
916
__GMP_DECLSPEC void mpz_sqrtrem _PROTO ((mpz_ptr, mpz_ptr, mpz_srcptr));
918
#define mpz_sub __gmpz_sub
919
__GMP_DECLSPEC void mpz_sub _PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
921
#define mpz_sub_ui __gmpz_sub_ui
922
__GMP_DECLSPEC void mpz_sub_ui _PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
924
#define mpz_submul __gmpz_submul
925
__GMP_DECLSPEC void mpz_submul _PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
927
#define mpz_submul_ui __gmpz_submul_ui
928
__GMP_DECLSPEC void mpz_submul_ui _PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
930
#define mpz_swap __gmpz_swap
931
__GMP_DECLSPEC void mpz_swap _PROTO ((mpz_ptr, mpz_ptr));
933
#define mpz_tdiv_ui __gmpz_tdiv_ui
934
__GMP_DECLSPEC unsigned long int mpz_tdiv_ui _PROTO ((mpz_srcptr, unsigned long int)) __GMP_ATTRIBUTE_PURE;
936
#define mpz_tdiv_q __gmpz_tdiv_q
937
__GMP_DECLSPEC void mpz_tdiv_q _PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
939
#define mpz_tdiv_q_2exp __gmpz_tdiv_q_2exp
940
__GMP_DECLSPEC void mpz_tdiv_q_2exp _PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
942
#define mpz_tdiv_q_ui __gmpz_tdiv_q_ui
943
__GMP_DECLSPEC unsigned long int mpz_tdiv_q_ui _PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
945
#define mpz_tdiv_qr __gmpz_tdiv_qr
946
__GMP_DECLSPEC void mpz_tdiv_qr _PROTO ((mpz_ptr, mpz_ptr, mpz_srcptr, mpz_srcptr));
948
#define mpz_tdiv_qr_ui __gmpz_tdiv_qr_ui
949
__GMP_DECLSPEC unsigned long int mpz_tdiv_qr_ui _PROTO ((mpz_ptr, mpz_ptr, mpz_srcptr, unsigned long int));
951
#define mpz_tdiv_r __gmpz_tdiv_r
952
__GMP_DECLSPEC void mpz_tdiv_r _PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
954
#define mpz_tdiv_r_2exp __gmpz_tdiv_r_2exp
955
__GMP_DECLSPEC void mpz_tdiv_r_2exp _PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
957
#define mpz_tdiv_r_ui __gmpz_tdiv_r_ui
958
__GMP_DECLSPEC unsigned long int mpz_tdiv_r_ui _PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
960
#define mpz_tstbit __gmpz_tstbit
961
__GMP_DECLSPEC int mpz_tstbit _PROTO ((mpz_srcptr, unsigned long int)) __GMP_ATTRIBUTE_PURE;
963
#define mpz_ui_pow_ui __gmpz_ui_pow_ui
964
__GMP_DECLSPEC void mpz_ui_pow_ui _PROTO ((mpz_ptr, unsigned long int, unsigned long int));
966
#define mpz_urandomb __gmpz_urandomb
967
__GMP_DECLSPEC void mpz_urandomb _PROTO ((mpz_ptr, gmp_randstate_t, unsigned long int));
969
#define mpz_urandomm __gmpz_urandomm
970
__GMP_DECLSPEC void mpz_urandomm _PROTO ((mpz_ptr, gmp_randstate_t, mpz_srcptr));
972
#define mpz_xor __gmpz_xor
973
#define mpz_eor __gmpz_xor
974
__GMP_DECLSPEC void mpz_xor _PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
977
/**************** Rational (i.e. Q) routines. ****************/
979
#define mpq_abs __gmpq_abs
980
#if __GMP_INLINE_PROTOTYPES || __GMP_FORCE_mpq_abs
981
__GMP_DECLSPEC void mpq_abs _PROTO ((mpq_ptr, mpq_srcptr));
984
#define mpq_add __gmpq_add
985
__GMP_DECLSPEC void mpq_add _PROTO ((mpq_ptr, mpq_srcptr, mpq_srcptr));
987
#define mpq_canonicalize __gmpq_canonicalize
988
__GMP_DECLSPEC void mpq_canonicalize _PROTO ((mpq_ptr));
990
#define mpq_clear __gmpq_clear
991
__GMP_DECLSPEC void mpq_clear _PROTO ((mpq_ptr));
993
#define mpq_cmp __gmpq_cmp
994
__GMP_DECLSPEC int mpq_cmp _PROTO ((mpq_srcptr, mpq_srcptr)) __GMP_ATTRIBUTE_PURE;
996
#define _mpq_cmp_si __gmpq_cmp_si
997
__GMP_DECLSPEC int _mpq_cmp_si _PROTO ((mpq_srcptr, long, unsigned long)) __GMP_ATTRIBUTE_PURE;
999
#define _mpq_cmp_ui __gmpq_cmp_ui
1000
__GMP_DECLSPEC int _mpq_cmp_ui _PROTO ((mpq_srcptr, unsigned long int, unsigned long int)) __GMP_ATTRIBUTE_PURE;
1002
#define mpq_div __gmpq_div
1003
__GMP_DECLSPEC void mpq_div _PROTO ((mpq_ptr, mpq_srcptr, mpq_srcptr));
1005
#define mpq_div_2exp __gmpq_div_2exp
1006
__GMP_DECLSPEC void mpq_div_2exp _PROTO ((mpq_ptr, mpq_srcptr, unsigned long));
1008
#define mpq_equal __gmpq_equal
1009
__GMP_DECLSPEC int mpq_equal _PROTO ((mpq_srcptr, mpq_srcptr)) __GMP_ATTRIBUTE_PURE;
1011
#define mpq_get_num __gmpq_get_num
1012
__GMP_DECLSPEC void mpq_get_num _PROTO ((mpz_ptr, mpq_srcptr));
1014
#define mpq_get_den __gmpq_get_den
1015
__GMP_DECLSPEC void mpq_get_den _PROTO ((mpz_ptr, mpq_srcptr));
1017
#define mpq_get_d __gmpq_get_d
1018
__GMP_DECLSPEC double mpq_get_d _PROTO ((mpq_srcptr)) __GMP_ATTRIBUTE_PURE;
1020
#define mpq_get_str __gmpq_get_str
1021
__GMP_DECLSPEC char *mpq_get_str _PROTO ((char *, int, mpq_srcptr));
1023
#define mpq_init __gmpq_init
1024
__GMP_DECLSPEC void mpq_init _PROTO ((mpq_ptr));
1026
#define mpq_inp_str __gmpq_inp_str
1027
#ifdef _GMP_H_HAVE_FILE
1028
__GMP_DECLSPEC size_t mpq_inp_str _PROTO ((mpq_ptr, FILE *, int));
1031
#define mpq_inv __gmpq_inv
1032
__GMP_DECLSPEC void mpq_inv _PROTO ((mpq_ptr, mpq_srcptr));
1034
#define mpq_mul __gmpq_mul
1035
__GMP_DECLSPEC void mpq_mul _PROTO ((mpq_ptr, mpq_srcptr, mpq_srcptr));
1037
#define mpq_mul_2exp __gmpq_mul_2exp
1038
__GMP_DECLSPEC void mpq_mul_2exp _PROTO ((mpq_ptr, mpq_srcptr, unsigned long));
1040
#define mpq_neg __gmpq_neg
1041
#if __GMP_INLINE_PROTOTYPES || __GMP_FORCE_mpq_neg
1042
__GMP_DECLSPEC void mpq_neg _PROTO ((mpq_ptr, mpq_srcptr));
1045
#define mpq_out_str __gmpq_out_str
1046
#ifdef _GMP_H_HAVE_FILE
1047
__GMP_DECLSPEC size_t mpq_out_str _PROTO ((FILE *, int, mpq_srcptr));
1050
#define mpq_set __gmpq_set
1051
__GMP_DECLSPEC void mpq_set _PROTO ((mpq_ptr, mpq_srcptr));
1053
#define mpq_set_d __gmpq_set_d
1054
__GMP_DECLSPEC void mpq_set_d _PROTO ((mpq_ptr, double));
1056
#define mpq_set_den __gmpq_set_den
1057
__GMP_DECLSPEC void mpq_set_den _PROTO ((mpq_ptr, mpz_srcptr));
1059
#define mpq_set_f __gmpq_set_f
1060
__GMP_DECLSPEC void mpq_set_f _PROTO ((mpq_ptr, mpf_srcptr));
1062
#define mpq_set_num __gmpq_set_num
1063
__GMP_DECLSPEC void mpq_set_num _PROTO ((mpq_ptr, mpz_srcptr));
1065
#define mpq_set_si __gmpq_set_si
1066
__GMP_DECLSPEC void mpq_set_si _PROTO ((mpq_ptr, signed long int, unsigned long int));
1068
#define mpq_set_str __gmpq_set_str
1069
__GMP_DECLSPEC int mpq_set_str _PROTO ((mpq_ptr, const char *, int));
1071
#define mpq_set_ui __gmpq_set_ui
1072
__GMP_DECLSPEC void mpq_set_ui _PROTO ((mpq_ptr, unsigned long int, unsigned long int));
1074
#define mpq_set_z __gmpq_set_z
1075
__GMP_DECLSPEC void mpq_set_z _PROTO ((mpq_ptr, mpz_srcptr));
1077
#define mpq_sub __gmpq_sub
1078
__GMP_DECLSPEC void mpq_sub _PROTO ((mpq_ptr, mpq_srcptr, mpq_srcptr));
1080
#define mpq_swap __gmpq_swap
1081
__GMP_DECLSPEC void mpq_swap _PROTO ((mpq_ptr, mpq_ptr));
1084
/**************** Float (i.e. F) routines. ****************/
1086
#define mpf_abs __gmpf_abs
1087
__GMP_DECLSPEC void mpf_abs _PROTO ((mpf_ptr, mpf_srcptr));
1089
#define mpf_add __gmpf_add
1090
__GMP_DECLSPEC void mpf_add _PROTO ((mpf_ptr, mpf_srcptr, mpf_srcptr));
1092
#define mpf_add_ui __gmpf_add_ui
1093
__GMP_DECLSPEC void mpf_add_ui _PROTO ((mpf_ptr, mpf_srcptr, unsigned long int));
1094
#define mpf_ceil __gmpf_ceil
1095
__GMP_DECLSPEC void mpf_ceil _PROTO ((mpf_ptr, mpf_srcptr));
1097
#define mpf_clear __gmpf_clear
1098
__GMP_DECLSPEC void mpf_clear _PROTO ((mpf_ptr));
1100
#define mpf_cmp __gmpf_cmp
1101
__GMP_DECLSPEC int mpf_cmp _PROTO ((mpf_srcptr, mpf_srcptr)) __GMP_ATTRIBUTE_PURE;
1103
#define mpf_cmp_d __gmpf_cmp_d
1104
__GMP_DECLSPEC int mpf_cmp_d _PROTO ((mpf_srcptr, double)) __GMP_ATTRIBUTE_PURE;
1106
#define mpf_cmp_si __gmpf_cmp_si
1107
__GMP_DECLSPEC int mpf_cmp_si _PROTO ((mpf_srcptr, signed long int)) __GMP_ATTRIBUTE_PURE;
1109
#define mpf_cmp_ui __gmpf_cmp_ui
1110
__GMP_DECLSPEC int mpf_cmp_ui _PROTO ((mpf_srcptr, unsigned long int)) __GMP_ATTRIBUTE_PURE;
1112
#define mpf_div __gmpf_div
1113
__GMP_DECLSPEC void mpf_div _PROTO ((mpf_ptr, mpf_srcptr, mpf_srcptr));
1115
#define mpf_div_2exp __gmpf_div_2exp
1116
__GMP_DECLSPEC void mpf_div_2exp _PROTO ((mpf_ptr, mpf_srcptr, unsigned long int));
1118
#define mpf_div_ui __gmpf_div_ui
1119
__GMP_DECLSPEC void mpf_div_ui _PROTO ((mpf_ptr, mpf_srcptr, unsigned long int));
1121
#define mpf_dump __gmpf_dump
1122
__GMP_DECLSPEC void mpf_dump _PROTO ((mpf_srcptr));
1124
#define mpf_eq __gmpf_eq
1125
__GMP_DECLSPEC int mpf_eq _PROTO ((mpf_srcptr, mpf_srcptr, unsigned long int)) __GMP_ATTRIBUTE_PURE;
1127
#define mpf_fits_sint_p __gmpf_fits_sint_p
1128
__GMP_DECLSPEC int mpf_fits_sint_p _PROTO ((mpf_srcptr)) __GMP_ATTRIBUTE_PURE;
1130
#define mpf_fits_slong_p __gmpf_fits_slong_p
1131
__GMP_DECLSPEC int mpf_fits_slong_p _PROTO ((mpf_srcptr)) __GMP_ATTRIBUTE_PURE;
1133
#define mpf_fits_sshort_p __gmpf_fits_sshort_p
1134
__GMP_DECLSPEC int mpf_fits_sshort_p _PROTO ((mpf_srcptr)) __GMP_ATTRIBUTE_PURE;
1136
#define mpf_fits_uint_p __gmpf_fits_uint_p
1137
__GMP_DECLSPEC int mpf_fits_uint_p _PROTO ((mpf_srcptr)) __GMP_ATTRIBUTE_PURE;
1139
#define mpf_fits_ulong_p __gmpf_fits_ulong_p
1140
__GMP_DECLSPEC int mpf_fits_ulong_p _PROTO ((mpf_srcptr)) __GMP_ATTRIBUTE_PURE;
1142
#define mpf_fits_ushort_p __gmpf_fits_ushort_p
1143
__GMP_DECLSPEC int mpf_fits_ushort_p _PROTO ((mpf_srcptr)) __GMP_ATTRIBUTE_PURE;
1145
#define mpf_floor __gmpf_floor
1146
__GMP_DECLSPEC void mpf_floor _PROTO ((mpf_ptr, mpf_srcptr));
1148
#define mpf_get_d __gmpf_get_d
1149
__GMP_DECLSPEC double mpf_get_d _PROTO ((mpf_srcptr)) __GMP_ATTRIBUTE_PURE;
1151
#define mpf_get_d_2exp __gmpf_get_d_2exp
1152
__GMP_DECLSPEC double mpf_get_d_2exp _PROTO ((signed long int *, mpf_srcptr));
1154
#define mpf_get_default_prec __gmpf_get_default_prec
1155
__GMP_DECLSPEC unsigned long int mpf_get_default_prec _PROTO ((void)) __GMP_ATTRIBUTE_PURE;
1157
#define mpf_get_prec __gmpf_get_prec
1158
__GMP_DECLSPEC unsigned long int mpf_get_prec _PROTO ((mpf_srcptr)) __GMP_ATTRIBUTE_PURE;
1160
#define mpf_get_si __gmpf_get_si
1161
__GMP_DECLSPEC long mpf_get_si _PROTO ((mpf_srcptr)) __GMP_ATTRIBUTE_PURE;
1163
#define mpf_get_str __gmpf_get_str
1164
__GMP_DECLSPEC char *mpf_get_str _PROTO ((char *, mp_exp_t *, int, size_t, mpf_srcptr));
1166
#define mpf_get_ui __gmpf_get_ui
1167
__GMP_DECLSPEC unsigned long mpf_get_ui _PROTO ((mpf_srcptr)) __GMP_ATTRIBUTE_PURE;
1169
#define mpf_init __gmpf_init
1170
__GMP_DECLSPEC void mpf_init _PROTO ((mpf_ptr));
1172
#define mpf_init2 __gmpf_init2
1173
__GMP_DECLSPEC void mpf_init2 _PROTO ((mpf_ptr, unsigned long int));
1175
#define mpf_init_set __gmpf_init_set
1176
__GMP_DECLSPEC void mpf_init_set _PROTO ((mpf_ptr, mpf_srcptr));
1178
#define mpf_init_set_d __gmpf_init_set_d
1179
__GMP_DECLSPEC void mpf_init_set_d _PROTO ((mpf_ptr, double));
1181
#define mpf_init_set_si __gmpf_init_set_si
1182
__GMP_DECLSPEC void mpf_init_set_si _PROTO ((mpf_ptr, signed long int));
1184
#define mpf_init_set_str __gmpf_init_set_str
1185
__GMP_DECLSPEC int mpf_init_set_str _PROTO ((mpf_ptr, __gmp_const char *, int));
1187
#define mpf_init_set_ui __gmpf_init_set_ui
1188
__GMP_DECLSPEC void mpf_init_set_ui _PROTO ((mpf_ptr, unsigned long int));
1190
#define mpf_inp_str __gmpf_inp_str
1191
#ifdef _GMP_H_HAVE_FILE
1192
__GMP_DECLSPEC size_t mpf_inp_str _PROTO ((mpf_ptr, FILE *, int));
1195
#define mpf_integer_p __gmpf_integer_p
1196
__GMP_DECLSPEC int mpf_integer_p _PROTO ((mpf_srcptr)) __GMP_ATTRIBUTE_PURE;
1198
#define mpf_mul __gmpf_mul
1199
__GMP_DECLSPEC void mpf_mul _PROTO ((mpf_ptr, mpf_srcptr, mpf_srcptr));
1201
#define mpf_mul_2exp __gmpf_mul_2exp
1202
__GMP_DECLSPEC void mpf_mul_2exp _PROTO ((mpf_ptr, mpf_srcptr, unsigned long int));
1204
#define mpf_mul_ui __gmpf_mul_ui
1205
__GMP_DECLSPEC void mpf_mul_ui _PROTO ((mpf_ptr, mpf_srcptr, unsigned long int));
1207
#define mpf_neg __gmpf_neg
1208
__GMP_DECLSPEC void mpf_neg _PROTO ((mpf_ptr, mpf_srcptr));
1210
#define mpf_out_str __gmpf_out_str
1211
#ifdef _GMP_H_HAVE_FILE
1212
__GMP_DECLSPEC size_t mpf_out_str _PROTO ((FILE *, int, size_t, mpf_srcptr));
1215
#define mpf_pow_ui __gmpf_pow_ui
1216
__GMP_DECLSPEC void mpf_pow_ui _PROTO ((mpf_ptr, mpf_srcptr, unsigned long int));
1218
#define mpf_random2 __gmpf_random2
1219
__GMP_DECLSPEC void mpf_random2 _PROTO ((mpf_ptr, mp_size_t, mp_exp_t));
1221
#define mpf_reldiff __gmpf_reldiff
1222
__GMP_DECLSPEC void mpf_reldiff _PROTO ((mpf_ptr, mpf_srcptr, mpf_srcptr));
1224
#define mpf_set __gmpf_set
1225
__GMP_DECLSPEC void mpf_set _PROTO ((mpf_ptr, mpf_srcptr));
1227
#define mpf_set_d __gmpf_set_d
1228
__GMP_DECLSPEC void mpf_set_d _PROTO ((mpf_ptr, double));
1230
#define mpf_set_default_prec __gmpf_set_default_prec
1231
__GMP_DECLSPEC void mpf_set_default_prec _PROTO ((unsigned long int));
1233
#define mpf_set_prec __gmpf_set_prec
1234
__GMP_DECLSPEC void mpf_set_prec _PROTO ((mpf_ptr, unsigned long int));
1236
#define mpf_set_prec_raw __gmpf_set_prec_raw
1237
__GMP_DECLSPEC void mpf_set_prec_raw _PROTO ((mpf_ptr, unsigned long int));
1239
#define mpf_set_q __gmpf_set_q
1240
__GMP_DECLSPEC void mpf_set_q _PROTO ((mpf_ptr, mpq_srcptr));
1242
#define mpf_set_si __gmpf_set_si
1243
__GMP_DECLSPEC void mpf_set_si _PROTO ((mpf_ptr, signed long int));
1245
#define mpf_set_str __gmpf_set_str
1246
__GMP_DECLSPEC int mpf_set_str _PROTO ((mpf_ptr, __gmp_const char *, int));
1248
#define mpf_set_ui __gmpf_set_ui
1249
__GMP_DECLSPEC void mpf_set_ui _PROTO ((mpf_ptr, unsigned long int));
1251
#define mpf_set_z __gmpf_set_z
1252
__GMP_DECLSPEC void mpf_set_z _PROTO ((mpf_ptr, mpz_srcptr));
1254
#define mpf_size __gmpf_size
1255
__GMP_DECLSPEC size_t mpf_size _PROTO ((mpf_srcptr)) __GMP_ATTRIBUTE_PURE;
1257
#define mpf_sqrt __gmpf_sqrt
1258
__GMP_DECLSPEC void mpf_sqrt _PROTO ((mpf_ptr, mpf_srcptr));
1260
#define mpf_sqrt_ui __gmpf_sqrt_ui
1261
__GMP_DECLSPEC void mpf_sqrt_ui _PROTO ((mpf_ptr, unsigned long int));
1263
#define mpf_sub __gmpf_sub
1264
__GMP_DECLSPEC void mpf_sub _PROTO ((mpf_ptr, mpf_srcptr, mpf_srcptr));
1266
#define mpf_sub_ui __gmpf_sub_ui
1267
__GMP_DECLSPEC void mpf_sub_ui _PROTO ((mpf_ptr, mpf_srcptr, unsigned long int));
1269
#define mpf_swap __gmpf_swap
1270
__GMP_DECLSPEC void mpf_swap _PROTO ((mpf_ptr, mpf_ptr));
1272
#define mpf_trunc __gmpf_trunc
1273
__GMP_DECLSPEC void mpf_trunc _PROTO ((mpf_ptr, mpf_srcptr));
1275
#define mpf_ui_div __gmpf_ui_div
1276
__GMP_DECLSPEC void mpf_ui_div _PROTO ((mpf_ptr, unsigned long int, mpf_srcptr));
1278
#define mpf_ui_sub __gmpf_ui_sub
1279
__GMP_DECLSPEC void mpf_ui_sub _PROTO ((mpf_ptr, unsigned long int, mpf_srcptr));
1281
#define mpf_urandomb __gmpf_urandomb
1282
__GMP_DECLSPEC void mpf_urandomb _PROTO ((mpf_t, gmp_randstate_t, unsigned long int));
1285
/************ Low level positive-integer (i.e. N) routines. ************/
1287
/* This is ugly, but we need to make user calls reach the prefixed function. */
1289
#define mpn_add __MPN(add)
1290
#if __GMP_INLINE_PROTOTYPES || __GMP_FORCE_mpn_add
1291
__GMP_DECLSPEC mp_limb_t mpn_add _PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr,mp_size_t));
1294
#define mpn_add_1 __MPN(add_1)
1295
#if __GMP_INLINE_PROTOTYPES || __GMP_FORCE_mpn_add_1
1296
__GMP_DECLSPEC mp_limb_t mpn_add_1 _PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t));
1299
#define mpn_add_n __MPN(add_n)
1300
__GMP_DECLSPEC mp_limb_t mpn_add_n _PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t));
1302
#define mpn_add_nc __MPN(add_nc)
1303
__GMP_DECLSPEC mp_limb_t mpn_add_nc _PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_limb_t));
1305
#define mpn_addmul_1 __MPN(addmul_1)
1306
__GMP_DECLSPEC mp_limb_t mpn_addmul_1 _PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t));
1308
#define mpn_addmul_1c __MPN(addmul_1c)
1309
__GMP_DECLSPEC mp_limb_t mpn_addmul_1c _PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t));
1311
#define mpn_addsub_n __MPN(addsub_n)
1312
__GMP_DECLSPEC mp_limb_t mpn_addsub_n _PROTO ((mp_ptr, mp_ptr, mp_srcptr, mp_srcptr, mp_size_t));
1314
#define mpn_addsub_nc __MPN(addsub_nc)
1315
__GMP_DECLSPEC mp_limb_t mpn_addsub_nc _PROTO ((mp_ptr, mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_limb_t));
1317
#define mpn_bdivmod __MPN(bdivmod)
1318
__GMP_DECLSPEC mp_limb_t mpn_bdivmod _PROTO ((mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, unsigned long int));
1320
#define mpn_cmp __MPN(cmp)
1321
#if __GMP_INLINE_PROTOTYPES || __GMP_FORCE_mpn_cmp
1322
__GMP_DECLSPEC int mpn_cmp _PROTO ((mp_srcptr, mp_srcptr, mp_size_t)) __GMP_ATTRIBUTE_PURE;
1325
#define mpn_divexact_by3(dst,src,size) \
1326
mpn_divexact_by3c (dst, src, size, (mp_limb_t) 0)
1328
#define mpn_divexact_by3c __MPN(divexact_by3c)
1329
__GMP_DECLSPEC mp_limb_t mpn_divexact_by3c _PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t));
1331
#define mpn_divmod_1(qp,np,nsize,dlimb) \
1332
mpn_divrem_1 (qp, (mp_size_t) 0, np, nsize, dlimb)
1334
#define mpn_divrem __MPN(divrem)
1335
__GMP_DECLSPEC mp_limb_t mpn_divrem _PROTO((mp_ptr, mp_size_t, mp_ptr, mp_size_t, mp_srcptr, mp_size_t));
1337
#define mpn_divrem_1 __MPN(divrem_1)
1338
__GMP_DECLSPEC mp_limb_t mpn_divrem_1 _PROTO ((mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t));
1340
#define mpn_divrem_1c __MPN(divrem_1c)
1341
__GMP_DECLSPEC mp_limb_t mpn_divrem_1c _PROTO ((mp_ptr, mp_size_t, mp_srcptr, mp_size_t,
1342
mp_limb_t, mp_limb_t));
1344
#define mpn_divrem_2 __MPN(divrem_2)
1345
__GMP_DECLSPEC mp_limb_t mpn_divrem_2 _PROTO ((mp_ptr, mp_size_t, mp_ptr, mp_size_t, mp_srcptr));
1347
#define mpn_dump __MPN(dump)
1348
__GMP_DECLSPEC void mpn_dump _PROTO ((mp_srcptr, mp_size_t));
1350
#define mpn_gcd __MPN(gcd)
1351
__GMP_DECLSPEC mp_size_t mpn_gcd _PROTO ((mp_ptr, mp_ptr, mp_size_t, mp_ptr, mp_size_t));
1353
#define mpn_gcd_1 __MPN(gcd_1)
1354
__GMP_DECLSPEC mp_limb_t mpn_gcd_1 _PROTO ((mp_srcptr, mp_size_t, mp_limb_t)) __GMP_ATTRIBUTE_PURE;
1356
#define mpn_gcdext __MPN(gcdext)
1357
__GMP_DECLSPEC mp_size_t mpn_gcdext _PROTO ((mp_ptr, mp_ptr, mp_size_t *, mp_ptr, mp_size_t, mp_ptr, mp_size_t));
1359
#define mpn_get_str __MPN(get_str)
1360
__GMP_DECLSPEC size_t mpn_get_str _PROTO ((unsigned char *, int, mp_ptr, mp_size_t));
1362
#define mpn_hamdist __MPN(hamdist)
1363
__GMP_DECLSPEC unsigned long int mpn_hamdist _PROTO ((mp_srcptr, mp_srcptr, mp_size_t)) __GMP_ATTRIBUTE_PURE;
1365
#define mpn_lshift __MPN(lshift)
1366
__GMP_DECLSPEC mp_limb_t mpn_lshift _PROTO ((mp_ptr, mp_srcptr, mp_size_t, unsigned int));
1368
#define mpn_mod_1 __MPN(mod_1)
1369
__GMP_DECLSPEC mp_limb_t mpn_mod_1 _PROTO ((mp_srcptr, mp_size_t, mp_limb_t)) __GMP_ATTRIBUTE_PURE;
1371
#define mpn_mod_1c __MPN(mod_1c)
1372
__GMP_DECLSPEC mp_limb_t mpn_mod_1c _PROTO ((mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t)) __GMP_ATTRIBUTE_PURE;
1374
#define mpn_mul __MPN(mul)
1375
__GMP_DECLSPEC mp_limb_t mpn_mul _PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t));
1377
#define mpn_mul_1 __MPN(mul_1)
1378
__GMP_DECLSPEC mp_limb_t mpn_mul_1 _PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t));
1380
#define mpn_mul_1c __MPN(mul_1c)
1381
__GMP_DECLSPEC mp_limb_t mpn_mul_1c _PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t));
1383
#define mpn_mul_basecase __MPN(mul_basecase)
1384
__GMP_DECLSPEC void mpn_mul_basecase _PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t));
1386
#define mpn_mul_n __MPN(mul_n)
1387
__GMP_DECLSPEC void mpn_mul_n _PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t));
1389
#define mpn_perfect_square_p __MPN(perfect_square_p)
1390
__GMP_DECLSPEC int mpn_perfect_square_p _PROTO ((mp_srcptr, mp_size_t)) __GMP_ATTRIBUTE_PURE;
1392
#define mpn_popcount __MPN(popcount)
1393
__GMP_DECLSPEC unsigned long int mpn_popcount _PROTO ((mp_srcptr, mp_size_t)) __GMP_ATTRIBUTE_PURE;
1395
/* undocumented, but retained here for upward compatibility */
1396
#define mpn_preinv_mod_1 __MPN(preinv_mod_1)
1397
__GMP_DECLSPEC mp_limb_t mpn_preinv_mod_1 _PROTO ((mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t)) __GMP_ATTRIBUTE_PURE;
1399
#define mpn_random __MPN(random)
1400
__GMP_DECLSPEC void mpn_random _PROTO ((mp_ptr, mp_size_t));
1402
#define mpn_random2 __MPN(random2)
1403
__GMP_DECLSPEC void mpn_random2 _PROTO ((mp_ptr, mp_size_t));
1405
#define mpn_rshift __MPN(rshift)
1406
__GMP_DECLSPEC mp_limb_t mpn_rshift _PROTO ((mp_ptr, mp_srcptr, mp_size_t, unsigned int));
1408
#define mpn_scan0 __MPN(scan0)
1409
__GMP_DECLSPEC unsigned long int mpn_scan0 _PROTO ((mp_srcptr, unsigned long int)) __GMP_ATTRIBUTE_PURE;
1411
#define mpn_scan1 __MPN(scan1)
1412
__GMP_DECLSPEC unsigned long int mpn_scan1 _PROTO ((mp_srcptr, unsigned long int)) __GMP_ATTRIBUTE_PURE;
1414
#define mpn_set_str __MPN(set_str)
1415
__GMP_DECLSPEC mp_size_t mpn_set_str _PROTO ((mp_ptr, __gmp_const unsigned char *, size_t, int));
1417
#define mpn_sqr_n __MPN(sqr_n)
1418
__GMP_DECLSPEC void mpn_sqr_n _PROTO ((mp_ptr, mp_srcptr, mp_size_t));
1420
#define mpn_sqr_basecase __MPN(sqr_basecase)
1421
__GMP_DECLSPEC void mpn_sqr_basecase _PROTO ((mp_ptr, mp_srcptr, mp_size_t));
1423
#define mpn_sqrtrem __MPN(sqrtrem)
1424
__GMP_DECLSPEC mp_size_t mpn_sqrtrem _PROTO ((mp_ptr, mp_ptr, mp_srcptr, mp_size_t));
1426
#define mpn_sub __MPN(sub)
1427
#if __GMP_INLINE_PROTOTYPES || __GMP_FORCE_mpn_sub
1428
__GMP_DECLSPEC mp_limb_t mpn_sub _PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr,mp_size_t));
1431
#define mpn_sub_1 __MPN(sub_1)
1432
#if __GMP_INLINE_PROTOTYPES || __GMP_FORCE_mpn_sub_1
1433
__GMP_DECLSPEC mp_limb_t mpn_sub_1 _PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t));
1436
#define mpn_sub_n __MPN(sub_n)
1437
__GMP_DECLSPEC mp_limb_t mpn_sub_n _PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t));
1439
#define mpn_sub_nc __MPN(sub_nc)
1440
__GMP_DECLSPEC mp_limb_t mpn_sub_nc _PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_limb_t));
1442
#define mpn_submul_1 __MPN(submul_1)
1443
__GMP_DECLSPEC mp_limb_t mpn_submul_1 _PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t));
1445
#define mpn_submul_1c __MPN(submul_1c)
1446
__GMP_DECLSPEC mp_limb_t mpn_submul_1c _PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t));
1448
#define mpn_tdiv_qr __MPN(tdiv_qr)
1449
__GMP_DECLSPEC void mpn_tdiv_qr _PROTO ((mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t));
1452
/**************** mpz inlines ****************/
1454
/* The following are provided as inlines where possible, but always exist as
1455
library functions too, for binary compatibility.
1457
Within gmp itself this inlining generally isn't relied on, since it
1458
doesn't get done for all compilers, whereas if something is worth
1459
inlining then it's worth arranging always.
1461
There are two styles of inlining here. When the same bit of code is
1462
wanted for the inline as for the library version, then __GMP_FORCE_foo
1463
arranges for that code to be emitted and the __GMP_EXTERN_INLINE
1464
directive suppressed, eg. mpz_fits_uint_p. When a different bit of code
1465
is wanted for the inline than for the library version, then
1466
__GMP_FORCE_foo arranges the inline to be suppressed, eg. mpz_abs. */
1468
#if defined (__GMP_EXTERN_INLINE) && ! __GMP_FORCE_mpz_abs
1469
__GMP_EXTERN_INLINE void
1470
mpz_abs (mpz_ptr w, mpz_srcptr u)
1474
w->_mp_size = __GMP_ABS (w->_mp_size);
1478
#define __GMPZ_FITS_UTYPE_P(z,maxval) \
1479
mp_size_t size = z->_mp_size; \
1480
mp_limb_t data = z->_mp_d[0]; \
1481
return (size == 0 || (size == 1 && data <= maxval));
1483
#if defined (__GMP_EXTERN_INLINE) || __GMP_FORCE_mpz_fits_uint_p
1484
#if ! __GMP_FORCE_mpz_fits_uint_p
1488
mpz_fits_uint_p (mpz_srcptr z)
1490
__GMPZ_FITS_UTYPE_P (z, __GMP_UINT_MAX);
1494
#if defined (__GMP_EXTERN_INLINE) || __GMP_FORCE_mpz_fits_ulong_p
1495
#if ! __GMP_FORCE_mpz_fits_ulong_p
1499
mpz_fits_ulong_p (mpz_srcptr z)
1501
__GMPZ_FITS_UTYPE_P (z, __GMP_ULONG_MAX);
1505
#if defined (__GMP_EXTERN_INLINE) || __GMP_FORCE_mpz_fits_ushort_p
1506
#if ! __GMP_FORCE_mpz_fits_ushort_p
1510
mpz_fits_ushort_p (mpz_srcptr z)
1512
__GMPZ_FITS_UTYPE_P (z, __GMP_USHRT_MAX);
1516
#if defined (__GMP_EXTERN_INLINE) || __GMP_FORCE_mpz_get_ui
1517
#if ! __GMP_FORCE_mpz_get_ui
1521
mpz_get_ui (mpz_srcptr z)
1523
mp_limb_t l = z->_mp_d[0];
1524
return z->_mp_size ? l : 0;
1528
#if defined (__GMP_EXTERN_INLINE) || __GMP_FORCE_mpz_getlimbn
1529
#if ! __GMP_FORCE_mpz_getlimbn
1533
mpz_getlimbn (mpz_srcptr z, mp_size_t n)
1535
if (__GMP_ABS (z->_mp_size) <= n || n < 0)
1542
#if defined (__GMP_EXTERN_INLINE) && ! __GMP_FORCE_mpz_neg
1543
__GMP_EXTERN_INLINE void
1544
mpz_neg (mpz_ptr w, mpz_srcptr u)
1548
w->_mp_size = - w->_mp_size;
1552
#if defined (__GMP_EXTERN_INLINE) || __GMP_FORCE_mpz_perfect_square_p
1553
#if ! __GMP_FORCE_mpz_perfect_square_p
1557
mpz_perfect_square_p (mpz_srcptr a)
1559
mp_size_t asize = a->_mp_size;
1561
return (asize == 0); /* zero is a square, negatives are not */
1563
return mpn_perfect_square_p (a->_mp_d, asize);
1567
#if defined (__GMP_EXTERN_INLINE) || __GMP_FORCE_mpz_popcount
1568
#if ! __GMP_FORCE_mpz_popcount
1572
mpz_popcount (mpz_srcptr u)
1574
mp_size_t usize = u->_mp_size;
1577
return (usize < 0 ? __GMP_ULONG_MAX : 0);
1579
return mpn_popcount (u->_mp_d, usize);
1583
#if defined (__GMP_EXTERN_INLINE) || __GMP_FORCE_mpz_set_q
1584
#if ! __GMP_FORCE_mpz_set_q
1588
mpz_set_q (mpz_ptr w, mpq_srcptr u)
1590
mpz_tdiv_q (w, mpq_numref (u), mpq_denref (u));
1594
#if defined (__GMP_EXTERN_INLINE) || __GMP_FORCE_mpz_size
1595
#if ! __GMP_FORCE_mpz_size
1599
mpz_size (mpz_srcptr z)
1601
return __GMP_ABS (z->_mp_size);
1606
/**************** mpq inlines ****************/
1608
#if defined (__GMP_EXTERN_INLINE) && ! __GMP_FORCE_mpq_abs
1609
__GMP_EXTERN_INLINE void
1610
mpq_abs (mpq_ptr w, mpq_srcptr u)
1614
w->_mp_num._mp_size = __GMP_ABS (w->_mp_num._mp_size);
1618
#if defined (__GMP_EXTERN_INLINE) && ! __GMP_FORCE_mpq_neg
1619
__GMP_EXTERN_INLINE void
1620
mpq_neg (mpq_ptr w, mpq_srcptr u)
1624
w->_mp_num._mp_size = - w->_mp_num._mp_size;
1629
/**************** mpn inlines ****************/
1631
/* The comments with __GMPN_ADD_1 below apply here too.
1633
The test for FUNCTION returning 0 should predict well. If it's assumed
1634
{yp,ysize} will usually have a random number of bits then the high limb
1635
won't be full and a carry out will occur a good deal less than 50% of the
1638
ysize==0 isn't a documented feature, but is used internally in a few
1641
Producing cout last stops it using up a register during the main part of
1642
the calculation, though gcc (as of 3.0) on an "if (mpn_add (...))"
1643
doesn't seem able to move the true and false legs of the conditional up
1644
to the two places cout is generated. */
1646
#define __GMPN_AORS(cout, wp, xp, xsize, yp, ysize, FUNCTION, TEST) \
1651
/* ASSERT ((ysize) >= 0); */ \
1652
/* ASSERT ((xsize) >= (ysize)); */ \
1653
/* ASSERT (MPN_SAME_OR_SEPARATE2_P (wp, xsize, xp, xsize)); */ \
1654
/* ASSERT (MPN_SAME_OR_SEPARATE2_P (wp, xsize, yp, ysize)); */ \
1659
if (FUNCTION (wp, xp, yp, __i)) \
1663
if (__i >= (xsize)) \
1674
__GMPN_COPY_REST (wp, xp, xsize, __i); \
1680
#define __GMPN_ADD(cout, wp, xp, xsize, yp, ysize) \
1681
__GMPN_AORS (cout, wp, xp, xsize, yp, ysize, mpn_add_n, \
1682
(((wp)[__i++] = __x + 1) == 0))
1683
#define __GMPN_SUB(cout, wp, xp, xsize, yp, ysize) \
1684
__GMPN_AORS (cout, wp, xp, xsize, yp, ysize, mpn_sub_n, \
1685
(((wp)[__i++] = __x - 1), __x == 0))
1688
/* The use of __i indexing is designed to ensure a compile time src==dst
1689
remains nice and clear to the compiler, so that __GMPN_COPY_REST can
1690
disappear, and the load/add/store gets a chance to become a
1691
read-modify-write on CISC CPUs.
1695
Using a pair of pointers instead of indexing would be possible, but gcc
1696
isn't able to recognise compile-time src==dst in that case, even when the
1697
pointers are incremented more or less together. Other compilers would
1698
very likely have similar difficulty.
1700
gcc could use "if (__builtin_constant_p(src==dst) && src==dst)" or
1701
similar to detect a compile-time src==dst. This works nicely on gcc
1702
2.95.x, it's not good on gcc 3.0 where __builtin_constant_p(p==p) seems
1703
to be always false, for a pointer p. But the current code form seems
1704
good enough for src==dst anyway.
1706
gcc on x86 as usual doesn't give particularly good flags handling for the
1707
carry/borrow detection. It's tempting to want some multi instruction asm
1708
blocks to help it, and this was tried, but in truth there's only a few
1709
instructions to save and any gain is all too easily lost by register
1710
juggling setting up for the asm. */
1712
#define __GMPN_AORS_1(cout, dst, src, n, v, OP, CB) \
1715
mp_limb_t __x, __r; \
1717
/* ASSERT ((n) >= 1); */ \
1718
/* ASSERT (MPN_SAME_OR_SEPARATE_P (dst, src, n)); */ \
1723
if (CB (__r, __x, (v))) \
1726
for (__i = 1; __i < (n);) \
1732
if (!CB (__r, __x, 1)) \
1734
if ((src) != (dst)) \
1735
__GMPN_COPY_REST (dst, src, n, __i); \
1743
if ((src) != (dst)) \
1744
__GMPN_COPY_REST (dst, src, n, 1); \
1749
#define __GMPN_ADDCB(r,x,y) ((r) < (y))
1750
#define __GMPN_SUBCB(r,x,y) ((x) < (y))
1752
#define __GMPN_ADD_1(cout, dst, src, n, v) \
1753
__GMPN_AORS_1(cout, dst, src, n, v, +, __GMPN_ADDCB)
1754
#define __GMPN_SUB_1(cout, dst, src, n, v) \
1755
__GMPN_AORS_1(cout, dst, src, n, v, -, __GMPN_SUBCB)
1758
/* Compare {xp,size} and {yp,size}, setting "result" to positive, zero or
1759
negative. size==0 is allowed. On random data usually only one limb will
1760
need to be examined to get a result, so it's worth having it inline. */
1761
#define __GMPN_CMP(result, xp, yp, size) \
1764
mp_limb_t __x, __y; \
1766
/* ASSERT ((size) >= 0); */ \
1770
while (--__i >= 0) \
1776
/* Cannot use __x - __y, may overflow an "int" */ \
1777
(result) = (__x > __y ? 1 : -1); \
1784
/* For power and powerpc we want an inline ldu/stu/bdnz loop for copying.
1785
On ppc630 for instance this is optimal since it can sustain only 1 store
1788
gcc 2.95.x (powerpc64 -maix64, or powerpc32) doesn't recognise the "for"
1789
loop in the generic code below can become ldu/stu/bdnz. The do/while
1790
here helps it get to that.
1792
In gcc -mpowerpc64 mode, without -maix64, __size seems to want to be an
1793
mp_limb_t to get into the ctr register, and even then the loop is a
1794
curious ldu/stu/bdz/b. But let's not worry about that unless there's a
1795
system using this. An asm block could force what we want if necessary.
1797
xlc 3.1 already generates ldu/stu/bdnz from the generic C, and does so
1798
from this loop too. */
1800
#if __GMP_HAVE_HOST_CPU_FAMILY_power || __GMP_HAVE_HOST_CPU_FAMILY_powerpc
1801
#define __GMPN_COPY_INCR(dst, src, size) \
1803
/* ASSERT ((size) >= 0); */ \
1804
/* ASSERT (MPN_SAME_OR_INCR_P (dst, src, size)); */ \
1807
mp_ptr __dst = (dst) - 1; \
1808
mp_srcptr __src = (src) - 1; \
1809
mp_size_t __size = (size); \
1811
*++__dst = *++__src; \
1812
while (--__size != 0); \
1815
#define __GMPN_COPY(dst, src, size) \
1817
/* ASSERT (MPN_SAME_OR_SEPARATE_P (dst, src, size)); */ \
1818
__GMPN_COPY_INCR (dst, src, size); \
1822
#if defined (__GMPN_COPY) && ! defined (__GMPN_COPY_REST)
1823
#define __GMPN_COPY_REST(dst, src, size, start) \
1825
/* ASSERT ((start) >= 0); */ \
1826
/* ASSERT ((start) <= (size)); */ \
1827
__GMPN_COPY ((dst)+(start), (src)+(start), (size)-(start)); \
1831
/* Copy {src,size} to {dst,size}, starting at "start". This is designed to
1832
keep the indexing dst[j] and src[j] nice and simple for __GMPN_ADD_1,
1834
#if ! defined (__GMPN_COPY_REST)
1835
#define __GMPN_COPY_REST(dst, src, size, start) \
1838
/* ASSERT ((size) >= 0); */ \
1839
/* ASSERT ((start) >= 0); */ \
1840
/* ASSERT ((start) <= (size)); */ \
1841
/* ASSERT (MPN_SAME_OR_SEPARATE_P (dst, src, size)); */ \
1842
for (__j = (start); __j < (size); __j++) \
1843
(dst)[__j] = (src)[__j]; \
1847
/* Enhancement: Use some of the smarter code from gmp-impl.h. Maybe use
1848
mpn_copyi if there's a native version, and if we don't mind demanding
1849
binary compatibility for it (on targets which use it). */
1851
#if ! defined (__GMPN_COPY)
1852
#define __GMPN_COPY(dst, src, size) __GMPN_COPY_REST (dst, src, size, 0)
1856
#if defined (__GMP_EXTERN_INLINE) || __GMP_FORCE_mpn_add
1857
#if ! __GMP_FORCE_mpn_add
1862
mp_srcptr xp, mp_size_t xsize, mp_srcptr yp, mp_size_t ysize)
1865
__GMPN_ADD (c, wp, xp, xsize, yp, ysize);
1870
#if defined (__GMP_EXTERN_INLINE) || __GMP_FORCE_mpn_add_1
1871
#if ! __GMP_FORCE_mpn_add_1
1875
mpn_add_1 (mp_ptr dst, mp_srcptr src, mp_size_t size, mp_limb_t n)
1878
__GMPN_ADD_1 (c, dst, src, size, n);
1883
#if defined (__GMP_EXTERN_INLINE) || __GMP_FORCE_mpn_cmp
1884
#if ! __GMP_FORCE_mpn_cmp
1888
mpn_cmp (mp_srcptr xp, mp_srcptr yp, mp_size_t size)
1891
__GMPN_CMP (result, xp, yp, size);
1896
#if defined (__GMP_EXTERN_INLINE) || __GMP_FORCE_mpn_sub
1897
#if ! __GMP_FORCE_mpn_sub
1902
mp_srcptr xp, mp_size_t xsize, mp_srcptr yp, mp_size_t ysize)
1905
__GMPN_SUB (c, wp, xp, xsize, yp, ysize);
1910
#if defined (__GMP_EXTERN_INLINE) || __GMP_FORCE_mpn_sub_1
1911
#if ! __GMP_FORCE_mpn_sub_1
1915
mpn_sub_1 (mp_ptr dst, mp_srcptr src, mp_size_t size, mp_limb_t n)
1918
__GMPN_SUB_1 (c, dst, src, size, n);
1923
#if defined (__cplusplus)
1928
/* Allow faster testing for negative, zero, and positive. */
1929
#define mpz_sgn(Z) ((Z)->_mp_size < 0 ? -1 : (Z)->_mp_size > 0)
1930
#define mpf_sgn(F) ((F)->_mp_size < 0 ? -1 : (F)->_mp_size > 0)
1931
#define mpq_sgn(Q) ((Q)->_mp_num._mp_size < 0 ? -1 : (Q)->_mp_num._mp_size > 0)
1933
/* When using GCC, optimize certain common comparisons. */
1934
#if defined (__GNUC__)
1935
#define mpz_cmp_ui(Z,UI) \
1936
(__builtin_constant_p (UI) && (UI) == 0 \
1937
? mpz_sgn (Z) : _mpz_cmp_ui (Z,UI))
1938
#define mpz_cmp_si(Z,SI) \
1939
(__builtin_constant_p (SI) && (SI) == 0 ? mpz_sgn (Z) \
1940
: __builtin_constant_p (SI) && (SI) > 0 \
1941
? _mpz_cmp_ui (Z, (unsigned long int) SI) \
1942
: _mpz_cmp_si (Z,SI))
1943
#define mpq_cmp_ui(Q,NUI,DUI) \
1944
(__builtin_constant_p (NUI) && (NUI) == 0 \
1945
? mpq_sgn (Q) : _mpq_cmp_ui (Q,NUI,DUI))
1946
#define mpq_cmp_si(q,n,d) \
1947
(__builtin_constant_p ((n) >= 0) && (n) >= 0 \
1948
? mpq_cmp_ui (q, (unsigned long) (n), d) \
1949
: _mpq_cmp_si (q, n, d))
1951
#define mpz_cmp_ui(Z,UI) _mpz_cmp_ui (Z,UI)
1952
#define mpz_cmp_si(Z,UI) _mpz_cmp_si (Z,UI)
1953
#define mpq_cmp_ui(Q,NUI,DUI) _mpq_cmp_ui (Q,NUI,DUI)
1954
#define mpq_cmp_si(q,n,d) _mpq_cmp_si(q,n,d)
1958
/* Using "&" rather than "&&" means these can come out branch-free. Every
1959
mpz_t has at least one limb allocated, so fetching the low limb is always
1961
#define mpz_odd_p(z) ((int) ((z)->_mp_size != 0) & (int) (z)->_mp_d[0])
1962
#define mpz_even_p(z) (! mpz_odd_p (z))
1965
/**************** C++ routines ****************/
1969
__GMP_DECLSPEC std::ostream& operator<< (std::ostream &, mpz_srcptr);
1970
__GMP_DECLSPEC std::ostream& operator<< (std::ostream &, mpq_srcptr);
1971
__GMP_DECLSPEC std::ostream& operator<< (std::ostream &, mpf_srcptr);
1972
__GMP_DECLSPEC std::istream& operator>> (std::istream &, mpz_ptr);
1973
__GMP_DECLSPEC std::istream& operator>> (std::istream &, mpq_ptr);
1974
__GMP_DECLSPEC std::istream& operator>> (std::istream &, mpf_ptr);
1978
/* Compatibility with GMP 2 and earlier. */
1979
#define mpn_divmod(qp,np,nsize,dp,dsize) \
1980
mpn_divrem (qp, (mp_size_t) 0, np, nsize, dp, dsize)
1982
/* Compatibility with GMP 1. */
1983
#define mpz_mdiv mpz_fdiv_q
1984
#define mpz_mdivmod mpz_fdiv_qr
1985
#define mpz_mmod mpz_fdiv_r
1986
#define mpz_mdiv_ui mpz_fdiv_q_ui
1987
#define mpz_mdivmod_ui(q,r,n,d) \
1988
((r == 0) ? mpz_fdiv_q_ui (q,n,d) : mpz_fdiv_qr_ui (q,r,n,d))
1989
#define mpz_mmod_ui(r,n,d) \
1990
((r == 0) ? mpz_fdiv_ui (n,d) : mpz_fdiv_r_ui (r,n,d))
1992
/* Useful synonyms, but not quite compatible with GMP 1. */
1993
#define mpz_div mpz_fdiv_q
1994
#define mpz_divmod mpz_fdiv_qr
1995
#define mpz_div_ui mpz_fdiv_q_ui
1996
#define mpz_divmod_ui mpz_fdiv_qr_ui
1997
#define mpz_mod_ui mpz_fdiv_r_ui
1998
#define mpz_div_2exp mpz_fdiv_q_2exp
1999
#define mpz_mod_2exp mpz_fdiv_r_2exp
2001
#define gmp_errno __gmp_errno
2002
__GMP_DECLSPEC extern int gmp_errno;
2007
GMP_ERROR_UNSUPPORTED_ARGUMENT = 1,
2008
GMP_ERROR_DIVISION_BY_ZERO = 2,
2009
GMP_ERROR_SQRT_OF_NEGATIVE = 4,
2010
GMP_ERROR_INVALID_ARGUMENT = 8,
2011
GMP_ERROR_ALLOCATE = 16,
2012
GMP_ERROR_BAD_STRING = 32,
2013
GMP_ERROR_UNUSED_ERROR
2016
/* Major version number is the value of __GNU_MP__ too, above and in mp.h. */
2017
#define __GNU_MP_VERSION 4
2018
#define __GNU_MP_VERSION_MINOR 0
2019
#define __GNU_MP_VERSION_PATCHLEVEL 1
2021
#define gmp_version __gmp_version
2022
__GMP_DECLSPEC extern __gmp_const char * __gmp_const gmp_version;
2025
#endif /* __GMP_H__ */