Debian Codegraph @

msvc/gmp/build.vc8/gmp.h

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