1173419cfSchristos /* Definitions for GNU multiple precision functions. -*- mode: c -*-
2173419cfSchristos
3173419cfSchristos Copyright 1991, 1993-1997, 1999-2016, 2020 Free Software Foundation, Inc.
4173419cfSchristos
5173419cfSchristos This file is part of the GNU MP Library.
6173419cfSchristos
7173419cfSchristos The GNU MP Library is free software; you can redistribute it and/or modify
8173419cfSchristos it under the terms of either:
9173419cfSchristos
10173419cfSchristos * the GNU Lesser General Public License as published by the Free
11173419cfSchristos Software Foundation; either version 3 of the License, or (at your
12173419cfSchristos option) any later version.
13173419cfSchristos
14173419cfSchristos or
15173419cfSchristos
16173419cfSchristos * the GNU General Public License as published by the Free Software
17173419cfSchristos Foundation; either version 2 of the License, or (at your option) any
18173419cfSchristos later version.
19173419cfSchristos
20173419cfSchristos or both in parallel, as here.
21173419cfSchristos
22173419cfSchristos The GNU MP Library is distributed in the hope that it will be useful, but
23173419cfSchristos WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
24173419cfSchristos or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
25173419cfSchristos for more details.
26173419cfSchristos
27173419cfSchristos You should have received copies of the GNU General Public License and the
28173419cfSchristos GNU Lesser General Public License along with the GNU MP Library. If not,
29173419cfSchristos see https://www.gnu.org/licenses/. */
30173419cfSchristos
31173419cfSchristos #ifndef __GMP_H__
32173419cfSchristos
33173419cfSchristos #if defined (__cplusplus)
34173419cfSchristos #include <iosfwd> /* for std::istream, std::ostream, std::string */
35173419cfSchristos #include <cstdio>
36173419cfSchristos #endif
37173419cfSchristos
38173419cfSchristos
39173419cfSchristos /* Instantiated by configure. */
40173419cfSchristos #if ! defined (__GMP_WITHIN_CONFIGURE)
41173419cfSchristos #define __GMP_HAVE_HOST_CPU_FAMILY_power 0
42173419cfSchristos #define __GMP_HAVE_HOST_CPU_FAMILY_powerpc 0
43173419cfSchristos #define GMP_LIMB_BITS 64
44173419cfSchristos #define GMP_NAIL_BITS 0
45173419cfSchristos #endif
46173419cfSchristos #define GMP_NUMB_BITS (GMP_LIMB_BITS - GMP_NAIL_BITS)
47173419cfSchristos #define GMP_NUMB_MASK ((~ __GMP_CAST (mp_limb_t, 0)) >> GMP_NAIL_BITS)
48173419cfSchristos #define GMP_NUMB_MAX GMP_NUMB_MASK
49173419cfSchristos #define GMP_NAIL_MASK (~ GMP_NUMB_MASK)
50173419cfSchristos
51173419cfSchristos
52173419cfSchristos #ifndef __GNU_MP__
53173419cfSchristos #define __GNU_MP__ 6
54173419cfSchristos
55173419cfSchristos #include <stddef.h> /* for size_t */
56173419cfSchristos #include <limits.h>
57173419cfSchristos
58173419cfSchristos /* Instantiated by configure. */
59173419cfSchristos #if ! defined (__GMP_WITHIN_CONFIGURE)
60173419cfSchristos #define _LONG_LONG_LIMB 1
61173419cfSchristos #define __GMP_LIBGMP_DLL 0
62173419cfSchristos #endif
63173419cfSchristos
64173419cfSchristos
65173419cfSchristos /* __GMP_DECLSPEC supports Windows DLL versions of libgmp, and is empty in
66173419cfSchristos all other circumstances.
67173419cfSchristos
68173419cfSchristos When compiling objects for libgmp, __GMP_DECLSPEC is an export directive,
69173419cfSchristos or when compiling for an application it's an import directive. The two
70173419cfSchristos cases are differentiated by __GMP_WITHIN_GMP defined by the GMP Makefiles
71173419cfSchristos (and not defined from an application).
72173419cfSchristos
73173419cfSchristos __GMP_DECLSPEC_XX is similarly used for libgmpxx. __GMP_WITHIN_GMPXX
74173419cfSchristos indicates when building libgmpxx, and in that case libgmpxx functions are
75173419cfSchristos exports, but libgmp functions which might get called are imports.
76173419cfSchristos
77173419cfSchristos Libtool DLL_EXPORT define is not used.
78173419cfSchristos
79173419cfSchristos There's no attempt to support GMP built both static and DLL. Doing so
80173419cfSchristos would mean applications would have to tell us which of the two is going
81173419cfSchristos to be used when linking, and that seems very tedious and error prone if
82173419cfSchristos using GMP by hand, and equally tedious from a package since autoconf and
83173419cfSchristos automake don't give much help.
84173419cfSchristos
85173419cfSchristos __GMP_DECLSPEC is required on all documented global functions and
86173419cfSchristos variables, the various internals in gmp-impl.h etc can be left unadorned.
87173419cfSchristos But internals used by the test programs or speed measuring programs
88173419cfSchristos should have __GMP_DECLSPEC, and certainly constants or variables must
89173419cfSchristos have it or the wrong address will be resolved.
90173419cfSchristos
91173419cfSchristos In gcc __declspec can go at either the start or end of a prototype.
92173419cfSchristos
93173419cfSchristos In Microsoft C __declspec must go at the start, or after the type like
94173419cfSchristos void __declspec(...) *foo()". There's no __dllexport or anything to
95173419cfSchristos guard against someone foolish #defining dllexport. _export used to be
96173419cfSchristos available, but no longer.
97173419cfSchristos
98173419cfSchristos In Borland C _export still exists, but needs to go after the type, like
99173419cfSchristos "void _export foo();". Would have to change the __GMP_DECLSPEC syntax to
100173419cfSchristos make use of that. Probably more trouble than it's worth. */
101173419cfSchristos
102173419cfSchristos #if defined (__GNUC__)
103173419cfSchristos #define __GMP_DECLSPEC_EXPORT __declspec(__dllexport__)
104173419cfSchristos #define __GMP_DECLSPEC_IMPORT __declspec(__dllimport__)
105173419cfSchristos #endif
106173419cfSchristos #if defined (_MSC_VER) || defined (__BORLANDC__)
107173419cfSchristos #define __GMP_DECLSPEC_EXPORT __declspec(dllexport)
108173419cfSchristos #define __GMP_DECLSPEC_IMPORT __declspec(dllimport)
109173419cfSchristos #endif
110173419cfSchristos #ifdef __WATCOMC__
111173419cfSchristos #define __GMP_DECLSPEC_EXPORT __export
112173419cfSchristos #define __GMP_DECLSPEC_IMPORT __import
113173419cfSchristos #endif
114173419cfSchristos #ifdef __IBMC__
115173419cfSchristos #define __GMP_DECLSPEC_EXPORT _Export
116173419cfSchristos #define __GMP_DECLSPEC_IMPORT _Import
117173419cfSchristos #endif
118173419cfSchristos
119173419cfSchristos #if __GMP_LIBGMP_DLL
120173419cfSchristos #ifdef __GMP_WITHIN_GMP
121173419cfSchristos /* compiling to go into a DLL libgmp */
122173419cfSchristos #define __GMP_DECLSPEC __GMP_DECLSPEC_EXPORT
123173419cfSchristos #else
124173419cfSchristos /* compiling to go into an application which will link to a DLL libgmp */
125173419cfSchristos #define __GMP_DECLSPEC __GMP_DECLSPEC_IMPORT
126173419cfSchristos #endif
127173419cfSchristos #else
128173419cfSchristos /* all other cases */
129173419cfSchristos #define __GMP_DECLSPEC
130173419cfSchristos #endif
131173419cfSchristos
132173419cfSchristos
133173419cfSchristos #ifdef __GMP_SHORT_LIMB
134173419cfSchristos typedef unsigned int mp_limb_t;
135173419cfSchristos typedef int mp_limb_signed_t;
136173419cfSchristos #else
137173419cfSchristos #ifdef _LONG_LONG_LIMB
138173419cfSchristos typedef unsigned long long int mp_limb_t;
139173419cfSchristos typedef long long int mp_limb_signed_t;
140173419cfSchristos #else
141173419cfSchristos typedef unsigned long int mp_limb_t;
142173419cfSchristos typedef long int mp_limb_signed_t;
143173419cfSchristos #endif
144173419cfSchristos #endif
145173419cfSchristos typedef unsigned long int mp_bitcnt_t;
146173419cfSchristos
147173419cfSchristos /* For reference, note that the name __mpz_struct gets into C++ mangled
148173419cfSchristos function names, which means although the "__" suggests an internal, we
149173419cfSchristos must leave this name for binary compatibility. */
150173419cfSchristos typedef struct
151173419cfSchristos {
152173419cfSchristos int _mp_alloc; /* Number of *limbs* allocated and pointed
153173419cfSchristos to by the _mp_d field. */
154173419cfSchristos int _mp_size; /* abs(_mp_size) is the number of limbs the
155173419cfSchristos last field points to. If _mp_size is
156173419cfSchristos negative this is a negative number. */
157173419cfSchristos mp_limb_t *_mp_d; /* Pointer to the limbs. */
158173419cfSchristos } __mpz_struct;
159173419cfSchristos
160173419cfSchristos #endif /* __GNU_MP__ */
161173419cfSchristos
162173419cfSchristos
163173419cfSchristos typedef __mpz_struct MP_INT; /* gmp 1 source compatibility */
164173419cfSchristos typedef __mpz_struct mpz_t[1];
165173419cfSchristos
166173419cfSchristos typedef mp_limb_t * mp_ptr;
167173419cfSchristos typedef const mp_limb_t * mp_srcptr;
168173419cfSchristos #if defined (_CRAY) && ! defined (_CRAYMPP)
169173419cfSchristos /* plain `int' is much faster (48 bits) */
170173419cfSchristos #define __GMP_MP_SIZE_T_INT 1
171173419cfSchristos typedef int mp_size_t;
172173419cfSchristos typedef int mp_exp_t;
173173419cfSchristos #else
174173419cfSchristos #define __GMP_MP_SIZE_T_INT 0
175173419cfSchristos typedef long int mp_size_t;
176173419cfSchristos typedef long int mp_exp_t;
177173419cfSchristos #endif
178173419cfSchristos
179173419cfSchristos typedef struct
180173419cfSchristos {
181173419cfSchristos __mpz_struct _mp_num;
182173419cfSchristos __mpz_struct _mp_den;
183173419cfSchristos } __mpq_struct;
184173419cfSchristos
185173419cfSchristos typedef __mpq_struct MP_RAT; /* gmp 1 source compatibility */
186173419cfSchristos typedef __mpq_struct mpq_t[1];
187173419cfSchristos
188173419cfSchristos typedef struct
189173419cfSchristos {
190173419cfSchristos int _mp_prec; /* Max precision, in number of `mp_limb_t's.
191173419cfSchristos Set by mpf_init and modified by
192173419cfSchristos mpf_set_prec. The area pointed to by the
193173419cfSchristos _mp_d field contains `prec' + 1 limbs. */
194173419cfSchristos int _mp_size; /* abs(_mp_size) is the number of limbs the
195173419cfSchristos last field points to. If _mp_size is
196173419cfSchristos negative this is a negative number. */
197173419cfSchristos mp_exp_t _mp_exp; /* Exponent, in the base of `mp_limb_t'. */
198173419cfSchristos mp_limb_t *_mp_d; /* Pointer to the limbs. */
199173419cfSchristos } __mpf_struct;
200173419cfSchristos
201173419cfSchristos /* typedef __mpf_struct MP_FLOAT; */
202173419cfSchristos typedef __mpf_struct mpf_t[1];
203173419cfSchristos
204173419cfSchristos /* Available random number generation algorithms. */
205173419cfSchristos typedef enum
206173419cfSchristos {
207173419cfSchristos GMP_RAND_ALG_DEFAULT = 0,
208173419cfSchristos GMP_RAND_ALG_LC = GMP_RAND_ALG_DEFAULT /* Linear congruential. */
209173419cfSchristos } gmp_randalg_t;
210173419cfSchristos
211173419cfSchristos /* Random state struct. */
212173419cfSchristos typedef struct
213173419cfSchristos {
214173419cfSchristos mpz_t _mp_seed; /* _mp_d member points to state of the generator. */
215173419cfSchristos gmp_randalg_t _mp_alg; /* Currently unused. */
216173419cfSchristos union {
217173419cfSchristos void *_mp_lc; /* Pointer to function pointers structure. */
218173419cfSchristos } _mp_algdata;
219173419cfSchristos } __gmp_randstate_struct;
220173419cfSchristos typedef __gmp_randstate_struct gmp_randstate_t[1];
221173419cfSchristos
222173419cfSchristos /* Types for function declarations in gmp files. */
223173419cfSchristos /* ??? Should not pollute user name space with these ??? */
224173419cfSchristos typedef const __mpz_struct *mpz_srcptr;
225173419cfSchristos typedef __mpz_struct *mpz_ptr;
226173419cfSchristos typedef const __mpf_struct *mpf_srcptr;
227173419cfSchristos typedef __mpf_struct *mpf_ptr;
228173419cfSchristos typedef const __mpq_struct *mpq_srcptr;
229173419cfSchristos typedef __mpq_struct *mpq_ptr;
230173419cfSchristos
231173419cfSchristos
232173419cfSchristos #if __GMP_LIBGMP_DLL
233173419cfSchristos #ifdef __GMP_WITHIN_GMPXX
234173419cfSchristos /* compiling to go into a DLL libgmpxx */
235173419cfSchristos #define __GMP_DECLSPEC_XX __GMP_DECLSPEC_EXPORT
236173419cfSchristos #else
237173419cfSchristos /* compiling to go into a application which will link to a DLL libgmpxx */
238173419cfSchristos #define __GMP_DECLSPEC_XX __GMP_DECLSPEC_IMPORT
239173419cfSchristos #endif
240173419cfSchristos #else
241173419cfSchristos /* all other cases */
242173419cfSchristos #define __GMP_DECLSPEC_XX
243173419cfSchristos #endif
244173419cfSchristos
245173419cfSchristos
246173419cfSchristos #ifndef __MPN
247173419cfSchristos #define __MPN(x) __gmpn_##x
248173419cfSchristos #endif
249173419cfSchristos
250173419cfSchristos /* For reference, "defined(EOF)" cannot be used here. In g++ 2.95.4,
251173419cfSchristos <iostream> defines EOF but not FILE. */
252173419cfSchristos #if defined (FILE) \
253173419cfSchristos || defined (H_STDIO) \
254173419cfSchristos || defined (_H_STDIO) /* AIX */ \
255173419cfSchristos || defined (_STDIO_H) /* glibc, Sun, SCO */ \
256173419cfSchristos || defined (_STDIO_H_) /* BSD, OSF */ \
257173419cfSchristos || defined (__STDIO_H) /* Borland */ \
258173419cfSchristos || defined (__STDIO_H__) /* IRIX */ \
259173419cfSchristos || defined (_STDIO_INCLUDED) /* HPUX */ \
260173419cfSchristos || defined (__dj_include_stdio_h_) /* DJGPP */ \
261173419cfSchristos || defined (_FILE_DEFINED) /* Microsoft */ \
262173419cfSchristos || defined (__STDIO__) /* Apple MPW MrC */ \
263173419cfSchristos || defined (_MSL_STDIO_H) /* Metrowerks */ \
264173419cfSchristos || defined (_STDIO_H_INCLUDED) /* QNX4 */ \
265173419cfSchristos || defined (_ISO_STDIO_ISO_H) /* Sun C++ */ \
266173419cfSchristos || defined (__STDIO_LOADED) /* VMS */ \
267173419cfSchristos || defined (__DEFINED_FILE) /* musl */
268173419cfSchristos #define _GMP_H_HAVE_FILE 1
269173419cfSchristos #endif
270173419cfSchristos
271173419cfSchristos /* In ISO C, if a prototype involving "struct obstack *" is given without
272173419cfSchristos that structure defined, then the struct is scoped down to just the
273173419cfSchristos prototype, causing a conflict if it's subsequently defined for real. So
274173419cfSchristos only give prototypes if we've got obstack.h. */
275173419cfSchristos #if defined (_OBSTACK_H) /* glibc <obstack.h> */
276173419cfSchristos #define _GMP_H_HAVE_OBSTACK 1
277173419cfSchristos #endif
278173419cfSchristos
279173419cfSchristos /* The prototypes for gmp_vprintf etc are provided only if va_list is defined,
280173419cfSchristos via an application having included <stdarg.h>. Usually va_list is a typedef
281173419cfSchristos so can't be tested directly, but C99 specifies that va_start is a macro.
282173419cfSchristos
283173419cfSchristos <stdio.h> will define some sort of va_list for vprintf and vfprintf, but
284173419cfSchristos let's not bother trying to use that since it's not standard and since
285173419cfSchristos application uses for gmp_vprintf etc will almost certainly require the
286173419cfSchristos whole <stdarg.h> anyway. */
287173419cfSchristos
288173419cfSchristos #ifdef va_start
289173419cfSchristos #define _GMP_H_HAVE_VA_LIST 1
290173419cfSchristos #endif
291173419cfSchristos
292173419cfSchristos /* Test for gcc >= maj.min, as per __GNUC_PREREQ in glibc */
293173419cfSchristos #if defined (__GNUC__) && defined (__GNUC_MINOR__)
294173419cfSchristos #define __GMP_GNUC_PREREQ(maj, min) \
295173419cfSchristos ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
296173419cfSchristos #else
297173419cfSchristos #define __GMP_GNUC_PREREQ(maj, min) 0
298173419cfSchristos #endif
299173419cfSchristos
300173419cfSchristos /* "pure" is in gcc 2.96 and up, see "(gcc)Function Attributes". Basically
301173419cfSchristos it means a function does nothing but examine its arguments and memory
302173419cfSchristos (global or via arguments) to generate a return value, but changes nothing
303173419cfSchristos and has no side-effects. __GMP_NO_ATTRIBUTE_CONST_PURE lets
304173419cfSchristos tune/common.c etc turn this off when trying to write timing loops. */
305173419cfSchristos #if __GMP_GNUC_PREREQ (2,96) && ! defined (__GMP_NO_ATTRIBUTE_CONST_PURE)
306173419cfSchristos #define __GMP_ATTRIBUTE_PURE __attribute__ ((__pure__))
307173419cfSchristos #else
308173419cfSchristos #define __GMP_ATTRIBUTE_PURE
309173419cfSchristos #endif
310173419cfSchristos
311173419cfSchristos
312173419cfSchristos /* __GMP_CAST allows us to use static_cast in C++, so our macros are clean
313173419cfSchristos to "g++ -Wold-style-cast".
314173419cfSchristos
315173419cfSchristos Casts in "extern inline" code within an extern "C" block don't induce
316173419cfSchristos these warnings, so __GMP_CAST only needs to be used on documented
317173419cfSchristos macros. */
318173419cfSchristos
319173419cfSchristos #ifdef __cplusplus
320173419cfSchristos #define __GMP_CAST(type, expr) (static_cast<type> (expr))
321173419cfSchristos #else
322173419cfSchristos #define __GMP_CAST(type, expr) ((type) (expr))
323173419cfSchristos #endif
324173419cfSchristos
325173419cfSchristos
326173419cfSchristos /* An empty "throw ()" means the function doesn't throw any C++ exceptions,
327173419cfSchristos this can save some stack frame info in applications.
328173419cfSchristos
329173419cfSchristos Currently it's given only on functions which never divide-by-zero etc,
330173419cfSchristos don't allocate memory, and are expected to never need to allocate memory.
331173419cfSchristos This leaves open the possibility of a C++ throw from a future GMP
332173419cfSchristos exceptions scheme.
333173419cfSchristos
334173419cfSchristos mpz_set_ui etc are omitted to leave open the lazy allocation scheme
335173419cfSchristos described in doc/tasks.html. mpz_get_d etc are omitted to leave open
336173419cfSchristos exceptions for float overflows.
337173419cfSchristos
338173419cfSchristos Note that __GMP_NOTHROW must be given on any inlines the same as on their
339173419cfSchristos prototypes (for g++ at least, where they're used together). Note also
340173419cfSchristos that g++ 3.0 demands that __GMP_NOTHROW is before other attributes like
341173419cfSchristos __GMP_ATTRIBUTE_PURE. */
342173419cfSchristos
343173419cfSchristos #if defined (__cplusplus)
344173419cfSchristos #if __cplusplus >= 201103L
345173419cfSchristos #define __GMP_NOTHROW noexcept
346173419cfSchristos #else
347173419cfSchristos #define __GMP_NOTHROW throw ()
348173419cfSchristos #endif
349173419cfSchristos #else
350173419cfSchristos #define __GMP_NOTHROW
351173419cfSchristos #endif
352173419cfSchristos
353173419cfSchristos
354173419cfSchristos /* PORTME: What other compilers have a useful "extern inline"? "static
355173419cfSchristos inline" would be an acceptable substitute if the compiler (or linker)
356173419cfSchristos discards unused statics. */
357173419cfSchristos
358173419cfSchristos /* gcc has __inline__ in all modes, including strict ansi. Give a prototype
359173419cfSchristos for an inline too, so as to correctly specify "dllimport" on windows, in
360173419cfSchristos case the function is called rather than inlined.
361173419cfSchristos GCC 4.3 and above with -std=c99 or -std=gnu99 implements ISO C99
362173419cfSchristos inline semantics, unless -fgnu89-inline is used. */
363173419cfSchristos #ifdef __GNUC__
364*dbbd8e88Smrg #if (defined __GNUC_STDC_INLINE__) || \
365*dbbd8e88Smrg (__GNUC__ == 4 && __GNUC_MINOR__ >= 2) || (__GNUC__ > 4)
366173419cfSchristos #define __GMP_EXTERN_INLINE extern __inline__ __attribute__ ((__gnu_inline__))
367173419cfSchristos #endif
368173419cfSchristos #define __GMP_INLINE_PROTOTYPES 1
369173419cfSchristos #endif
370173419cfSchristos
371173419cfSchristos /* DEC C (eg. version 5.9) supports "static __inline foo()", even in -std1
372173419cfSchristos strict ANSI mode. Inlining is done even when not optimizing (ie. -O0
373173419cfSchristos mode, which is the default), but an unnecessary local copy of foo is
374173419cfSchristos emitted unless -O is used. "extern __inline" is accepted, but the
375173419cfSchristos "extern" appears to be ignored, ie. it becomes a plain global function
376173419cfSchristos but which is inlined within its file. Don't know if all old versions of
377173419cfSchristos DEC C supported __inline, but as a start let's do the right thing for
378173419cfSchristos current versions. */
379173419cfSchristos #ifdef __DECC
380173419cfSchristos #define __GMP_EXTERN_INLINE static __inline
381173419cfSchristos #endif
382173419cfSchristos
383173419cfSchristos /* SCO OpenUNIX 8 cc supports "static inline foo()" but not in -Xc strict
384173419cfSchristos ANSI mode (__STDC__ is 1 in that mode). Inlining only actually takes
385173419cfSchristos place under -O. Without -O "foo" seems to be emitted whether it's used
386173419cfSchristos or not, which is wasteful. "extern inline foo()" isn't useful, the
387173419cfSchristos "extern" is apparently ignored, so foo is inlined if possible but also
388173419cfSchristos emitted as a global, which causes multiple definition errors when
389173419cfSchristos building a shared libgmp. */
390173419cfSchristos #ifdef __SCO_VERSION__
391173419cfSchristos #if __SCO_VERSION__ > 400000000 && __STDC__ != 1 \
392173419cfSchristos && ! defined (__GMP_EXTERN_INLINE)
393173419cfSchristos #define __GMP_EXTERN_INLINE static inline
394173419cfSchristos #endif
395173419cfSchristos #endif
396173419cfSchristos
397173419cfSchristos /* Microsoft's C compiler accepts __inline */
398173419cfSchristos #ifdef _MSC_VER
399173419cfSchristos #define __GMP_EXTERN_INLINE __inline
400173419cfSchristos #endif
401173419cfSchristos
402173419cfSchristos /* Recent enough Sun C compilers want "inline" */
403173419cfSchristos #if defined (__SUNPRO_C) && __SUNPRO_C >= 0x560 \
404173419cfSchristos && ! defined (__GMP_EXTERN_INLINE)
405173419cfSchristos #define __GMP_EXTERN_INLINE inline
406173419cfSchristos #endif
407173419cfSchristos
408173419cfSchristos /* Somewhat older Sun C compilers want "static inline" */
409173419cfSchristos #if defined (__SUNPRO_C) && __SUNPRO_C >= 0x540 \
410173419cfSchristos && ! defined (__GMP_EXTERN_INLINE)
411173419cfSchristos #define __GMP_EXTERN_INLINE static inline
412173419cfSchristos #endif
413173419cfSchristos
414173419cfSchristos
415173419cfSchristos /* C++ always has "inline" and since it's a normal feature the linker should
416173419cfSchristos discard duplicate non-inlined copies, or if it doesn't then that's a
417173419cfSchristos problem for everyone, not just GMP. */
418173419cfSchristos #if defined (__cplusplus) && ! defined (__GMP_EXTERN_INLINE)
419173419cfSchristos #define __GMP_EXTERN_INLINE inline
420173419cfSchristos #endif
421173419cfSchristos
422173419cfSchristos /* Don't do any inlining within a configure run, since if the compiler ends
423173419cfSchristos up emitting copies of the code into the object file it can end up
424173419cfSchristos demanding the various support routines (like mpn_popcount) for linking,
425173419cfSchristos making the "alloca" test and perhaps others fail. And on hppa ia64 a
426173419cfSchristos pre-release gcc 3.2 was seen not respecting the "extern" in "extern
427173419cfSchristos __inline__", triggering this problem too. */
428173419cfSchristos #if defined (__GMP_WITHIN_CONFIGURE) && ! __GMP_WITHIN_CONFIGURE_INLINE
429173419cfSchristos #undef __GMP_EXTERN_INLINE
430173419cfSchristos #endif
431173419cfSchristos
432173419cfSchristos /* By default, don't give a prototype when there's going to be an inline
433173419cfSchristos version. Note in particular that Cray C++ objects to the combination of
434173419cfSchristos prototype and inline. */
435173419cfSchristos #ifdef __GMP_EXTERN_INLINE
436173419cfSchristos #ifndef __GMP_INLINE_PROTOTYPES
437173419cfSchristos #define __GMP_INLINE_PROTOTYPES 0
438173419cfSchristos #endif
439173419cfSchristos #else
440173419cfSchristos #define __GMP_INLINE_PROTOTYPES 1
441173419cfSchristos #endif
442173419cfSchristos
443173419cfSchristos
444173419cfSchristos #define __GMP_ABS(x) ((x) >= 0 ? (x) : -(x))
445173419cfSchristos #define __GMP_MAX(h,i) ((h) > (i) ? (h) : (i))
446173419cfSchristos
447173419cfSchristos
448173419cfSchristos /* __builtin_expect is in gcc 3.0, and not in 2.95. */
449173419cfSchristos #if __GMP_GNUC_PREREQ (3,0)
450173419cfSchristos #define __GMP_LIKELY(cond) __builtin_expect ((cond) != 0, 1)
451173419cfSchristos #define __GMP_UNLIKELY(cond) __builtin_expect ((cond) != 0, 0)
452173419cfSchristos #else
453173419cfSchristos #define __GMP_LIKELY(cond) (cond)
454173419cfSchristos #define __GMP_UNLIKELY(cond) (cond)
455173419cfSchristos #endif
456173419cfSchristos
457173419cfSchristos #ifdef _CRAY
458173419cfSchristos #define __GMP_CRAY_Pragma(str) _Pragma (str)
459173419cfSchristos #else
460173419cfSchristos #define __GMP_CRAY_Pragma(str)
461173419cfSchristos #endif
462173419cfSchristos
463173419cfSchristos
464173419cfSchristos /* Allow direct user access to numerator and denominator of an mpq_t object. */
465173419cfSchristos #define mpq_numref(Q) (&((Q)->_mp_num))
466173419cfSchristos #define mpq_denref(Q) (&((Q)->_mp_den))
467173419cfSchristos
468173419cfSchristos
469173419cfSchristos #if defined (__cplusplus)
470173419cfSchristos extern "C" {
471173419cfSchristos using std::FILE;
472173419cfSchristos #endif
473173419cfSchristos
474173419cfSchristos #define mp_set_memory_functions __gmp_set_memory_functions
475173419cfSchristos __GMP_DECLSPEC void mp_set_memory_functions (void *(*) (size_t),
476173419cfSchristos void *(*) (void *, size_t, size_t),
477173419cfSchristos void (*) (void *, size_t)) __GMP_NOTHROW;
478173419cfSchristos
479173419cfSchristos #define mp_get_memory_functions __gmp_get_memory_functions
480173419cfSchristos __GMP_DECLSPEC void mp_get_memory_functions (void *(**) (size_t),
481173419cfSchristos void *(**) (void *, size_t, size_t),
482173419cfSchristos void (**) (void *, size_t)) __GMP_NOTHROW;
483173419cfSchristos
484173419cfSchristos #define mp_bits_per_limb __gmp_bits_per_limb
485173419cfSchristos __GMP_DECLSPEC extern const int mp_bits_per_limb;
486173419cfSchristos
487173419cfSchristos #define gmp_errno __gmp_errno
488173419cfSchristos __GMP_DECLSPEC extern int gmp_errno;
489173419cfSchristos
490173419cfSchristos #define gmp_version __gmp_version
491173419cfSchristos __GMP_DECLSPEC extern const char * const gmp_version;
492173419cfSchristos
493173419cfSchristos
494173419cfSchristos /**************** Random number routines. ****************/
495173419cfSchristos
496173419cfSchristos /* obsolete */
497173419cfSchristos #define gmp_randinit __gmp_randinit
498173419cfSchristos __GMP_DECLSPEC void gmp_randinit (gmp_randstate_t, gmp_randalg_t, ...);
499173419cfSchristos
500173419cfSchristos #define gmp_randinit_default __gmp_randinit_default
501173419cfSchristos __GMP_DECLSPEC void gmp_randinit_default (gmp_randstate_t);
502173419cfSchristos
503173419cfSchristos #define gmp_randinit_lc_2exp __gmp_randinit_lc_2exp
504173419cfSchristos __GMP_DECLSPEC void gmp_randinit_lc_2exp (gmp_randstate_t, mpz_srcptr, unsigned long int, mp_bitcnt_t);
505173419cfSchristos
506173419cfSchristos #define gmp_randinit_lc_2exp_size __gmp_randinit_lc_2exp_size
507173419cfSchristos __GMP_DECLSPEC int gmp_randinit_lc_2exp_size (gmp_randstate_t, mp_bitcnt_t);
508173419cfSchristos
509173419cfSchristos #define gmp_randinit_mt __gmp_randinit_mt
510173419cfSchristos __GMP_DECLSPEC void gmp_randinit_mt (gmp_randstate_t);
511173419cfSchristos
512173419cfSchristos #define gmp_randinit_set __gmp_randinit_set
513173419cfSchristos __GMP_DECLSPEC void gmp_randinit_set (gmp_randstate_t, const __gmp_randstate_struct *);
514173419cfSchristos
515173419cfSchristos #define gmp_randseed __gmp_randseed
516173419cfSchristos __GMP_DECLSPEC void gmp_randseed (gmp_randstate_t, mpz_srcptr);
517173419cfSchristos
518173419cfSchristos #define gmp_randseed_ui __gmp_randseed_ui
519173419cfSchristos __GMP_DECLSPEC void gmp_randseed_ui (gmp_randstate_t, unsigned long int);
520173419cfSchristos
521173419cfSchristos #define gmp_randclear __gmp_randclear
522173419cfSchristos __GMP_DECLSPEC void gmp_randclear (gmp_randstate_t);
523173419cfSchristos
524173419cfSchristos #define gmp_urandomb_ui __gmp_urandomb_ui
525173419cfSchristos __GMP_DECLSPEC unsigned long gmp_urandomb_ui (gmp_randstate_t, unsigned long);
526173419cfSchristos
527173419cfSchristos #define gmp_urandomm_ui __gmp_urandomm_ui
528173419cfSchristos __GMP_DECLSPEC unsigned long gmp_urandomm_ui (gmp_randstate_t, unsigned long);
529173419cfSchristos
530173419cfSchristos
531173419cfSchristos /**************** Formatted output routines. ****************/
532173419cfSchristos
533173419cfSchristos #define gmp_asprintf __gmp_asprintf
534173419cfSchristos __GMP_DECLSPEC int gmp_asprintf (char **, const char *, ...);
535173419cfSchristos
536173419cfSchristos #define gmp_fprintf __gmp_fprintf
537173419cfSchristos #ifdef _GMP_H_HAVE_FILE
538173419cfSchristos __GMP_DECLSPEC int gmp_fprintf (FILE *, const char *, ...);
539173419cfSchristos #endif
540173419cfSchristos
541173419cfSchristos #define gmp_obstack_printf __gmp_obstack_printf
542173419cfSchristos #if defined (_GMP_H_HAVE_OBSTACK)
543173419cfSchristos __GMP_DECLSPEC int gmp_obstack_printf (struct obstack *, const char *, ...);
544173419cfSchristos #endif
545173419cfSchristos
546173419cfSchristos #define gmp_obstack_vprintf __gmp_obstack_vprintf
547173419cfSchristos #if defined (_GMP_H_HAVE_OBSTACK) && defined (_GMP_H_HAVE_VA_LIST)
548173419cfSchristos __GMP_DECLSPEC int gmp_obstack_vprintf (struct obstack *, const char *, va_list);
549173419cfSchristos #endif
550173419cfSchristos
551173419cfSchristos #define gmp_printf __gmp_printf
552173419cfSchristos __GMP_DECLSPEC int gmp_printf (const char *, ...);
553173419cfSchristos
554173419cfSchristos #define gmp_snprintf __gmp_snprintf
555173419cfSchristos __GMP_DECLSPEC int gmp_snprintf (char *, size_t, const char *, ...);
556173419cfSchristos
557173419cfSchristos #define gmp_sprintf __gmp_sprintf
558173419cfSchristos __GMP_DECLSPEC int gmp_sprintf (char *, const char *, ...);
559173419cfSchristos
560173419cfSchristos #define gmp_vasprintf __gmp_vasprintf
561173419cfSchristos #if defined (_GMP_H_HAVE_VA_LIST)
562173419cfSchristos __GMP_DECLSPEC int gmp_vasprintf (char **, const char *, va_list);
563173419cfSchristos #endif
564173419cfSchristos
565173419cfSchristos #define gmp_vfprintf __gmp_vfprintf
566173419cfSchristos #if defined (_GMP_H_HAVE_FILE) && defined (_GMP_H_HAVE_VA_LIST)
567173419cfSchristos __GMP_DECLSPEC int gmp_vfprintf (FILE *, const char *, va_list);
568173419cfSchristos #endif
569173419cfSchristos
570173419cfSchristos #define gmp_vprintf __gmp_vprintf
571173419cfSchristos #if defined (_GMP_H_HAVE_VA_LIST)
572173419cfSchristos __GMP_DECLSPEC int gmp_vprintf (const char *, va_list);
573173419cfSchristos #endif
574173419cfSchristos
575173419cfSchristos #define gmp_vsnprintf __gmp_vsnprintf
576173419cfSchristos #if defined (_GMP_H_HAVE_VA_LIST)
577173419cfSchristos __GMP_DECLSPEC int gmp_vsnprintf (char *, size_t, const char *, va_list);
578173419cfSchristos #endif
579173419cfSchristos
580173419cfSchristos #define gmp_vsprintf __gmp_vsprintf
581173419cfSchristos #if defined (_GMP_H_HAVE_VA_LIST)
582173419cfSchristos __GMP_DECLSPEC int gmp_vsprintf (char *, const char *, va_list);
583173419cfSchristos #endif
584173419cfSchristos
585173419cfSchristos
586173419cfSchristos /**************** Formatted input routines. ****************/
587173419cfSchristos
588173419cfSchristos #define gmp_fscanf __gmp_fscanf
589173419cfSchristos #ifdef _GMP_H_HAVE_FILE
590173419cfSchristos __GMP_DECLSPEC int gmp_fscanf (FILE *, const char *, ...);
591173419cfSchristos #endif
592173419cfSchristos
593173419cfSchristos #define gmp_scanf __gmp_scanf
594173419cfSchristos __GMP_DECLSPEC int gmp_scanf (const char *, ...);
595173419cfSchristos
596173419cfSchristos #define gmp_sscanf __gmp_sscanf
597173419cfSchristos __GMP_DECLSPEC int gmp_sscanf (const char *, const char *, ...);
598173419cfSchristos
599173419cfSchristos #define gmp_vfscanf __gmp_vfscanf
600173419cfSchristos #if defined (_GMP_H_HAVE_FILE) && defined (_GMP_H_HAVE_VA_LIST)
601173419cfSchristos __GMP_DECLSPEC int gmp_vfscanf (FILE *, const char *, va_list);
602173419cfSchristos #endif
603173419cfSchristos
604173419cfSchristos #define gmp_vscanf __gmp_vscanf
605173419cfSchristos #if defined (_GMP_H_HAVE_VA_LIST)
606173419cfSchristos __GMP_DECLSPEC int gmp_vscanf (const char *, va_list);
607173419cfSchristos #endif
608173419cfSchristos
609173419cfSchristos #define gmp_vsscanf __gmp_vsscanf
610173419cfSchristos #if defined (_GMP_H_HAVE_VA_LIST)
611173419cfSchristos __GMP_DECLSPEC int gmp_vsscanf (const char *, const char *, va_list);
612173419cfSchristos #endif
613173419cfSchristos
614173419cfSchristos
615173419cfSchristos /**************** Integer (i.e. Z) routines. ****************/
616173419cfSchristos
617173419cfSchristos #define _mpz_realloc __gmpz_realloc
618173419cfSchristos #define mpz_realloc __gmpz_realloc
619173419cfSchristos __GMP_DECLSPEC void *_mpz_realloc (mpz_ptr, mp_size_t);
620173419cfSchristos
621173419cfSchristos #define mpz_abs __gmpz_abs
622173419cfSchristos #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_abs)
623173419cfSchristos __GMP_DECLSPEC void mpz_abs (mpz_ptr, mpz_srcptr);
624173419cfSchristos #endif
625173419cfSchristos
626173419cfSchristos #define mpz_add __gmpz_add
627173419cfSchristos __GMP_DECLSPEC void mpz_add (mpz_ptr, mpz_srcptr, mpz_srcptr);
628173419cfSchristos
629173419cfSchristos #define mpz_add_ui __gmpz_add_ui
630173419cfSchristos __GMP_DECLSPEC void mpz_add_ui (mpz_ptr, mpz_srcptr, unsigned long int);
631173419cfSchristos
632173419cfSchristos #define mpz_addmul __gmpz_addmul
633173419cfSchristos __GMP_DECLSPEC void mpz_addmul (mpz_ptr, mpz_srcptr, mpz_srcptr);
634173419cfSchristos
635173419cfSchristos #define mpz_addmul_ui __gmpz_addmul_ui
636173419cfSchristos __GMP_DECLSPEC void mpz_addmul_ui (mpz_ptr, mpz_srcptr, unsigned long int);
637173419cfSchristos
638173419cfSchristos #define mpz_and __gmpz_and
639173419cfSchristos __GMP_DECLSPEC void mpz_and (mpz_ptr, mpz_srcptr, mpz_srcptr);
640173419cfSchristos
641173419cfSchristos #define mpz_array_init __gmpz_array_init
642173419cfSchristos __GMP_DECLSPEC void mpz_array_init (mpz_ptr, mp_size_t, mp_size_t);
643173419cfSchristos
644173419cfSchristos #define mpz_bin_ui __gmpz_bin_ui
645173419cfSchristos __GMP_DECLSPEC void mpz_bin_ui (mpz_ptr, mpz_srcptr, unsigned long int);
646173419cfSchristos
647173419cfSchristos #define mpz_bin_uiui __gmpz_bin_uiui
648173419cfSchristos __GMP_DECLSPEC void mpz_bin_uiui (mpz_ptr, unsigned long int, unsigned long int);
649173419cfSchristos
650173419cfSchristos #define mpz_cdiv_q __gmpz_cdiv_q
651173419cfSchristos __GMP_DECLSPEC void mpz_cdiv_q (mpz_ptr, mpz_srcptr, mpz_srcptr);
652173419cfSchristos
653173419cfSchristos #define mpz_cdiv_q_2exp __gmpz_cdiv_q_2exp
654173419cfSchristos __GMP_DECLSPEC void mpz_cdiv_q_2exp (mpz_ptr, mpz_srcptr, mp_bitcnt_t);
655173419cfSchristos
656173419cfSchristos #define mpz_cdiv_q_ui __gmpz_cdiv_q_ui
657173419cfSchristos __GMP_DECLSPEC unsigned long int mpz_cdiv_q_ui (mpz_ptr, mpz_srcptr, unsigned long int);
658173419cfSchristos
659173419cfSchristos #define mpz_cdiv_qr __gmpz_cdiv_qr
660173419cfSchristos __GMP_DECLSPEC void mpz_cdiv_qr (mpz_ptr, mpz_ptr, mpz_srcptr, mpz_srcptr);
661173419cfSchristos
662173419cfSchristos #define mpz_cdiv_qr_ui __gmpz_cdiv_qr_ui
663173419cfSchristos __GMP_DECLSPEC unsigned long int mpz_cdiv_qr_ui (mpz_ptr, mpz_ptr, mpz_srcptr, unsigned long int);
664173419cfSchristos
665173419cfSchristos #define mpz_cdiv_r __gmpz_cdiv_r
666173419cfSchristos __GMP_DECLSPEC void mpz_cdiv_r (mpz_ptr, mpz_srcptr, mpz_srcptr);
667173419cfSchristos
668173419cfSchristos #define mpz_cdiv_r_2exp __gmpz_cdiv_r_2exp
669173419cfSchristos __GMP_DECLSPEC void mpz_cdiv_r_2exp (mpz_ptr, mpz_srcptr, mp_bitcnt_t);
670173419cfSchristos
671173419cfSchristos #define mpz_cdiv_r_ui __gmpz_cdiv_r_ui
672173419cfSchristos __GMP_DECLSPEC unsigned long int mpz_cdiv_r_ui (mpz_ptr, mpz_srcptr, unsigned long int);
673173419cfSchristos
674173419cfSchristos #define mpz_cdiv_ui __gmpz_cdiv_ui
675173419cfSchristos __GMP_DECLSPEC unsigned long int mpz_cdiv_ui (mpz_srcptr, unsigned long int) __GMP_ATTRIBUTE_PURE;
676173419cfSchristos
677173419cfSchristos #define mpz_clear __gmpz_clear
678173419cfSchristos __GMP_DECLSPEC void mpz_clear (mpz_ptr);
679173419cfSchristos
680173419cfSchristos #define mpz_clears __gmpz_clears
681173419cfSchristos __GMP_DECLSPEC void mpz_clears (mpz_ptr, ...);
682173419cfSchristos
683173419cfSchristos #define mpz_clrbit __gmpz_clrbit
684173419cfSchristos __GMP_DECLSPEC void mpz_clrbit (mpz_ptr, mp_bitcnt_t);
685173419cfSchristos
686173419cfSchristos #define mpz_cmp __gmpz_cmp
687173419cfSchristos __GMP_DECLSPEC int mpz_cmp (mpz_srcptr, mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
688173419cfSchristos
689173419cfSchristos #define mpz_cmp_d __gmpz_cmp_d
690173419cfSchristos __GMP_DECLSPEC int mpz_cmp_d (mpz_srcptr, double) __GMP_ATTRIBUTE_PURE;
691173419cfSchristos
692173419cfSchristos #define _mpz_cmp_si __gmpz_cmp_si
693173419cfSchristos __GMP_DECLSPEC int _mpz_cmp_si (mpz_srcptr, signed long int) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
694173419cfSchristos
695173419cfSchristos #define _mpz_cmp_ui __gmpz_cmp_ui
696173419cfSchristos __GMP_DECLSPEC int _mpz_cmp_ui (mpz_srcptr, unsigned long int) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
697173419cfSchristos
698173419cfSchristos #define mpz_cmpabs __gmpz_cmpabs
699173419cfSchristos __GMP_DECLSPEC int mpz_cmpabs (mpz_srcptr, mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
700173419cfSchristos
701173419cfSchristos #define mpz_cmpabs_d __gmpz_cmpabs_d
702173419cfSchristos __GMP_DECLSPEC int mpz_cmpabs_d (mpz_srcptr, double) __GMP_ATTRIBUTE_PURE;
703173419cfSchristos
704173419cfSchristos #define mpz_cmpabs_ui __gmpz_cmpabs_ui
705173419cfSchristos __GMP_DECLSPEC int mpz_cmpabs_ui (mpz_srcptr, unsigned long int) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
706173419cfSchristos
707173419cfSchristos #define mpz_com __gmpz_com
708173419cfSchristos __GMP_DECLSPEC void mpz_com (mpz_ptr, mpz_srcptr);
709173419cfSchristos
710173419cfSchristos #define mpz_combit __gmpz_combit
711173419cfSchristos __GMP_DECLSPEC void mpz_combit (mpz_ptr, mp_bitcnt_t);
712173419cfSchristos
713173419cfSchristos #define mpz_congruent_p __gmpz_congruent_p
714173419cfSchristos __GMP_DECLSPEC int mpz_congruent_p (mpz_srcptr, mpz_srcptr, mpz_srcptr) __GMP_ATTRIBUTE_PURE;
715173419cfSchristos
716173419cfSchristos #define mpz_congruent_2exp_p __gmpz_congruent_2exp_p
717173419cfSchristos __GMP_DECLSPEC int mpz_congruent_2exp_p (mpz_srcptr, mpz_srcptr, mp_bitcnt_t) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
718173419cfSchristos
719173419cfSchristos #define mpz_congruent_ui_p __gmpz_congruent_ui_p
720173419cfSchristos __GMP_DECLSPEC int mpz_congruent_ui_p (mpz_srcptr, unsigned long, unsigned long) __GMP_ATTRIBUTE_PURE;
721173419cfSchristos
722173419cfSchristos #define mpz_divexact __gmpz_divexact
723173419cfSchristos __GMP_DECLSPEC void mpz_divexact (mpz_ptr, mpz_srcptr, mpz_srcptr);
724173419cfSchristos
725173419cfSchristos #define mpz_divexact_ui __gmpz_divexact_ui
726173419cfSchristos __GMP_DECLSPEC void mpz_divexact_ui (mpz_ptr, mpz_srcptr, unsigned long);
727173419cfSchristos
728173419cfSchristos #define mpz_divisible_p __gmpz_divisible_p
729173419cfSchristos __GMP_DECLSPEC int mpz_divisible_p (mpz_srcptr, mpz_srcptr) __GMP_ATTRIBUTE_PURE;
730173419cfSchristos
731173419cfSchristos #define mpz_divisible_ui_p __gmpz_divisible_ui_p
732173419cfSchristos __GMP_DECLSPEC int mpz_divisible_ui_p (mpz_srcptr, unsigned long) __GMP_ATTRIBUTE_PURE;
733173419cfSchristos
734173419cfSchristos #define mpz_divisible_2exp_p __gmpz_divisible_2exp_p
735173419cfSchristos __GMP_DECLSPEC int mpz_divisible_2exp_p (mpz_srcptr, mp_bitcnt_t) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
736173419cfSchristos
737173419cfSchristos #define mpz_dump __gmpz_dump
738173419cfSchristos __GMP_DECLSPEC void mpz_dump (mpz_srcptr);
739173419cfSchristos
740173419cfSchristos #define mpz_export __gmpz_export
741173419cfSchristos __GMP_DECLSPEC void *mpz_export (void *, size_t *, int, size_t, int, size_t, mpz_srcptr);
742173419cfSchristos
743173419cfSchristos #define mpz_fac_ui __gmpz_fac_ui
744173419cfSchristos __GMP_DECLSPEC void mpz_fac_ui (mpz_ptr, unsigned long int);
745173419cfSchristos
746173419cfSchristos #define mpz_2fac_ui __gmpz_2fac_ui
747173419cfSchristos __GMP_DECLSPEC void mpz_2fac_ui (mpz_ptr, unsigned long int);
748173419cfSchristos
749173419cfSchristos #define mpz_mfac_uiui __gmpz_mfac_uiui
750173419cfSchristos __GMP_DECLSPEC void mpz_mfac_uiui (mpz_ptr, unsigned long int, unsigned long int);
751173419cfSchristos
752173419cfSchristos #define mpz_primorial_ui __gmpz_primorial_ui
753173419cfSchristos __GMP_DECLSPEC void mpz_primorial_ui (mpz_ptr, unsigned long int);
754173419cfSchristos
755173419cfSchristos #define mpz_fdiv_q __gmpz_fdiv_q
756173419cfSchristos __GMP_DECLSPEC void mpz_fdiv_q (mpz_ptr, mpz_srcptr, mpz_srcptr);
757173419cfSchristos
758173419cfSchristos #define mpz_fdiv_q_2exp __gmpz_fdiv_q_2exp
759173419cfSchristos __GMP_DECLSPEC void mpz_fdiv_q_2exp (mpz_ptr, mpz_srcptr, mp_bitcnt_t);
760173419cfSchristos
761173419cfSchristos #define mpz_fdiv_q_ui __gmpz_fdiv_q_ui
762173419cfSchristos __GMP_DECLSPEC unsigned long int mpz_fdiv_q_ui (mpz_ptr, mpz_srcptr, unsigned long int);
763173419cfSchristos
764173419cfSchristos #define mpz_fdiv_qr __gmpz_fdiv_qr
765173419cfSchristos __GMP_DECLSPEC void mpz_fdiv_qr (mpz_ptr, mpz_ptr, mpz_srcptr, mpz_srcptr);
766173419cfSchristos
767173419cfSchristos #define mpz_fdiv_qr_ui __gmpz_fdiv_qr_ui
768173419cfSchristos __GMP_DECLSPEC unsigned long int mpz_fdiv_qr_ui (mpz_ptr, mpz_ptr, mpz_srcptr, unsigned long int);
769173419cfSchristos
770173419cfSchristos #define mpz_fdiv_r __gmpz_fdiv_r
771173419cfSchristos __GMP_DECLSPEC void mpz_fdiv_r (mpz_ptr, mpz_srcptr, mpz_srcptr);
772173419cfSchristos
773173419cfSchristos #define mpz_fdiv_r_2exp __gmpz_fdiv_r_2exp
774173419cfSchristos __GMP_DECLSPEC void mpz_fdiv_r_2exp (mpz_ptr, mpz_srcptr, mp_bitcnt_t);
775173419cfSchristos
776173419cfSchristos #define mpz_fdiv_r_ui __gmpz_fdiv_r_ui
777173419cfSchristos __GMP_DECLSPEC unsigned long int mpz_fdiv_r_ui (mpz_ptr, mpz_srcptr, unsigned long int);
778173419cfSchristos
779173419cfSchristos #define mpz_fdiv_ui __gmpz_fdiv_ui
780173419cfSchristos __GMP_DECLSPEC unsigned long int mpz_fdiv_ui (mpz_srcptr, unsigned long int) __GMP_ATTRIBUTE_PURE;
781173419cfSchristos
782173419cfSchristos #define mpz_fib_ui __gmpz_fib_ui
783173419cfSchristos __GMP_DECLSPEC void mpz_fib_ui (mpz_ptr, unsigned long int);
784173419cfSchristos
785173419cfSchristos #define mpz_fib2_ui __gmpz_fib2_ui
786173419cfSchristos __GMP_DECLSPEC void mpz_fib2_ui (mpz_ptr, mpz_ptr, unsigned long int);
787173419cfSchristos
788173419cfSchristos #define mpz_fits_sint_p __gmpz_fits_sint_p
789173419cfSchristos __GMP_DECLSPEC int mpz_fits_sint_p (mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
790173419cfSchristos
791173419cfSchristos #define mpz_fits_slong_p __gmpz_fits_slong_p
792173419cfSchristos __GMP_DECLSPEC int mpz_fits_slong_p (mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
793173419cfSchristos
794173419cfSchristos #define mpz_fits_sshort_p __gmpz_fits_sshort_p
795173419cfSchristos __GMP_DECLSPEC int mpz_fits_sshort_p (mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
796173419cfSchristos
797173419cfSchristos #define mpz_fits_uint_p __gmpz_fits_uint_p
798173419cfSchristos #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_fits_uint_p)
799173419cfSchristos __GMP_DECLSPEC int mpz_fits_uint_p (mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
800173419cfSchristos #endif
801173419cfSchristos
802173419cfSchristos #define mpz_fits_ulong_p __gmpz_fits_ulong_p
803173419cfSchristos #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_fits_ulong_p)
804173419cfSchristos __GMP_DECLSPEC int mpz_fits_ulong_p (mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
805173419cfSchristos #endif
806173419cfSchristos
807173419cfSchristos #define mpz_fits_ushort_p __gmpz_fits_ushort_p
808173419cfSchristos #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_fits_ushort_p)
809173419cfSchristos __GMP_DECLSPEC int mpz_fits_ushort_p (mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
810173419cfSchristos #endif
811173419cfSchristos
812173419cfSchristos #define mpz_gcd __gmpz_gcd
813173419cfSchristos __GMP_DECLSPEC void mpz_gcd (mpz_ptr, mpz_srcptr, mpz_srcptr);
814173419cfSchristos
815173419cfSchristos #define mpz_gcd_ui __gmpz_gcd_ui
816173419cfSchristos __GMP_DECLSPEC unsigned long int mpz_gcd_ui (mpz_ptr, mpz_srcptr, unsigned long int);
817173419cfSchristos
818173419cfSchristos #define mpz_gcdext __gmpz_gcdext
819173419cfSchristos __GMP_DECLSPEC void mpz_gcdext (mpz_ptr, mpz_ptr, mpz_ptr, mpz_srcptr, mpz_srcptr);
820173419cfSchristos
821173419cfSchristos #define mpz_get_d __gmpz_get_d
822173419cfSchristos __GMP_DECLSPEC double mpz_get_d (mpz_srcptr) __GMP_ATTRIBUTE_PURE;
823173419cfSchristos
824173419cfSchristos #define mpz_get_d_2exp __gmpz_get_d_2exp
825173419cfSchristos __GMP_DECLSPEC double mpz_get_d_2exp (signed long int *, mpz_srcptr);
826173419cfSchristos
827173419cfSchristos #define mpz_get_si __gmpz_get_si
828173419cfSchristos __GMP_DECLSPEC /* signed */ long int mpz_get_si (mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
829173419cfSchristos
830173419cfSchristos #define mpz_get_str __gmpz_get_str
831173419cfSchristos __GMP_DECLSPEC char *mpz_get_str (char *, int, mpz_srcptr);
832173419cfSchristos
833173419cfSchristos #define mpz_get_ui __gmpz_get_ui
834173419cfSchristos #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_get_ui)
835173419cfSchristos __GMP_DECLSPEC unsigned long int mpz_get_ui (mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
836173419cfSchristos #endif
837173419cfSchristos
838173419cfSchristos #define mpz_getlimbn __gmpz_getlimbn
839173419cfSchristos #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_getlimbn)
840173419cfSchristos __GMP_DECLSPEC mp_limb_t mpz_getlimbn (mpz_srcptr, mp_size_t) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
841173419cfSchristos #endif
842173419cfSchristos
843173419cfSchristos #define mpz_hamdist __gmpz_hamdist
844173419cfSchristos __GMP_DECLSPEC mp_bitcnt_t mpz_hamdist (mpz_srcptr, mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
845173419cfSchristos
846173419cfSchristos #define mpz_import __gmpz_import
847173419cfSchristos __GMP_DECLSPEC void mpz_import (mpz_ptr, size_t, int, size_t, int, size_t, const void *);
848173419cfSchristos
849173419cfSchristos #define mpz_init __gmpz_init
850173419cfSchristos __GMP_DECLSPEC void mpz_init (mpz_ptr) __GMP_NOTHROW;
851173419cfSchristos
852173419cfSchristos #define mpz_init2 __gmpz_init2
853173419cfSchristos __GMP_DECLSPEC void mpz_init2 (mpz_ptr, mp_bitcnt_t);
854173419cfSchristos
855173419cfSchristos #define mpz_inits __gmpz_inits
856173419cfSchristos __GMP_DECLSPEC void mpz_inits (mpz_ptr, ...) __GMP_NOTHROW;
857173419cfSchristos
858173419cfSchristos #define mpz_init_set __gmpz_init_set
859173419cfSchristos __GMP_DECLSPEC void mpz_init_set (mpz_ptr, mpz_srcptr);
860173419cfSchristos
861173419cfSchristos #define mpz_init_set_d __gmpz_init_set_d
862173419cfSchristos __GMP_DECLSPEC void mpz_init_set_d (mpz_ptr, double);
863173419cfSchristos
864173419cfSchristos #define mpz_init_set_si __gmpz_init_set_si
865173419cfSchristos __GMP_DECLSPEC void mpz_init_set_si (mpz_ptr, signed long int);
866173419cfSchristos
867173419cfSchristos #define mpz_init_set_str __gmpz_init_set_str
868173419cfSchristos __GMP_DECLSPEC int mpz_init_set_str (mpz_ptr, const char *, int);
869173419cfSchristos
870173419cfSchristos #define mpz_init_set_ui __gmpz_init_set_ui
871173419cfSchristos __GMP_DECLSPEC void mpz_init_set_ui (mpz_ptr, unsigned long int);
872173419cfSchristos
873173419cfSchristos #define mpz_inp_raw __gmpz_inp_raw
874173419cfSchristos #ifdef _GMP_H_HAVE_FILE
875173419cfSchristos __GMP_DECLSPEC size_t mpz_inp_raw (mpz_ptr, FILE *);
876173419cfSchristos #endif
877173419cfSchristos
878173419cfSchristos #define mpz_inp_str __gmpz_inp_str
879173419cfSchristos #ifdef _GMP_H_HAVE_FILE
880173419cfSchristos __GMP_DECLSPEC size_t mpz_inp_str (mpz_ptr, FILE *, int);
881173419cfSchristos #endif
882173419cfSchristos
883173419cfSchristos #define mpz_invert __gmpz_invert
884173419cfSchristos __GMP_DECLSPEC int mpz_invert (mpz_ptr, mpz_srcptr, mpz_srcptr);
885173419cfSchristos
886173419cfSchristos #define mpz_ior __gmpz_ior
887173419cfSchristos __GMP_DECLSPEC void mpz_ior (mpz_ptr, mpz_srcptr, mpz_srcptr);
888173419cfSchristos
889173419cfSchristos #define mpz_jacobi __gmpz_jacobi
890173419cfSchristos __GMP_DECLSPEC int mpz_jacobi (mpz_srcptr, mpz_srcptr) __GMP_ATTRIBUTE_PURE;
891173419cfSchristos
892173419cfSchristos #define mpz_kronecker mpz_jacobi /* alias */
893173419cfSchristos
894173419cfSchristos #define mpz_kronecker_si __gmpz_kronecker_si
895173419cfSchristos __GMP_DECLSPEC int mpz_kronecker_si (mpz_srcptr, long) __GMP_ATTRIBUTE_PURE;
896173419cfSchristos
897173419cfSchristos #define mpz_kronecker_ui __gmpz_kronecker_ui
898173419cfSchristos __GMP_DECLSPEC int mpz_kronecker_ui (mpz_srcptr, unsigned long) __GMP_ATTRIBUTE_PURE;
899173419cfSchristos
900173419cfSchristos #define mpz_si_kronecker __gmpz_si_kronecker
901173419cfSchristos __GMP_DECLSPEC int mpz_si_kronecker (long, mpz_srcptr) __GMP_ATTRIBUTE_PURE;
902173419cfSchristos
903173419cfSchristos #define mpz_ui_kronecker __gmpz_ui_kronecker
904173419cfSchristos __GMP_DECLSPEC int mpz_ui_kronecker (unsigned long, mpz_srcptr) __GMP_ATTRIBUTE_PURE;
905173419cfSchristos
906173419cfSchristos #define mpz_lcm __gmpz_lcm
907173419cfSchristos __GMP_DECLSPEC void mpz_lcm (mpz_ptr, mpz_srcptr, mpz_srcptr);
908173419cfSchristos
909173419cfSchristos #define mpz_lcm_ui __gmpz_lcm_ui
910173419cfSchristos __GMP_DECLSPEC void mpz_lcm_ui (mpz_ptr, mpz_srcptr, unsigned long);
911173419cfSchristos
912173419cfSchristos #define mpz_legendre mpz_jacobi /* alias */
913173419cfSchristos
914173419cfSchristos #define mpz_lucnum_ui __gmpz_lucnum_ui
915173419cfSchristos __GMP_DECLSPEC void mpz_lucnum_ui (mpz_ptr, unsigned long int);
916173419cfSchristos
917173419cfSchristos #define mpz_lucnum2_ui __gmpz_lucnum2_ui
918173419cfSchristos __GMP_DECLSPEC void mpz_lucnum2_ui (mpz_ptr, mpz_ptr, unsigned long int);
919173419cfSchristos
920173419cfSchristos #define mpz_millerrabin __gmpz_millerrabin
921173419cfSchristos __GMP_DECLSPEC int mpz_millerrabin (mpz_srcptr, int) __GMP_ATTRIBUTE_PURE;
922173419cfSchristos
923173419cfSchristos #define mpz_mod __gmpz_mod
924173419cfSchristos __GMP_DECLSPEC void mpz_mod (mpz_ptr, mpz_srcptr, mpz_srcptr);
925173419cfSchristos
926173419cfSchristos #define mpz_mod_ui mpz_fdiv_r_ui /* same as fdiv_r because divisor unsigned */
927173419cfSchristos
928173419cfSchristos #define mpz_mul __gmpz_mul
929173419cfSchristos __GMP_DECLSPEC void mpz_mul (mpz_ptr, mpz_srcptr, mpz_srcptr);
930173419cfSchristos
931173419cfSchristos #define mpz_mul_2exp __gmpz_mul_2exp
932173419cfSchristos __GMP_DECLSPEC void mpz_mul_2exp (mpz_ptr, mpz_srcptr, mp_bitcnt_t);
933173419cfSchristos
934173419cfSchristos #define mpz_mul_si __gmpz_mul_si
935173419cfSchristos __GMP_DECLSPEC void mpz_mul_si (mpz_ptr, mpz_srcptr, long int);
936173419cfSchristos
937173419cfSchristos #define mpz_mul_ui __gmpz_mul_ui
938173419cfSchristos __GMP_DECLSPEC void mpz_mul_ui (mpz_ptr, mpz_srcptr, unsigned long int);
939173419cfSchristos
940173419cfSchristos #define mpz_neg __gmpz_neg
941173419cfSchristos #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_neg)
942173419cfSchristos __GMP_DECLSPEC void mpz_neg (mpz_ptr, mpz_srcptr);
943173419cfSchristos #endif
944173419cfSchristos
945173419cfSchristos #define mpz_nextprime __gmpz_nextprime
946173419cfSchristos __GMP_DECLSPEC void mpz_nextprime (mpz_ptr, mpz_srcptr);
947173419cfSchristos
948173419cfSchristos #define mpz_out_raw __gmpz_out_raw
949173419cfSchristos #ifdef _GMP_H_HAVE_FILE
950173419cfSchristos __GMP_DECLSPEC size_t mpz_out_raw (FILE *, mpz_srcptr);
951173419cfSchristos #endif
952173419cfSchristos
953173419cfSchristos #define mpz_out_str __gmpz_out_str
954173419cfSchristos #ifdef _GMP_H_HAVE_FILE
955173419cfSchristos __GMP_DECLSPEC size_t mpz_out_str (FILE *, int, mpz_srcptr);
956173419cfSchristos #endif
957173419cfSchristos
958173419cfSchristos #define mpz_perfect_power_p __gmpz_perfect_power_p
959173419cfSchristos __GMP_DECLSPEC int mpz_perfect_power_p (mpz_srcptr) __GMP_ATTRIBUTE_PURE;
960173419cfSchristos
961173419cfSchristos #define mpz_perfect_square_p __gmpz_perfect_square_p
962173419cfSchristos #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_perfect_square_p)
963173419cfSchristos __GMP_DECLSPEC int mpz_perfect_square_p (mpz_srcptr) __GMP_ATTRIBUTE_PURE;
964173419cfSchristos #endif
965173419cfSchristos
966173419cfSchristos #define mpz_popcount __gmpz_popcount
967173419cfSchristos #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_popcount)
968173419cfSchristos __GMP_DECLSPEC mp_bitcnt_t mpz_popcount (mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
969173419cfSchristos #endif
970173419cfSchristos
971173419cfSchristos #define mpz_pow_ui __gmpz_pow_ui
972173419cfSchristos __GMP_DECLSPEC void mpz_pow_ui (mpz_ptr, mpz_srcptr, unsigned long int);
973173419cfSchristos
974173419cfSchristos #define mpz_powm __gmpz_powm
975173419cfSchristos __GMP_DECLSPEC void mpz_powm (mpz_ptr, mpz_srcptr, mpz_srcptr, mpz_srcptr);
976173419cfSchristos
977173419cfSchristos #define mpz_powm_sec __gmpz_powm_sec
978173419cfSchristos __GMP_DECLSPEC void mpz_powm_sec (mpz_ptr, mpz_srcptr, mpz_srcptr, mpz_srcptr);
979173419cfSchristos
980173419cfSchristos #define mpz_powm_ui __gmpz_powm_ui
981173419cfSchristos __GMP_DECLSPEC void mpz_powm_ui (mpz_ptr, mpz_srcptr, unsigned long int, mpz_srcptr);
982173419cfSchristos
983173419cfSchristos #define mpz_probab_prime_p __gmpz_probab_prime_p
984173419cfSchristos __GMP_DECLSPEC int mpz_probab_prime_p (mpz_srcptr, int) __GMP_ATTRIBUTE_PURE;
985173419cfSchristos
986173419cfSchristos #define mpz_random __gmpz_random
987173419cfSchristos __GMP_DECLSPEC void mpz_random (mpz_ptr, mp_size_t);
988173419cfSchristos
989173419cfSchristos #define mpz_random2 __gmpz_random2
990173419cfSchristos __GMP_DECLSPEC void mpz_random2 (mpz_ptr, mp_size_t);
991173419cfSchristos
992173419cfSchristos #define mpz_realloc2 __gmpz_realloc2
993173419cfSchristos __GMP_DECLSPEC void mpz_realloc2 (mpz_ptr, mp_bitcnt_t);
994173419cfSchristos
995173419cfSchristos #define mpz_remove __gmpz_remove
996173419cfSchristos __GMP_DECLSPEC mp_bitcnt_t mpz_remove (mpz_ptr, mpz_srcptr, mpz_srcptr);
997173419cfSchristos
998173419cfSchristos #define mpz_root __gmpz_root
999173419cfSchristos __GMP_DECLSPEC int mpz_root (mpz_ptr, mpz_srcptr, unsigned long int);
1000173419cfSchristos
1001173419cfSchristos #define mpz_rootrem __gmpz_rootrem
1002173419cfSchristos __GMP_DECLSPEC void mpz_rootrem (mpz_ptr, mpz_ptr, mpz_srcptr, unsigned long int);
1003173419cfSchristos
1004173419cfSchristos #define mpz_rrandomb __gmpz_rrandomb
1005173419cfSchristos __GMP_DECLSPEC void mpz_rrandomb (mpz_ptr, gmp_randstate_t, mp_bitcnt_t);
1006173419cfSchristos
1007173419cfSchristos #define mpz_scan0 __gmpz_scan0
1008173419cfSchristos __GMP_DECLSPEC mp_bitcnt_t mpz_scan0 (mpz_srcptr, mp_bitcnt_t) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
1009173419cfSchristos
1010173419cfSchristos #define mpz_scan1 __gmpz_scan1
1011173419cfSchristos __GMP_DECLSPEC mp_bitcnt_t mpz_scan1 (mpz_srcptr, mp_bitcnt_t) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
1012173419cfSchristos
1013173419cfSchristos #define mpz_set __gmpz_set
1014173419cfSchristos __GMP_DECLSPEC void mpz_set (mpz_ptr, mpz_srcptr);
1015173419cfSchristos
1016173419cfSchristos #define mpz_set_d __gmpz_set_d
1017173419cfSchristos __GMP_DECLSPEC void mpz_set_d (mpz_ptr, double);
1018173419cfSchristos
1019173419cfSchristos #define mpz_set_f __gmpz_set_f
1020173419cfSchristos __GMP_DECLSPEC void mpz_set_f (mpz_ptr, mpf_srcptr);
1021173419cfSchristos
1022173419cfSchristos #define mpz_set_q __gmpz_set_q
1023173419cfSchristos #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_set_q)
1024173419cfSchristos __GMP_DECLSPEC void mpz_set_q (mpz_ptr, mpq_srcptr);
1025173419cfSchristos #endif
1026173419cfSchristos
1027173419cfSchristos #define mpz_set_si __gmpz_set_si
1028173419cfSchristos __GMP_DECLSPEC void mpz_set_si (mpz_ptr, signed long int);
1029173419cfSchristos
1030173419cfSchristos #define mpz_set_str __gmpz_set_str
1031173419cfSchristos __GMP_DECLSPEC int mpz_set_str (mpz_ptr, const char *, int);
1032173419cfSchristos
1033173419cfSchristos #define mpz_set_ui __gmpz_set_ui
1034173419cfSchristos __GMP_DECLSPEC void mpz_set_ui (mpz_ptr, unsigned long int);
1035173419cfSchristos
1036173419cfSchristos #define mpz_setbit __gmpz_setbit
1037173419cfSchristos __GMP_DECLSPEC void mpz_setbit (mpz_ptr, mp_bitcnt_t);
1038173419cfSchristos
1039173419cfSchristos #define mpz_size __gmpz_size
1040173419cfSchristos #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_size)
1041173419cfSchristos __GMP_DECLSPEC size_t mpz_size (mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
1042173419cfSchristos #endif
1043173419cfSchristos
1044173419cfSchristos #define mpz_sizeinbase __gmpz_sizeinbase
1045173419cfSchristos __GMP_DECLSPEC size_t mpz_sizeinbase (mpz_srcptr, int) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
1046173419cfSchristos
1047173419cfSchristos #define mpz_sqrt __gmpz_sqrt
1048173419cfSchristos __GMP_DECLSPEC void mpz_sqrt (mpz_ptr, mpz_srcptr);
1049173419cfSchristos
1050173419cfSchristos #define mpz_sqrtrem __gmpz_sqrtrem
1051173419cfSchristos __GMP_DECLSPEC void mpz_sqrtrem (mpz_ptr, mpz_ptr, mpz_srcptr);
1052173419cfSchristos
1053173419cfSchristos #define mpz_sub __gmpz_sub
1054173419cfSchristos __GMP_DECLSPEC void mpz_sub (mpz_ptr, mpz_srcptr, mpz_srcptr);
1055173419cfSchristos
1056173419cfSchristos #define mpz_sub_ui __gmpz_sub_ui
1057173419cfSchristos __GMP_DECLSPEC void mpz_sub_ui (mpz_ptr, mpz_srcptr, unsigned long int);
1058173419cfSchristos
1059173419cfSchristos #define mpz_ui_sub __gmpz_ui_sub
1060173419cfSchristos __GMP_DECLSPEC void mpz_ui_sub (mpz_ptr, unsigned long int, mpz_srcptr);
1061173419cfSchristos
1062173419cfSchristos #define mpz_submul __gmpz_submul
1063173419cfSchristos __GMP_DECLSPEC void mpz_submul (mpz_ptr, mpz_srcptr, mpz_srcptr);
1064173419cfSchristos
1065173419cfSchristos #define mpz_submul_ui __gmpz_submul_ui
1066173419cfSchristos __GMP_DECLSPEC void mpz_submul_ui (mpz_ptr, mpz_srcptr, unsigned long int);
1067173419cfSchristos
1068173419cfSchristos #define mpz_swap __gmpz_swap
1069173419cfSchristos __GMP_DECLSPEC void mpz_swap (mpz_ptr, mpz_ptr) __GMP_NOTHROW;
1070173419cfSchristos
1071173419cfSchristos #define mpz_tdiv_ui __gmpz_tdiv_ui
1072173419cfSchristos __GMP_DECLSPEC unsigned long int mpz_tdiv_ui (mpz_srcptr, unsigned long int) __GMP_ATTRIBUTE_PURE;
1073173419cfSchristos
1074173419cfSchristos #define mpz_tdiv_q __gmpz_tdiv_q
1075173419cfSchristos __GMP_DECLSPEC void mpz_tdiv_q (mpz_ptr, mpz_srcptr, mpz_srcptr);
1076173419cfSchristos
1077173419cfSchristos #define mpz_tdiv_q_2exp __gmpz_tdiv_q_2exp
1078173419cfSchristos __GMP_DECLSPEC void mpz_tdiv_q_2exp (mpz_ptr, mpz_srcptr, mp_bitcnt_t);
1079173419cfSchristos
1080173419cfSchristos #define mpz_tdiv_q_ui __gmpz_tdiv_q_ui
1081173419cfSchristos __GMP_DECLSPEC unsigned long int mpz_tdiv_q_ui (mpz_ptr, mpz_srcptr, unsigned long int);
1082173419cfSchristos
1083173419cfSchristos #define mpz_tdiv_qr __gmpz_tdiv_qr
1084173419cfSchristos __GMP_DECLSPEC void mpz_tdiv_qr (mpz_ptr, mpz_ptr, mpz_srcptr, mpz_srcptr);
1085173419cfSchristos
1086173419cfSchristos #define mpz_tdiv_qr_ui __gmpz_tdiv_qr_ui
1087173419cfSchristos __GMP_DECLSPEC unsigned long int mpz_tdiv_qr_ui (mpz_ptr, mpz_ptr, mpz_srcptr, unsigned long int);
1088173419cfSchristos
1089173419cfSchristos #define mpz_tdiv_r __gmpz_tdiv_r
1090173419cfSchristos __GMP_DECLSPEC void mpz_tdiv_r (mpz_ptr, mpz_srcptr, mpz_srcptr);
1091173419cfSchristos
1092173419cfSchristos #define mpz_tdiv_r_2exp __gmpz_tdiv_r_2exp
1093173419cfSchristos __GMP_DECLSPEC void mpz_tdiv_r_2exp (mpz_ptr, mpz_srcptr, mp_bitcnt_t);
1094173419cfSchristos
1095173419cfSchristos #define mpz_tdiv_r_ui __gmpz_tdiv_r_ui
1096173419cfSchristos __GMP_DECLSPEC unsigned long int mpz_tdiv_r_ui (mpz_ptr, mpz_srcptr, unsigned long int);
1097173419cfSchristos
1098173419cfSchristos #define mpz_tstbit __gmpz_tstbit
1099173419cfSchristos __GMP_DECLSPEC int mpz_tstbit (mpz_srcptr, mp_bitcnt_t) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
1100173419cfSchristos
1101173419cfSchristos #define mpz_ui_pow_ui __gmpz_ui_pow_ui
1102173419cfSchristos __GMP_DECLSPEC void mpz_ui_pow_ui (mpz_ptr, unsigned long int, unsigned long int);
1103173419cfSchristos
1104173419cfSchristos #define mpz_urandomb __gmpz_urandomb
1105173419cfSchristos __GMP_DECLSPEC void mpz_urandomb (mpz_ptr, gmp_randstate_t, mp_bitcnt_t);
1106173419cfSchristos
1107173419cfSchristos #define mpz_urandomm __gmpz_urandomm
1108173419cfSchristos __GMP_DECLSPEC void mpz_urandomm (mpz_ptr, gmp_randstate_t, mpz_srcptr);
1109173419cfSchristos
1110173419cfSchristos #define mpz_xor __gmpz_xor
1111173419cfSchristos #define mpz_eor __gmpz_xor
1112173419cfSchristos __GMP_DECLSPEC void mpz_xor (mpz_ptr, mpz_srcptr, mpz_srcptr);
1113173419cfSchristos
1114173419cfSchristos #define mpz_limbs_read __gmpz_limbs_read
1115173419cfSchristos __GMP_DECLSPEC mp_srcptr mpz_limbs_read (mpz_srcptr);
1116173419cfSchristos
1117173419cfSchristos #define mpz_limbs_write __gmpz_limbs_write
1118173419cfSchristos __GMP_DECLSPEC mp_ptr mpz_limbs_write (mpz_ptr, mp_size_t);
1119173419cfSchristos
1120173419cfSchristos #define mpz_limbs_modify __gmpz_limbs_modify
1121173419cfSchristos __GMP_DECLSPEC mp_ptr mpz_limbs_modify (mpz_ptr, mp_size_t);
1122173419cfSchristos
1123173419cfSchristos #define mpz_limbs_finish __gmpz_limbs_finish
1124173419cfSchristos __GMP_DECLSPEC void mpz_limbs_finish (mpz_ptr, mp_size_t);
1125173419cfSchristos
1126173419cfSchristos #define mpz_roinit_n __gmpz_roinit_n
1127173419cfSchristos __GMP_DECLSPEC mpz_srcptr mpz_roinit_n (mpz_ptr, mp_srcptr, mp_size_t);
1128173419cfSchristos
1129173419cfSchristos #define MPZ_ROINIT_N(xp, xs) {{0, (xs),(xp) }}
1130173419cfSchristos
1131173419cfSchristos /**************** Rational (i.e. Q) routines. ****************/
1132173419cfSchristos
1133173419cfSchristos #define mpq_abs __gmpq_abs
1134173419cfSchristos #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpq_abs)
1135173419cfSchristos __GMP_DECLSPEC void mpq_abs (mpq_ptr, mpq_srcptr);
1136173419cfSchristos #endif
1137173419cfSchristos
1138173419cfSchristos #define mpq_add __gmpq_add
1139173419cfSchristos __GMP_DECLSPEC void mpq_add (mpq_ptr, mpq_srcptr, mpq_srcptr);
1140173419cfSchristos
1141173419cfSchristos #define mpq_canonicalize __gmpq_canonicalize
1142173419cfSchristos __GMP_DECLSPEC void mpq_canonicalize (mpq_ptr);
1143173419cfSchristos
1144173419cfSchristos #define mpq_clear __gmpq_clear
1145173419cfSchristos __GMP_DECLSPEC void mpq_clear (mpq_ptr);
1146173419cfSchristos
1147173419cfSchristos #define mpq_clears __gmpq_clears
1148173419cfSchristos __GMP_DECLSPEC void mpq_clears (mpq_ptr, ...);
1149173419cfSchristos
1150173419cfSchristos #define mpq_cmp __gmpq_cmp
1151173419cfSchristos __GMP_DECLSPEC int mpq_cmp (mpq_srcptr, mpq_srcptr) __GMP_ATTRIBUTE_PURE;
1152173419cfSchristos
1153173419cfSchristos #define _mpq_cmp_si __gmpq_cmp_si
1154173419cfSchristos __GMP_DECLSPEC int _mpq_cmp_si (mpq_srcptr, long, unsigned long) __GMP_ATTRIBUTE_PURE;
1155173419cfSchristos
1156173419cfSchristos #define _mpq_cmp_ui __gmpq_cmp_ui
1157173419cfSchristos __GMP_DECLSPEC int _mpq_cmp_ui (mpq_srcptr, unsigned long int, unsigned long int) __GMP_ATTRIBUTE_PURE;
1158173419cfSchristos
1159173419cfSchristos #define mpq_cmp_z __gmpq_cmp_z
1160173419cfSchristos __GMP_DECLSPEC int mpq_cmp_z (mpq_srcptr, mpz_srcptr) __GMP_ATTRIBUTE_PURE;
1161173419cfSchristos
1162173419cfSchristos #define mpq_div __gmpq_div
1163173419cfSchristos __GMP_DECLSPEC void mpq_div (mpq_ptr, mpq_srcptr, mpq_srcptr);
1164173419cfSchristos
1165173419cfSchristos #define mpq_div_2exp __gmpq_div_2exp
1166173419cfSchristos __GMP_DECLSPEC void mpq_div_2exp (mpq_ptr, mpq_srcptr, mp_bitcnt_t);
1167173419cfSchristos
1168173419cfSchristos #define mpq_equal __gmpq_equal
1169173419cfSchristos __GMP_DECLSPEC int mpq_equal (mpq_srcptr, mpq_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
1170173419cfSchristos
1171173419cfSchristos #define mpq_get_num __gmpq_get_num
1172173419cfSchristos __GMP_DECLSPEC void mpq_get_num (mpz_ptr, mpq_srcptr);
1173173419cfSchristos
1174173419cfSchristos #define mpq_get_den __gmpq_get_den
1175173419cfSchristos __GMP_DECLSPEC void mpq_get_den (mpz_ptr, mpq_srcptr);
1176173419cfSchristos
1177173419cfSchristos #define mpq_get_d __gmpq_get_d
1178173419cfSchristos __GMP_DECLSPEC double mpq_get_d (mpq_srcptr) __GMP_ATTRIBUTE_PURE;
1179173419cfSchristos
1180173419cfSchristos #define mpq_get_str __gmpq_get_str
1181173419cfSchristos __GMP_DECLSPEC char *mpq_get_str (char *, int, mpq_srcptr);
1182173419cfSchristos
1183173419cfSchristos #define mpq_init __gmpq_init
1184173419cfSchristos __GMP_DECLSPEC void mpq_init (mpq_ptr);
1185173419cfSchristos
1186173419cfSchristos #define mpq_inits __gmpq_inits
1187173419cfSchristos __GMP_DECLSPEC void mpq_inits (mpq_ptr, ...);
1188173419cfSchristos
1189173419cfSchristos #define mpq_inp_str __gmpq_inp_str
1190173419cfSchristos #ifdef _GMP_H_HAVE_FILE
1191173419cfSchristos __GMP_DECLSPEC size_t mpq_inp_str (mpq_ptr, FILE *, int);
1192173419cfSchristos #endif
1193173419cfSchristos
1194173419cfSchristos #define mpq_inv __gmpq_inv
1195173419cfSchristos __GMP_DECLSPEC void mpq_inv (mpq_ptr, mpq_srcptr);
1196173419cfSchristos
1197173419cfSchristos #define mpq_mul __gmpq_mul
1198173419cfSchristos __GMP_DECLSPEC void mpq_mul (mpq_ptr, mpq_srcptr, mpq_srcptr);
1199173419cfSchristos
1200173419cfSchristos #define mpq_mul_2exp __gmpq_mul_2exp
1201173419cfSchristos __GMP_DECLSPEC void mpq_mul_2exp (mpq_ptr, mpq_srcptr, mp_bitcnt_t);
1202173419cfSchristos
1203173419cfSchristos #define mpq_neg __gmpq_neg
1204173419cfSchristos #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpq_neg)
1205173419cfSchristos __GMP_DECLSPEC void mpq_neg (mpq_ptr, mpq_srcptr);
1206173419cfSchristos #endif
1207173419cfSchristos
1208173419cfSchristos #define mpq_out_str __gmpq_out_str
1209173419cfSchristos #ifdef _GMP_H_HAVE_FILE
1210173419cfSchristos __GMP_DECLSPEC size_t mpq_out_str (FILE *, int, mpq_srcptr);
1211173419cfSchristos #endif
1212173419cfSchristos
1213173419cfSchristos #define mpq_set __gmpq_set
1214173419cfSchristos __GMP_DECLSPEC void mpq_set (mpq_ptr, mpq_srcptr);
1215173419cfSchristos
1216173419cfSchristos #define mpq_set_d __gmpq_set_d
1217173419cfSchristos __GMP_DECLSPEC void mpq_set_d (mpq_ptr, double);
1218173419cfSchristos
1219173419cfSchristos #define mpq_set_den __gmpq_set_den
1220173419cfSchristos __GMP_DECLSPEC void mpq_set_den (mpq_ptr, mpz_srcptr);
1221173419cfSchristos
1222173419cfSchristos #define mpq_set_f __gmpq_set_f
1223173419cfSchristos __GMP_DECLSPEC void mpq_set_f (mpq_ptr, mpf_srcptr);
1224173419cfSchristos
1225173419cfSchristos #define mpq_set_num __gmpq_set_num
1226173419cfSchristos __GMP_DECLSPEC void mpq_set_num (mpq_ptr, mpz_srcptr);
1227173419cfSchristos
1228173419cfSchristos #define mpq_set_si __gmpq_set_si
1229173419cfSchristos __GMP_DECLSPEC void mpq_set_si (mpq_ptr, signed long int, unsigned long int);
1230173419cfSchristos
1231173419cfSchristos #define mpq_set_str __gmpq_set_str
1232173419cfSchristos __GMP_DECLSPEC int mpq_set_str (mpq_ptr, const char *, int);
1233173419cfSchristos
1234173419cfSchristos #define mpq_set_ui __gmpq_set_ui
1235173419cfSchristos __GMP_DECLSPEC void mpq_set_ui (mpq_ptr, unsigned long int, unsigned long int);
1236173419cfSchristos
1237173419cfSchristos #define mpq_set_z __gmpq_set_z
1238173419cfSchristos __GMP_DECLSPEC void mpq_set_z (mpq_ptr, mpz_srcptr);
1239173419cfSchristos
1240173419cfSchristos #define mpq_sub __gmpq_sub
1241173419cfSchristos __GMP_DECLSPEC void mpq_sub (mpq_ptr, mpq_srcptr, mpq_srcptr);
1242173419cfSchristos
1243173419cfSchristos #define mpq_swap __gmpq_swap
1244173419cfSchristos __GMP_DECLSPEC void mpq_swap (mpq_ptr, mpq_ptr) __GMP_NOTHROW;
1245173419cfSchristos
1246173419cfSchristos
1247173419cfSchristos /**************** Float (i.e. F) routines. ****************/
1248173419cfSchristos
1249173419cfSchristos #define mpf_abs __gmpf_abs
1250173419cfSchristos __GMP_DECLSPEC void mpf_abs (mpf_ptr, mpf_srcptr);
1251173419cfSchristos
1252173419cfSchristos #define mpf_add __gmpf_add
1253173419cfSchristos __GMP_DECLSPEC void mpf_add (mpf_ptr, mpf_srcptr, mpf_srcptr);
1254173419cfSchristos
1255173419cfSchristos #define mpf_add_ui __gmpf_add_ui
1256173419cfSchristos __GMP_DECLSPEC void mpf_add_ui (mpf_ptr, mpf_srcptr, unsigned long int);
1257173419cfSchristos #define mpf_ceil __gmpf_ceil
1258173419cfSchristos __GMP_DECLSPEC void mpf_ceil (mpf_ptr, mpf_srcptr);
1259173419cfSchristos
1260173419cfSchristos #define mpf_clear __gmpf_clear
1261173419cfSchristos __GMP_DECLSPEC void mpf_clear (mpf_ptr);
1262173419cfSchristos
1263173419cfSchristos #define mpf_clears __gmpf_clears
1264173419cfSchristos __GMP_DECLSPEC void mpf_clears (mpf_ptr, ...);
1265173419cfSchristos
1266173419cfSchristos #define mpf_cmp __gmpf_cmp
1267173419cfSchristos __GMP_DECLSPEC int mpf_cmp (mpf_srcptr, mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
1268173419cfSchristos
1269173419cfSchristos #define mpf_cmp_z __gmpf_cmp_z
1270173419cfSchristos __GMP_DECLSPEC int mpf_cmp_z (mpf_srcptr, mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
1271173419cfSchristos
1272173419cfSchristos #define mpf_cmp_d __gmpf_cmp_d
1273173419cfSchristos __GMP_DECLSPEC int mpf_cmp_d (mpf_srcptr, double) __GMP_ATTRIBUTE_PURE;
1274173419cfSchristos
1275173419cfSchristos #define mpf_cmp_si __gmpf_cmp_si
1276173419cfSchristos __GMP_DECLSPEC int mpf_cmp_si (mpf_srcptr, signed long int) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
1277173419cfSchristos
1278173419cfSchristos #define mpf_cmp_ui __gmpf_cmp_ui
1279173419cfSchristos __GMP_DECLSPEC int mpf_cmp_ui (mpf_srcptr, unsigned long int) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
1280173419cfSchristos
1281173419cfSchristos #define mpf_div __gmpf_div
1282173419cfSchristos __GMP_DECLSPEC void mpf_div (mpf_ptr, mpf_srcptr, mpf_srcptr);
1283173419cfSchristos
1284173419cfSchristos #define mpf_div_2exp __gmpf_div_2exp
1285173419cfSchristos __GMP_DECLSPEC void mpf_div_2exp (mpf_ptr, mpf_srcptr, mp_bitcnt_t);
1286173419cfSchristos
1287173419cfSchristos #define mpf_div_ui __gmpf_div_ui
1288173419cfSchristos __GMP_DECLSPEC void mpf_div_ui (mpf_ptr, mpf_srcptr, unsigned long int);
1289173419cfSchristos
1290173419cfSchristos #define mpf_dump __gmpf_dump
1291173419cfSchristos __GMP_DECLSPEC void mpf_dump (mpf_srcptr);
1292173419cfSchristos
1293173419cfSchristos #define mpf_eq __gmpf_eq
1294173419cfSchristos __GMP_DECLSPEC int mpf_eq (mpf_srcptr, mpf_srcptr, mp_bitcnt_t) __GMP_ATTRIBUTE_PURE;
1295173419cfSchristos
1296173419cfSchristos #define mpf_fits_sint_p __gmpf_fits_sint_p
1297173419cfSchristos __GMP_DECLSPEC int mpf_fits_sint_p (mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
1298173419cfSchristos
1299173419cfSchristos #define mpf_fits_slong_p __gmpf_fits_slong_p
1300173419cfSchristos __GMP_DECLSPEC int mpf_fits_slong_p (mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
1301173419cfSchristos
1302173419cfSchristos #define mpf_fits_sshort_p __gmpf_fits_sshort_p
1303173419cfSchristos __GMP_DECLSPEC int mpf_fits_sshort_p (mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
1304173419cfSchristos
1305173419cfSchristos #define mpf_fits_uint_p __gmpf_fits_uint_p
1306173419cfSchristos __GMP_DECLSPEC int mpf_fits_uint_p (mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
1307173419cfSchristos
1308173419cfSchristos #define mpf_fits_ulong_p __gmpf_fits_ulong_p
1309173419cfSchristos __GMP_DECLSPEC int mpf_fits_ulong_p (mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
1310173419cfSchristos
1311173419cfSchristos #define mpf_fits_ushort_p __gmpf_fits_ushort_p
1312173419cfSchristos __GMP_DECLSPEC int mpf_fits_ushort_p (mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
1313173419cfSchristos
1314173419cfSchristos #define mpf_floor __gmpf_floor
1315173419cfSchristos __GMP_DECLSPEC void mpf_floor (mpf_ptr, mpf_srcptr);
1316173419cfSchristos
1317173419cfSchristos #define mpf_get_d __gmpf_get_d
1318173419cfSchristos __GMP_DECLSPEC double mpf_get_d (mpf_srcptr) __GMP_ATTRIBUTE_PURE;
1319173419cfSchristos
1320173419cfSchristos #define mpf_get_d_2exp __gmpf_get_d_2exp
1321173419cfSchristos __GMP_DECLSPEC double mpf_get_d_2exp (signed long int *, mpf_srcptr);
1322173419cfSchristos
1323173419cfSchristos #define mpf_get_default_prec __gmpf_get_default_prec
1324173419cfSchristos __GMP_DECLSPEC mp_bitcnt_t mpf_get_default_prec (void) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
1325173419cfSchristos
1326173419cfSchristos #define mpf_get_prec __gmpf_get_prec
1327173419cfSchristos __GMP_DECLSPEC mp_bitcnt_t mpf_get_prec (mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
1328173419cfSchristos
1329173419cfSchristos #define mpf_get_si __gmpf_get_si
1330173419cfSchristos __GMP_DECLSPEC long mpf_get_si (mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
1331173419cfSchristos
1332173419cfSchristos #define mpf_get_str __gmpf_get_str
1333173419cfSchristos __GMP_DECLSPEC char *mpf_get_str (char *, mp_exp_t *, int, size_t, mpf_srcptr);
1334173419cfSchristos
1335173419cfSchristos #define mpf_get_ui __gmpf_get_ui
1336173419cfSchristos __GMP_DECLSPEC unsigned long mpf_get_ui (mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
1337173419cfSchristos
1338173419cfSchristos #define mpf_init __gmpf_init
1339173419cfSchristos __GMP_DECLSPEC void mpf_init (mpf_ptr);
1340173419cfSchristos
1341173419cfSchristos #define mpf_init2 __gmpf_init2
1342173419cfSchristos __GMP_DECLSPEC void mpf_init2 (mpf_ptr, mp_bitcnt_t);
1343173419cfSchristos
1344173419cfSchristos #define mpf_inits __gmpf_inits
1345173419cfSchristos __GMP_DECLSPEC void mpf_inits (mpf_ptr, ...);
1346173419cfSchristos
1347173419cfSchristos #define mpf_init_set __gmpf_init_set
1348173419cfSchristos __GMP_DECLSPEC void mpf_init_set (mpf_ptr, mpf_srcptr);
1349173419cfSchristos
1350173419cfSchristos #define mpf_init_set_d __gmpf_init_set_d
1351173419cfSchristos __GMP_DECLSPEC void mpf_init_set_d (mpf_ptr, double);
1352173419cfSchristos
1353173419cfSchristos #define mpf_init_set_si __gmpf_init_set_si
1354173419cfSchristos __GMP_DECLSPEC void mpf_init_set_si (mpf_ptr, signed long int);
1355173419cfSchristos
1356173419cfSchristos #define mpf_init_set_str __gmpf_init_set_str
1357173419cfSchristos __GMP_DECLSPEC int mpf_init_set_str (mpf_ptr, const char *, int);
1358173419cfSchristos
1359173419cfSchristos #define mpf_init_set_ui __gmpf_init_set_ui
1360173419cfSchristos __GMP_DECLSPEC void mpf_init_set_ui (mpf_ptr, unsigned long int);
1361173419cfSchristos
1362173419cfSchristos #define mpf_inp_str __gmpf_inp_str
1363173419cfSchristos #ifdef _GMP_H_HAVE_FILE
1364173419cfSchristos __GMP_DECLSPEC size_t mpf_inp_str (mpf_ptr, FILE *, int);
1365173419cfSchristos #endif
1366173419cfSchristos
1367173419cfSchristos #define mpf_integer_p __gmpf_integer_p
1368173419cfSchristos __GMP_DECLSPEC int mpf_integer_p (mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
1369173419cfSchristos
1370173419cfSchristos #define mpf_mul __gmpf_mul
1371173419cfSchristos __GMP_DECLSPEC void mpf_mul (mpf_ptr, mpf_srcptr, mpf_srcptr);
1372173419cfSchristos
1373173419cfSchristos #define mpf_mul_2exp __gmpf_mul_2exp
1374173419cfSchristos __GMP_DECLSPEC void mpf_mul_2exp (mpf_ptr, mpf_srcptr, mp_bitcnt_t);
1375173419cfSchristos
1376173419cfSchristos #define mpf_mul_ui __gmpf_mul_ui
1377173419cfSchristos __GMP_DECLSPEC void mpf_mul_ui (mpf_ptr, mpf_srcptr, unsigned long int);
1378173419cfSchristos
1379173419cfSchristos #define mpf_neg __gmpf_neg
1380173419cfSchristos __GMP_DECLSPEC void mpf_neg (mpf_ptr, mpf_srcptr);
1381173419cfSchristos
1382173419cfSchristos #define mpf_out_str __gmpf_out_str
1383173419cfSchristos #ifdef _GMP_H_HAVE_FILE
1384173419cfSchristos __GMP_DECLSPEC size_t mpf_out_str (FILE *, int, size_t, mpf_srcptr);
1385173419cfSchristos #endif
1386173419cfSchristos
1387173419cfSchristos #define mpf_pow_ui __gmpf_pow_ui
1388173419cfSchristos __GMP_DECLSPEC void mpf_pow_ui (mpf_ptr, mpf_srcptr, unsigned long int);
1389173419cfSchristos
1390173419cfSchristos #define mpf_random2 __gmpf_random2
1391173419cfSchristos __GMP_DECLSPEC void mpf_random2 (mpf_ptr, mp_size_t, mp_exp_t);
1392173419cfSchristos
1393173419cfSchristos #define mpf_reldiff __gmpf_reldiff
1394173419cfSchristos __GMP_DECLSPEC void mpf_reldiff (mpf_ptr, mpf_srcptr, mpf_srcptr);
1395173419cfSchristos
1396173419cfSchristos #define mpf_set __gmpf_set
1397173419cfSchristos __GMP_DECLSPEC void mpf_set (mpf_ptr, mpf_srcptr);
1398173419cfSchristos
1399173419cfSchristos #define mpf_set_d __gmpf_set_d
1400173419cfSchristos __GMP_DECLSPEC void mpf_set_d (mpf_ptr, double);
1401173419cfSchristos
1402173419cfSchristos #define mpf_set_default_prec __gmpf_set_default_prec
1403173419cfSchristos __GMP_DECLSPEC void mpf_set_default_prec (mp_bitcnt_t) __GMP_NOTHROW;
1404173419cfSchristos
1405173419cfSchristos #define mpf_set_prec __gmpf_set_prec
1406173419cfSchristos __GMP_DECLSPEC void mpf_set_prec (mpf_ptr, mp_bitcnt_t);
1407173419cfSchristos
1408173419cfSchristos #define mpf_set_prec_raw __gmpf_set_prec_raw
1409173419cfSchristos __GMP_DECLSPEC void mpf_set_prec_raw (mpf_ptr, mp_bitcnt_t) __GMP_NOTHROW;
1410173419cfSchristos
1411173419cfSchristos #define mpf_set_q __gmpf_set_q
1412173419cfSchristos __GMP_DECLSPEC void mpf_set_q (mpf_ptr, mpq_srcptr);
1413173419cfSchristos
1414173419cfSchristos #define mpf_set_si __gmpf_set_si
1415173419cfSchristos __GMP_DECLSPEC void mpf_set_si (mpf_ptr, signed long int);
1416173419cfSchristos
1417173419cfSchristos #define mpf_set_str __gmpf_set_str
1418173419cfSchristos __GMP_DECLSPEC int mpf_set_str (mpf_ptr, const char *, int);
1419173419cfSchristos
1420173419cfSchristos #define mpf_set_ui __gmpf_set_ui
1421173419cfSchristos __GMP_DECLSPEC void mpf_set_ui (mpf_ptr, unsigned long int);
1422173419cfSchristos
1423173419cfSchristos #define mpf_set_z __gmpf_set_z
1424173419cfSchristos __GMP_DECLSPEC void mpf_set_z (mpf_ptr, mpz_srcptr);
1425173419cfSchristos
1426173419cfSchristos #define mpf_size __gmpf_size
1427173419cfSchristos __GMP_DECLSPEC size_t mpf_size (mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
1428173419cfSchristos
1429173419cfSchristos #define mpf_sqrt __gmpf_sqrt
1430173419cfSchristos __GMP_DECLSPEC void mpf_sqrt (mpf_ptr, mpf_srcptr);
1431173419cfSchristos
1432173419cfSchristos #define mpf_sqrt_ui __gmpf_sqrt_ui
1433173419cfSchristos __GMP_DECLSPEC void mpf_sqrt_ui (mpf_ptr, unsigned long int);
1434173419cfSchristos
1435173419cfSchristos #define mpf_sub __gmpf_sub
1436173419cfSchristos __GMP_DECLSPEC void mpf_sub (mpf_ptr, mpf_srcptr, mpf_srcptr);
1437173419cfSchristos
1438173419cfSchristos #define mpf_sub_ui __gmpf_sub_ui
1439173419cfSchristos __GMP_DECLSPEC void mpf_sub_ui (mpf_ptr, mpf_srcptr, unsigned long int);
1440173419cfSchristos
1441173419cfSchristos #define mpf_swap __gmpf_swap
1442173419cfSchristos __GMP_DECLSPEC void mpf_swap (mpf_ptr, mpf_ptr) __GMP_NOTHROW;
1443173419cfSchristos
1444173419cfSchristos #define mpf_trunc __gmpf_trunc
1445173419cfSchristos __GMP_DECLSPEC void mpf_trunc (mpf_ptr, mpf_srcptr);
1446173419cfSchristos
1447173419cfSchristos #define mpf_ui_div __gmpf_ui_div
1448173419cfSchristos __GMP_DECLSPEC void mpf_ui_div (mpf_ptr, unsigned long int, mpf_srcptr);
1449173419cfSchristos
1450173419cfSchristos #define mpf_ui_sub __gmpf_ui_sub
1451173419cfSchristos __GMP_DECLSPEC void mpf_ui_sub (mpf_ptr, unsigned long int, mpf_srcptr);
1452173419cfSchristos
1453173419cfSchristos #define mpf_urandomb __gmpf_urandomb
1454173419cfSchristos __GMP_DECLSPEC void mpf_urandomb (mpf_t, gmp_randstate_t, mp_bitcnt_t);
1455173419cfSchristos
1456173419cfSchristos
1457173419cfSchristos /************ Low level positive-integer (i.e. N) routines. ************/
1458173419cfSchristos
1459173419cfSchristos /* This is ugly, but we need to make user calls reach the prefixed function. */
1460173419cfSchristos
1461173419cfSchristos #define mpn_add __MPN(add)
1462173419cfSchristos #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpn_add)
1463173419cfSchristos __GMP_DECLSPEC mp_limb_t mpn_add (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t);
1464173419cfSchristos #endif
1465173419cfSchristos
1466173419cfSchristos #define mpn_add_1 __MPN(add_1)
1467173419cfSchristos #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpn_add_1)
1468173419cfSchristos __GMP_DECLSPEC mp_limb_t mpn_add_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t) __GMP_NOTHROW;
1469173419cfSchristos #endif
1470173419cfSchristos
1471173419cfSchristos #define mpn_add_n __MPN(add_n)
1472173419cfSchristos __GMP_DECLSPEC mp_limb_t mpn_add_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
1473173419cfSchristos
1474173419cfSchristos #define mpn_addmul_1 __MPN(addmul_1)
1475173419cfSchristos __GMP_DECLSPEC mp_limb_t mpn_addmul_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
1476173419cfSchristos
1477173419cfSchristos #define mpn_cmp __MPN(cmp)
1478173419cfSchristos #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpn_cmp)
1479173419cfSchristos __GMP_DECLSPEC int mpn_cmp (mp_srcptr, mp_srcptr, mp_size_t) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
1480173419cfSchristos #endif
1481173419cfSchristos
1482173419cfSchristos #define mpn_zero_p __MPN(zero_p)
1483173419cfSchristos #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpn_zero_p)
1484173419cfSchristos __GMP_DECLSPEC int mpn_zero_p (mp_srcptr, mp_size_t) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
1485173419cfSchristos #endif
1486173419cfSchristos
1487173419cfSchristos #define mpn_divexact_1 __MPN(divexact_1)
1488173419cfSchristos __GMP_DECLSPEC void mpn_divexact_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
1489173419cfSchristos
1490173419cfSchristos #define mpn_divexact_by3(dst,src,size) \
1491173419cfSchristos mpn_divexact_by3c (dst, src, size, __GMP_CAST (mp_limb_t, 0))
1492173419cfSchristos
1493173419cfSchristos #define mpn_divexact_by3c __MPN(divexact_by3c)
1494173419cfSchristos __GMP_DECLSPEC mp_limb_t mpn_divexact_by3c (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
1495173419cfSchristos
1496173419cfSchristos #define mpn_divmod_1(qp,np,nsize,dlimb) \
1497173419cfSchristos mpn_divrem_1 (qp, __GMP_CAST (mp_size_t, 0), np, nsize, dlimb)
1498173419cfSchristos
1499173419cfSchristos #define mpn_divrem __MPN(divrem)
1500173419cfSchristos __GMP_DECLSPEC mp_limb_t mpn_divrem (mp_ptr, mp_size_t, mp_ptr, mp_size_t, mp_srcptr, mp_size_t);
1501173419cfSchristos
1502173419cfSchristos #define mpn_divrem_1 __MPN(divrem_1)
1503173419cfSchristos __GMP_DECLSPEC mp_limb_t mpn_divrem_1 (mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t);
1504173419cfSchristos
1505173419cfSchristos #define mpn_divrem_2 __MPN(divrem_2)
1506173419cfSchristos __GMP_DECLSPEC mp_limb_t mpn_divrem_2 (mp_ptr, mp_size_t, mp_ptr, mp_size_t, mp_srcptr);
1507173419cfSchristos
1508173419cfSchristos #define mpn_div_qr_1 __MPN(div_qr_1)
1509173419cfSchristos __GMP_DECLSPEC mp_limb_t mpn_div_qr_1 (mp_ptr, mp_limb_t *, mp_srcptr, mp_size_t, mp_limb_t);
1510173419cfSchristos
1511173419cfSchristos #define mpn_div_qr_2 __MPN(div_qr_2)
1512173419cfSchristos __GMP_DECLSPEC mp_limb_t mpn_div_qr_2 (mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_srcptr);
1513173419cfSchristos
1514173419cfSchristos #define mpn_gcd __MPN(gcd)
1515173419cfSchristos __GMP_DECLSPEC mp_size_t mpn_gcd (mp_ptr, mp_ptr, mp_size_t, mp_ptr, mp_size_t);
1516173419cfSchristos
1517173419cfSchristos #define mpn_gcd_11 __MPN(gcd_11)
1518173419cfSchristos __GMP_DECLSPEC mp_limb_t mpn_gcd_11 (mp_limb_t, mp_limb_t) __GMP_ATTRIBUTE_PURE;
1519173419cfSchristos
1520173419cfSchristos #define mpn_gcd_1 __MPN(gcd_1)
1521173419cfSchristos __GMP_DECLSPEC mp_limb_t mpn_gcd_1 (mp_srcptr, mp_size_t, mp_limb_t) __GMP_ATTRIBUTE_PURE;
1522173419cfSchristos
1523173419cfSchristos #define mpn_gcdext_1 __MPN(gcdext_1)
1524173419cfSchristos __GMP_DECLSPEC mp_limb_t mpn_gcdext_1 (mp_limb_signed_t *, mp_limb_signed_t *, mp_limb_t, mp_limb_t);
1525173419cfSchristos
1526173419cfSchristos #define mpn_gcdext __MPN(gcdext)
1527173419cfSchristos __GMP_DECLSPEC mp_size_t mpn_gcdext (mp_ptr, mp_ptr, mp_size_t *, mp_ptr, mp_size_t, mp_ptr, mp_size_t);
1528173419cfSchristos
1529173419cfSchristos #define mpn_get_str __MPN(get_str)
1530173419cfSchristos __GMP_DECLSPEC size_t mpn_get_str (unsigned char *, int, mp_ptr, mp_size_t);
1531173419cfSchristos
1532173419cfSchristos #define mpn_hamdist __MPN(hamdist)
1533173419cfSchristos __GMP_DECLSPEC mp_bitcnt_t mpn_hamdist (mp_srcptr, mp_srcptr, mp_size_t) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
1534173419cfSchristos
1535173419cfSchristos #define mpn_lshift __MPN(lshift)
1536173419cfSchristos __GMP_DECLSPEC mp_limb_t mpn_lshift (mp_ptr, mp_srcptr, mp_size_t, unsigned int);
1537173419cfSchristos
1538173419cfSchristos #define mpn_mod_1 __MPN(mod_1)
1539173419cfSchristos __GMP_DECLSPEC mp_limb_t mpn_mod_1 (mp_srcptr, mp_size_t, mp_limb_t) __GMP_ATTRIBUTE_PURE;
1540173419cfSchristos
1541173419cfSchristos #define mpn_mul __MPN(mul)
1542173419cfSchristos __GMP_DECLSPEC mp_limb_t mpn_mul (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t);
1543173419cfSchristos
1544173419cfSchristos #define mpn_mul_1 __MPN(mul_1)
1545173419cfSchristos __GMP_DECLSPEC mp_limb_t mpn_mul_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
1546173419cfSchristos
1547173419cfSchristos #define mpn_mul_n __MPN(mul_n)
1548173419cfSchristos __GMP_DECLSPEC void mpn_mul_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
1549173419cfSchristos
1550173419cfSchristos #define mpn_sqr __MPN(sqr)
1551173419cfSchristos __GMP_DECLSPEC void mpn_sqr (mp_ptr, mp_srcptr, mp_size_t);
1552173419cfSchristos
1553173419cfSchristos #define mpn_neg __MPN(neg)
1554173419cfSchristos #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpn_neg)
1555173419cfSchristos __GMP_DECLSPEC mp_limb_t mpn_neg (mp_ptr, mp_srcptr, mp_size_t);
1556173419cfSchristos #endif
1557173419cfSchristos
1558173419cfSchristos #define mpn_com __MPN(com)
1559173419cfSchristos __GMP_DECLSPEC void mpn_com (mp_ptr, mp_srcptr, mp_size_t);
1560173419cfSchristos
1561173419cfSchristos #define mpn_perfect_square_p __MPN(perfect_square_p)
1562173419cfSchristos __GMP_DECLSPEC int mpn_perfect_square_p (mp_srcptr, mp_size_t) __GMP_ATTRIBUTE_PURE;
1563173419cfSchristos
1564173419cfSchristos #define mpn_perfect_power_p __MPN(perfect_power_p)
1565173419cfSchristos __GMP_DECLSPEC int mpn_perfect_power_p (mp_srcptr, mp_size_t) __GMP_ATTRIBUTE_PURE;
1566173419cfSchristos
1567173419cfSchristos #define mpn_popcount __MPN(popcount)
1568173419cfSchristos __GMP_DECLSPEC mp_bitcnt_t mpn_popcount (mp_srcptr, mp_size_t) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
1569173419cfSchristos
1570173419cfSchristos #define mpn_pow_1 __MPN(pow_1)
1571173419cfSchristos __GMP_DECLSPEC mp_size_t mpn_pow_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_ptr);
1572173419cfSchristos
1573173419cfSchristos /* undocumented now, but retained here for upward compatibility */
1574173419cfSchristos #define mpn_preinv_mod_1 __MPN(preinv_mod_1)
1575173419cfSchristos __GMP_DECLSPEC mp_limb_t mpn_preinv_mod_1 (mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t) __GMP_ATTRIBUTE_PURE;
1576173419cfSchristos
1577173419cfSchristos #define mpn_random __MPN(random)
1578173419cfSchristos __GMP_DECLSPEC void mpn_random (mp_ptr, mp_size_t);
1579173419cfSchristos
1580173419cfSchristos #define mpn_random2 __MPN(random2)
1581173419cfSchristos __GMP_DECLSPEC void mpn_random2 (mp_ptr, mp_size_t);
1582173419cfSchristos
1583173419cfSchristos #define mpn_rshift __MPN(rshift)
1584173419cfSchristos __GMP_DECLSPEC mp_limb_t mpn_rshift (mp_ptr, mp_srcptr, mp_size_t, unsigned int);
1585173419cfSchristos
1586173419cfSchristos #define mpn_scan0 __MPN(scan0)
1587173419cfSchristos __GMP_DECLSPEC mp_bitcnt_t mpn_scan0 (mp_srcptr, mp_bitcnt_t) __GMP_ATTRIBUTE_PURE;
1588173419cfSchristos
1589173419cfSchristos #define mpn_scan1 __MPN(scan1)
1590173419cfSchristos __GMP_DECLSPEC mp_bitcnt_t mpn_scan1 (mp_srcptr, mp_bitcnt_t) __GMP_ATTRIBUTE_PURE;
1591173419cfSchristos
1592173419cfSchristos #define mpn_set_str __MPN(set_str)
1593173419cfSchristos __GMP_DECLSPEC mp_size_t mpn_set_str (mp_ptr, const unsigned char *, size_t, int);
1594173419cfSchristos
1595173419cfSchristos #define mpn_sizeinbase __MPN(sizeinbase)
1596173419cfSchristos __GMP_DECLSPEC size_t mpn_sizeinbase (mp_srcptr, mp_size_t, int);
1597173419cfSchristos
1598173419cfSchristos #define mpn_sqrtrem __MPN(sqrtrem)
1599173419cfSchristos __GMP_DECLSPEC mp_size_t mpn_sqrtrem (mp_ptr, mp_ptr, mp_srcptr, mp_size_t);
1600173419cfSchristos
1601173419cfSchristos #define mpn_sub __MPN(sub)
1602173419cfSchristos #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpn_sub)
1603173419cfSchristos __GMP_DECLSPEC mp_limb_t mpn_sub (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t);
1604173419cfSchristos #endif
1605173419cfSchristos
1606173419cfSchristos #define mpn_sub_1 __MPN(sub_1)
1607173419cfSchristos #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpn_sub_1)
1608173419cfSchristos __GMP_DECLSPEC mp_limb_t mpn_sub_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t) __GMP_NOTHROW;
1609173419cfSchristos #endif
1610173419cfSchristos
1611173419cfSchristos #define mpn_sub_n __MPN(sub_n)
1612173419cfSchristos __GMP_DECLSPEC mp_limb_t mpn_sub_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
1613173419cfSchristos
1614173419cfSchristos #define mpn_submul_1 __MPN(submul_1)
1615173419cfSchristos __GMP_DECLSPEC mp_limb_t mpn_submul_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
1616173419cfSchristos
1617173419cfSchristos #define mpn_tdiv_qr __MPN(tdiv_qr)
1618173419cfSchristos __GMP_DECLSPEC void mpn_tdiv_qr (mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t);
1619173419cfSchristos
1620173419cfSchristos #define mpn_and_n __MPN(and_n)
1621173419cfSchristos __GMP_DECLSPEC void mpn_and_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
1622173419cfSchristos #define mpn_andn_n __MPN(andn_n)
1623173419cfSchristos __GMP_DECLSPEC void mpn_andn_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
1624173419cfSchristos #define mpn_nand_n __MPN(nand_n)
1625173419cfSchristos __GMP_DECLSPEC void mpn_nand_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
1626173419cfSchristos #define mpn_ior_n __MPN(ior_n)
1627173419cfSchristos __GMP_DECLSPEC void mpn_ior_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
1628173419cfSchristos #define mpn_iorn_n __MPN(iorn_n)
1629173419cfSchristos __GMP_DECLSPEC void mpn_iorn_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
1630173419cfSchristos #define mpn_nior_n __MPN(nior_n)
1631173419cfSchristos __GMP_DECLSPEC void mpn_nior_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
1632173419cfSchristos #define mpn_xor_n __MPN(xor_n)
1633173419cfSchristos __GMP_DECLSPEC void mpn_xor_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
1634173419cfSchristos #define mpn_xnor_n __MPN(xnor_n)
1635173419cfSchristos __GMP_DECLSPEC void mpn_xnor_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
1636173419cfSchristos
1637173419cfSchristos #define mpn_copyi __MPN(copyi)
1638173419cfSchristos __GMP_DECLSPEC void mpn_copyi (mp_ptr, mp_srcptr, mp_size_t);
1639173419cfSchristos #define mpn_copyd __MPN(copyd)
1640173419cfSchristos __GMP_DECLSPEC void mpn_copyd (mp_ptr, mp_srcptr, mp_size_t);
1641173419cfSchristos #define mpn_zero __MPN(zero)
1642173419cfSchristos __GMP_DECLSPEC void mpn_zero (mp_ptr, mp_size_t);
1643173419cfSchristos
1644173419cfSchristos #define mpn_cnd_add_n __MPN(cnd_add_n)
1645173419cfSchristos __GMP_DECLSPEC mp_limb_t mpn_cnd_add_n (mp_limb_t, mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
1646173419cfSchristos #define mpn_cnd_sub_n __MPN(cnd_sub_n)
1647173419cfSchristos __GMP_DECLSPEC mp_limb_t mpn_cnd_sub_n (mp_limb_t, mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
1648173419cfSchristos
1649173419cfSchristos #define mpn_sec_add_1 __MPN(sec_add_1)
1650173419cfSchristos __GMP_DECLSPEC mp_limb_t mpn_sec_add_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_ptr);
1651173419cfSchristos #define mpn_sec_add_1_itch __MPN(sec_add_1_itch)
1652173419cfSchristos __GMP_DECLSPEC mp_size_t mpn_sec_add_1_itch (mp_size_t) __GMP_ATTRIBUTE_PURE;
1653173419cfSchristos
1654173419cfSchristos #define mpn_sec_sub_1 __MPN(sec_sub_1)
1655173419cfSchristos __GMP_DECLSPEC mp_limb_t mpn_sec_sub_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_ptr);
1656173419cfSchristos #define mpn_sec_sub_1_itch __MPN(sec_sub_1_itch)
1657173419cfSchristos __GMP_DECLSPEC mp_size_t mpn_sec_sub_1_itch (mp_size_t) __GMP_ATTRIBUTE_PURE;
1658173419cfSchristos
1659173419cfSchristos #define mpn_cnd_swap __MPN(cnd_swap)
1660173419cfSchristos __GMP_DECLSPEC void mpn_cnd_swap (mp_limb_t, volatile mp_limb_t *, volatile mp_limb_t *, mp_size_t);
1661173419cfSchristos
1662173419cfSchristos #define mpn_sec_mul __MPN(sec_mul)
1663173419cfSchristos __GMP_DECLSPEC void mpn_sec_mul (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr);
1664173419cfSchristos #define mpn_sec_mul_itch __MPN(sec_mul_itch)
1665173419cfSchristos __GMP_DECLSPEC mp_size_t mpn_sec_mul_itch (mp_size_t, mp_size_t) __GMP_ATTRIBUTE_PURE;
1666173419cfSchristos
1667173419cfSchristos #define mpn_sec_sqr __MPN(sec_sqr)
1668173419cfSchristos __GMP_DECLSPEC void mpn_sec_sqr (mp_ptr, mp_srcptr, mp_size_t, mp_ptr);
1669173419cfSchristos #define mpn_sec_sqr_itch __MPN(sec_sqr_itch)
1670173419cfSchristos __GMP_DECLSPEC mp_size_t mpn_sec_sqr_itch (mp_size_t) __GMP_ATTRIBUTE_PURE;
1671173419cfSchristos
1672173419cfSchristos #define mpn_sec_powm __MPN(sec_powm)
1673173419cfSchristos __GMP_DECLSPEC void mpn_sec_powm (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_bitcnt_t, mp_srcptr, mp_size_t, mp_ptr);
1674173419cfSchristos #define mpn_sec_powm_itch __MPN(sec_powm_itch)
1675173419cfSchristos __GMP_DECLSPEC mp_size_t mpn_sec_powm_itch (mp_size_t, mp_bitcnt_t, mp_size_t) __GMP_ATTRIBUTE_PURE;
1676173419cfSchristos
1677173419cfSchristos #define mpn_sec_tabselect __MPN(sec_tabselect)
1678173419cfSchristos __GMP_DECLSPEC void mpn_sec_tabselect (volatile mp_limb_t *, volatile const mp_limb_t *, mp_size_t, mp_size_t, mp_size_t);
1679173419cfSchristos
1680173419cfSchristos #define mpn_sec_div_qr __MPN(sec_div_qr)
1681173419cfSchristos __GMP_DECLSPEC mp_limb_t mpn_sec_div_qr (mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr);
1682173419cfSchristos #define mpn_sec_div_qr_itch __MPN(sec_div_qr_itch)
1683173419cfSchristos __GMP_DECLSPEC mp_size_t mpn_sec_div_qr_itch (mp_size_t, mp_size_t) __GMP_ATTRIBUTE_PURE;
1684173419cfSchristos #define mpn_sec_div_r __MPN(sec_div_r)
1685173419cfSchristos __GMP_DECLSPEC void mpn_sec_div_r (mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr);
1686173419cfSchristos #define mpn_sec_div_r_itch __MPN(sec_div_r_itch)
1687173419cfSchristos __GMP_DECLSPEC mp_size_t mpn_sec_div_r_itch (mp_size_t, mp_size_t) __GMP_ATTRIBUTE_PURE;
1688173419cfSchristos
1689173419cfSchristos #define mpn_sec_invert __MPN(sec_invert)
1690173419cfSchristos __GMP_DECLSPEC int mpn_sec_invert (mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_bitcnt_t, mp_ptr);
1691173419cfSchristos #define mpn_sec_invert_itch __MPN(sec_invert_itch)
1692173419cfSchristos __GMP_DECLSPEC mp_size_t mpn_sec_invert_itch (mp_size_t) __GMP_ATTRIBUTE_PURE;
1693173419cfSchristos
1694*dbbd8e88Smrg #define mpn_udiv_w_sdiv __MPN(udiv_w_sdiv)
1695*dbbd8e88Smrg __GMP_DECLSPEC mp_limb_t mpn_udiv_w_sdiv (mp_limb_t *, mp_limb_t, mp_limb_t, mp_limb_t);
1696*dbbd8e88Smrg
1697173419cfSchristos
1698173419cfSchristos /**************** mpz inlines ****************/
1699173419cfSchristos
1700173419cfSchristos /* The following are provided as inlines where possible, but always exist as
1701173419cfSchristos library functions too, for binary compatibility.
1702173419cfSchristos
1703173419cfSchristos Within gmp itself this inlining generally isn't relied on, since it
1704173419cfSchristos doesn't get done for all compilers, whereas if something is worth
1705173419cfSchristos inlining then it's worth arranging always.
1706173419cfSchristos
1707173419cfSchristos There are two styles of inlining here. When the same bit of code is
1708173419cfSchristos wanted for the inline as for the library version, then __GMP_FORCE_foo
1709173419cfSchristos arranges for that code to be emitted and the __GMP_EXTERN_INLINE
1710173419cfSchristos directive suppressed, eg. mpz_fits_uint_p. When a different bit of code
1711173419cfSchristos is wanted for the inline than for the library version, then
1712173419cfSchristos __GMP_FORCE_foo arranges the inline to be suppressed, eg. mpz_abs. */
1713173419cfSchristos
1714173419cfSchristos #if defined (__GMP_EXTERN_INLINE) && ! defined (__GMP_FORCE_mpz_abs)
1715173419cfSchristos __GMP_EXTERN_INLINE void
mpz_abs(mpz_ptr __gmp_w,mpz_srcptr __gmp_u)1716173419cfSchristos mpz_abs (mpz_ptr __gmp_w, mpz_srcptr __gmp_u)
1717173419cfSchristos {
1718173419cfSchristos if (__gmp_w != __gmp_u)
1719173419cfSchristos mpz_set (__gmp_w, __gmp_u);
1720173419cfSchristos __gmp_w->_mp_size = __GMP_ABS (__gmp_w->_mp_size);
1721173419cfSchristos }
1722173419cfSchristos #endif
1723173419cfSchristos
1724173419cfSchristos #if GMP_NAIL_BITS == 0
1725173419cfSchristos #define __GMPZ_FITS_UTYPE_P(z,maxval) \
1726173419cfSchristos mp_size_t __gmp_n = z->_mp_size; \
1727173419cfSchristos mp_ptr __gmp_p = z->_mp_d; \
1728173419cfSchristos return (__gmp_n == 0 || (__gmp_n == 1 && __gmp_p[0] <= maxval));
1729173419cfSchristos #else
1730173419cfSchristos #define __GMPZ_FITS_UTYPE_P(z,maxval) \
1731173419cfSchristos mp_size_t __gmp_n = z->_mp_size; \
1732173419cfSchristos mp_ptr __gmp_p = z->_mp_d; \
1733173419cfSchristos return (__gmp_n == 0 || (__gmp_n == 1 && __gmp_p[0] <= maxval) \
1734173419cfSchristos || (__gmp_n == 2 && __gmp_p[1] <= ((mp_limb_t) maxval >> GMP_NUMB_BITS)));
1735173419cfSchristos #endif
1736173419cfSchristos
1737173419cfSchristos #if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpz_fits_uint_p)
1738173419cfSchristos #if ! defined (__GMP_FORCE_mpz_fits_uint_p)
1739173419cfSchristos __GMP_EXTERN_INLINE
1740173419cfSchristos #endif
1741173419cfSchristos int
mpz_fits_uint_p(mpz_srcptr __gmp_z)1742173419cfSchristos mpz_fits_uint_p (mpz_srcptr __gmp_z) __GMP_NOTHROW
1743173419cfSchristos {
1744173419cfSchristos __GMPZ_FITS_UTYPE_P (__gmp_z, UINT_MAX);
1745173419cfSchristos }
1746173419cfSchristos #endif
1747173419cfSchristos
1748173419cfSchristos #if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpz_fits_ulong_p)
1749173419cfSchristos #if ! defined (__GMP_FORCE_mpz_fits_ulong_p)
1750173419cfSchristos __GMP_EXTERN_INLINE
1751173419cfSchristos #endif
1752173419cfSchristos int
mpz_fits_ulong_p(mpz_srcptr __gmp_z)1753173419cfSchristos mpz_fits_ulong_p (mpz_srcptr __gmp_z) __GMP_NOTHROW
1754173419cfSchristos {
1755173419cfSchristos __GMPZ_FITS_UTYPE_P (__gmp_z, ULONG_MAX);
1756173419cfSchristos }
1757173419cfSchristos #endif
1758173419cfSchristos
1759173419cfSchristos #if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpz_fits_ushort_p)
1760173419cfSchristos #if ! defined (__GMP_FORCE_mpz_fits_ushort_p)
1761173419cfSchristos __GMP_EXTERN_INLINE
1762173419cfSchristos #endif
1763173419cfSchristos int
mpz_fits_ushort_p(mpz_srcptr __gmp_z)1764173419cfSchristos mpz_fits_ushort_p (mpz_srcptr __gmp_z) __GMP_NOTHROW
1765173419cfSchristos {
1766173419cfSchristos __GMPZ_FITS_UTYPE_P (__gmp_z, USHRT_MAX);
1767173419cfSchristos }
1768173419cfSchristos #endif
1769173419cfSchristos
1770173419cfSchristos #if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpz_get_ui)
1771173419cfSchristos #if ! defined (__GMP_FORCE_mpz_get_ui)
1772173419cfSchristos __GMP_EXTERN_INLINE
1773173419cfSchristos #endif
1774173419cfSchristos unsigned long
mpz_get_ui(mpz_srcptr __gmp_z)1775173419cfSchristos mpz_get_ui (mpz_srcptr __gmp_z) __GMP_NOTHROW
1776173419cfSchristos {
1777173419cfSchristos mp_ptr __gmp_p = __gmp_z->_mp_d;
1778173419cfSchristos mp_size_t __gmp_n = __gmp_z->_mp_size;
1779173419cfSchristos mp_limb_t __gmp_l = __gmp_p[0];
1780173419cfSchristos /* This is a "#if" rather than a plain "if" so as to avoid gcc warnings
1781173419cfSchristos about "<< GMP_NUMB_BITS" exceeding the type size, and to avoid Borland
1782173419cfSchristos C++ 6.0 warnings about condition always true for something like
1783173419cfSchristos "ULONG_MAX < GMP_NUMB_MASK". */
1784173419cfSchristos #if GMP_NAIL_BITS == 0 || defined (_LONG_LONG_LIMB)
1785173419cfSchristos /* limb==long and no nails, or limb==longlong, one limb is enough */
1786173419cfSchristos return (__gmp_n != 0 ? __gmp_l : 0);
1787173419cfSchristos #else
1788173419cfSchristos /* limb==long and nails, need two limbs when available */
1789173419cfSchristos __gmp_n = __GMP_ABS (__gmp_n);
1790173419cfSchristos if (__gmp_n <= 1)
1791173419cfSchristos return (__gmp_n != 0 ? __gmp_l : 0);
1792173419cfSchristos else
1793173419cfSchristos return __gmp_l + (__gmp_p[1] << GMP_NUMB_BITS);
1794173419cfSchristos #endif
1795173419cfSchristos }
1796173419cfSchristos #endif
1797173419cfSchristos
1798173419cfSchristos #if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpz_getlimbn)
1799173419cfSchristos #if ! defined (__GMP_FORCE_mpz_getlimbn)
1800173419cfSchristos __GMP_EXTERN_INLINE
1801173419cfSchristos #endif
1802173419cfSchristos mp_limb_t
mpz_getlimbn(mpz_srcptr __gmp_z,mp_size_t __gmp_n)1803173419cfSchristos mpz_getlimbn (mpz_srcptr __gmp_z, mp_size_t __gmp_n) __GMP_NOTHROW
1804173419cfSchristos {
1805173419cfSchristos mp_limb_t __gmp_result = 0;
1806173419cfSchristos if (__GMP_LIKELY (__gmp_n >= 0 && __gmp_n < __GMP_ABS (__gmp_z->_mp_size)))
1807173419cfSchristos __gmp_result = __gmp_z->_mp_d[__gmp_n];
1808173419cfSchristos return __gmp_result;
1809173419cfSchristos }
1810173419cfSchristos #endif
1811173419cfSchristos
1812173419cfSchristos #if defined (__GMP_EXTERN_INLINE) && ! defined (__GMP_FORCE_mpz_neg)
1813173419cfSchristos __GMP_EXTERN_INLINE void
mpz_neg(mpz_ptr __gmp_w,mpz_srcptr __gmp_u)1814173419cfSchristos mpz_neg (mpz_ptr __gmp_w, mpz_srcptr __gmp_u)
1815173419cfSchristos {
1816173419cfSchristos if (__gmp_w != __gmp_u)
1817173419cfSchristos mpz_set (__gmp_w, __gmp_u);
1818173419cfSchristos __gmp_w->_mp_size = - __gmp_w->_mp_size;
1819173419cfSchristos }
1820173419cfSchristos #endif
1821173419cfSchristos
1822173419cfSchristos #if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpz_perfect_square_p)
1823173419cfSchristos #if ! defined (__GMP_FORCE_mpz_perfect_square_p)
1824173419cfSchristos __GMP_EXTERN_INLINE
1825173419cfSchristos #endif
1826173419cfSchristos int
mpz_perfect_square_p(mpz_srcptr __gmp_a)1827173419cfSchristos mpz_perfect_square_p (mpz_srcptr __gmp_a)
1828173419cfSchristos {
1829173419cfSchristos mp_size_t __gmp_asize;
1830173419cfSchristos int __gmp_result;
1831173419cfSchristos
1832173419cfSchristos __gmp_asize = __gmp_a->_mp_size;
1833173419cfSchristos __gmp_result = (__gmp_asize >= 0); /* zero is a square, negatives are not */
1834173419cfSchristos if (__GMP_LIKELY (__gmp_asize > 0))
1835173419cfSchristos __gmp_result = mpn_perfect_square_p (__gmp_a->_mp_d, __gmp_asize);
1836173419cfSchristos return __gmp_result;
1837173419cfSchristos }
1838173419cfSchristos #endif
1839173419cfSchristos
1840173419cfSchristos #if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpz_popcount)
1841173419cfSchristos #if ! defined (__GMP_FORCE_mpz_popcount)
1842173419cfSchristos __GMP_EXTERN_INLINE
1843173419cfSchristos #endif
1844173419cfSchristos mp_bitcnt_t
mpz_popcount(mpz_srcptr __gmp_u)1845173419cfSchristos mpz_popcount (mpz_srcptr __gmp_u) __GMP_NOTHROW
1846173419cfSchristos {
1847173419cfSchristos mp_size_t __gmp_usize;
1848173419cfSchristos mp_bitcnt_t __gmp_result;
1849173419cfSchristos
1850173419cfSchristos __gmp_usize = __gmp_u->_mp_size;
1851173419cfSchristos __gmp_result = (__gmp_usize < 0 ? ~ __GMP_CAST (mp_bitcnt_t, 0) : __GMP_CAST (mp_bitcnt_t, 0));
1852173419cfSchristos if (__GMP_LIKELY (__gmp_usize > 0))
1853173419cfSchristos __gmp_result = mpn_popcount (__gmp_u->_mp_d, __gmp_usize);
1854173419cfSchristos return __gmp_result;
1855173419cfSchristos }
1856173419cfSchristos #endif
1857173419cfSchristos
1858173419cfSchristos #if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpz_set_q)
1859173419cfSchristos #if ! defined (__GMP_FORCE_mpz_set_q)
1860173419cfSchristos __GMP_EXTERN_INLINE
1861173419cfSchristos #endif
1862173419cfSchristos void
mpz_set_q(mpz_ptr __gmp_w,mpq_srcptr __gmp_u)1863173419cfSchristos mpz_set_q (mpz_ptr __gmp_w, mpq_srcptr __gmp_u)
1864173419cfSchristos {
1865173419cfSchristos mpz_tdiv_q (__gmp_w, mpq_numref (__gmp_u), mpq_denref (__gmp_u));
1866173419cfSchristos }
1867173419cfSchristos #endif
1868173419cfSchristos
1869173419cfSchristos #if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpz_size)
1870173419cfSchristos #if ! defined (__GMP_FORCE_mpz_size)
1871173419cfSchristos __GMP_EXTERN_INLINE
1872173419cfSchristos #endif
1873173419cfSchristos size_t
mpz_size(mpz_srcptr __gmp_z)1874173419cfSchristos mpz_size (mpz_srcptr __gmp_z) __GMP_NOTHROW
1875173419cfSchristos {
1876173419cfSchristos return __GMP_ABS (__gmp_z->_mp_size);
1877173419cfSchristos }
1878173419cfSchristos #endif
1879173419cfSchristos
1880173419cfSchristos
1881173419cfSchristos /**************** mpq inlines ****************/
1882173419cfSchristos
1883173419cfSchristos #if defined (__GMP_EXTERN_INLINE) && ! defined (__GMP_FORCE_mpq_abs)
1884173419cfSchristos __GMP_EXTERN_INLINE void
mpq_abs(mpq_ptr __gmp_w,mpq_srcptr __gmp_u)1885173419cfSchristos mpq_abs (mpq_ptr __gmp_w, mpq_srcptr __gmp_u)
1886173419cfSchristos {
1887173419cfSchristos if (__gmp_w != __gmp_u)
1888173419cfSchristos mpq_set (__gmp_w, __gmp_u);
1889173419cfSchristos __gmp_w->_mp_num._mp_size = __GMP_ABS (__gmp_w->_mp_num._mp_size);
1890173419cfSchristos }
1891173419cfSchristos #endif
1892173419cfSchristos
1893173419cfSchristos #if defined (__GMP_EXTERN_INLINE) && ! defined (__GMP_FORCE_mpq_neg)
1894173419cfSchristos __GMP_EXTERN_INLINE void
mpq_neg(mpq_ptr __gmp_w,mpq_srcptr __gmp_u)1895173419cfSchristos mpq_neg (mpq_ptr __gmp_w, mpq_srcptr __gmp_u)
1896173419cfSchristos {
1897173419cfSchristos if (__gmp_w != __gmp_u)
1898173419cfSchristos mpq_set (__gmp_w, __gmp_u);
1899173419cfSchristos __gmp_w->_mp_num._mp_size = - __gmp_w->_mp_num._mp_size;
1900173419cfSchristos }
1901173419cfSchristos #endif
1902173419cfSchristos
1903173419cfSchristos
1904173419cfSchristos /**************** mpn inlines ****************/
1905173419cfSchristos
1906173419cfSchristos /* The comments with __GMPN_ADD_1 below apply here too.
1907173419cfSchristos
1908173419cfSchristos The test for FUNCTION returning 0 should predict well. If it's assumed
1909173419cfSchristos {yp,ysize} will usually have a random number of bits then the high limb
1910173419cfSchristos won't be full and a carry out will occur a good deal less than 50% of the
1911173419cfSchristos time.
1912173419cfSchristos
1913173419cfSchristos ysize==0 isn't a documented feature, but is used internally in a few
1914173419cfSchristos places.
1915173419cfSchristos
1916173419cfSchristos Producing cout last stops it using up a register during the main part of
1917173419cfSchristos the calculation, though gcc (as of 3.0) on an "if (mpn_add (...))"
1918173419cfSchristos doesn't seem able to move the true and false legs of the conditional up
1919173419cfSchristos to the two places cout is generated. */
1920173419cfSchristos
1921173419cfSchristos #define __GMPN_AORS(cout, wp, xp, xsize, yp, ysize, FUNCTION, TEST) \
1922173419cfSchristos do { \
1923173419cfSchristos mp_size_t __gmp_i; \
1924173419cfSchristos mp_limb_t __gmp_x; \
1925173419cfSchristos \
1926173419cfSchristos /* ASSERT ((ysize) >= 0); */ \
1927173419cfSchristos /* ASSERT ((xsize) >= (ysize)); */ \
1928173419cfSchristos /* ASSERT (MPN_SAME_OR_SEPARATE2_P (wp, xsize, xp, xsize)); */ \
1929173419cfSchristos /* ASSERT (MPN_SAME_OR_SEPARATE2_P (wp, xsize, yp, ysize)); */ \
1930173419cfSchristos \
1931173419cfSchristos __gmp_i = (ysize); \
1932173419cfSchristos if (__gmp_i != 0) \
1933173419cfSchristos { \
1934173419cfSchristos if (FUNCTION (wp, xp, yp, __gmp_i)) \
1935173419cfSchristos { \
1936173419cfSchristos do \
1937173419cfSchristos { \
1938173419cfSchristos if (__gmp_i >= (xsize)) \
1939173419cfSchristos { \
1940173419cfSchristos (cout) = 1; \
1941173419cfSchristos goto __gmp_done; \
1942173419cfSchristos } \
1943173419cfSchristos __gmp_x = (xp)[__gmp_i]; \
1944173419cfSchristos } \
1945173419cfSchristos while (TEST); \
1946173419cfSchristos } \
1947173419cfSchristos } \
1948173419cfSchristos if ((wp) != (xp)) \
1949173419cfSchristos __GMPN_COPY_REST (wp, xp, xsize, __gmp_i); \
1950173419cfSchristos (cout) = 0; \
1951173419cfSchristos __gmp_done: \
1952173419cfSchristos ; \
1953173419cfSchristos } while (0)
1954173419cfSchristos
1955173419cfSchristos #define __GMPN_ADD(cout, wp, xp, xsize, yp, ysize) \
1956173419cfSchristos __GMPN_AORS (cout, wp, xp, xsize, yp, ysize, mpn_add_n, \
1957173419cfSchristos (((wp)[__gmp_i++] = (__gmp_x + 1) & GMP_NUMB_MASK) == 0))
1958173419cfSchristos #define __GMPN_SUB(cout, wp, xp, xsize, yp, ysize) \
1959173419cfSchristos __GMPN_AORS (cout, wp, xp, xsize, yp, ysize, mpn_sub_n, \
1960173419cfSchristos (((wp)[__gmp_i++] = (__gmp_x - 1) & GMP_NUMB_MASK), __gmp_x == 0))
1961173419cfSchristos
1962173419cfSchristos
1963173419cfSchristos /* The use of __gmp_i indexing is designed to ensure a compile time src==dst
1964173419cfSchristos remains nice and clear to the compiler, so that __GMPN_COPY_REST can
1965173419cfSchristos disappear, and the load/add/store gets a chance to become a
1966173419cfSchristos read-modify-write on CISC CPUs.
1967173419cfSchristos
1968173419cfSchristos Alternatives:
1969173419cfSchristos
1970173419cfSchristos Using a pair of pointers instead of indexing would be possible, but gcc
1971173419cfSchristos isn't able to recognise compile-time src==dst in that case, even when the
1972173419cfSchristos pointers are incremented more or less together. Other compilers would
1973173419cfSchristos very likely have similar difficulty.
1974173419cfSchristos
1975173419cfSchristos gcc could use "if (__builtin_constant_p(src==dst) && src==dst)" or
1976173419cfSchristos similar to detect a compile-time src==dst. This works nicely on gcc
1977173419cfSchristos 2.95.x, it's not good on gcc 3.0 where __builtin_constant_p(p==p) seems
1978173419cfSchristos to be always false, for a pointer p. But the current code form seems
1979173419cfSchristos good enough for src==dst anyway.
1980173419cfSchristos
1981173419cfSchristos gcc on x86 as usual doesn't give particularly good flags handling for the
1982173419cfSchristos carry/borrow detection. It's tempting to want some multi instruction asm
1983173419cfSchristos blocks to help it, and this was tried, but in truth there's only a few
1984173419cfSchristos instructions to save and any gain is all too easily lost by register
1985173419cfSchristos juggling setting up for the asm. */
1986173419cfSchristos
1987173419cfSchristos #if GMP_NAIL_BITS == 0
1988173419cfSchristos #define __GMPN_AORS_1(cout, dst, src, n, v, OP, CB) \
1989173419cfSchristos do { \
1990173419cfSchristos mp_size_t __gmp_i; \
1991173419cfSchristos mp_limb_t __gmp_x, __gmp_r; \
1992173419cfSchristos \
1993173419cfSchristos /* ASSERT ((n) >= 1); */ \
1994173419cfSchristos /* ASSERT (MPN_SAME_OR_SEPARATE_P (dst, src, n)); */ \
1995173419cfSchristos \
1996173419cfSchristos __gmp_x = (src)[0]; \
1997173419cfSchristos __gmp_r = __gmp_x OP (v); \
1998173419cfSchristos (dst)[0] = __gmp_r; \
1999173419cfSchristos if (CB (__gmp_r, __gmp_x, (v))) \
2000173419cfSchristos { \
2001173419cfSchristos (cout) = 1; \
2002173419cfSchristos for (__gmp_i = 1; __gmp_i < (n);) \
2003173419cfSchristos { \
2004173419cfSchristos __gmp_x = (src)[__gmp_i]; \
2005173419cfSchristos __gmp_r = __gmp_x OP 1; \
2006173419cfSchristos (dst)[__gmp_i] = __gmp_r; \
2007173419cfSchristos ++__gmp_i; \
2008173419cfSchristos if (!CB (__gmp_r, __gmp_x, 1)) \
2009173419cfSchristos { \
2010173419cfSchristos if ((src) != (dst)) \
2011173419cfSchristos __GMPN_COPY_REST (dst, src, n, __gmp_i); \
2012173419cfSchristos (cout) = 0; \
2013173419cfSchristos break; \
2014173419cfSchristos } \
2015173419cfSchristos } \
2016173419cfSchristos } \
2017173419cfSchristos else \
2018173419cfSchristos { \
2019173419cfSchristos if ((src) != (dst)) \
2020173419cfSchristos __GMPN_COPY_REST (dst, src, n, 1); \
2021173419cfSchristos (cout) = 0; \
2022173419cfSchristos } \
2023173419cfSchristos } while (0)
2024173419cfSchristos #endif
2025173419cfSchristos
2026173419cfSchristos #if GMP_NAIL_BITS >= 1
2027173419cfSchristos #define __GMPN_AORS_1(cout, dst, src, n, v, OP, CB) \
2028173419cfSchristos do { \
2029173419cfSchristos mp_size_t __gmp_i; \
2030173419cfSchristos mp_limb_t __gmp_x, __gmp_r; \
2031173419cfSchristos \
2032173419cfSchristos /* ASSERT ((n) >= 1); */ \
2033173419cfSchristos /* ASSERT (MPN_SAME_OR_SEPARATE_P (dst, src, n)); */ \
2034173419cfSchristos \
2035173419cfSchristos __gmp_x = (src)[0]; \
2036173419cfSchristos __gmp_r = __gmp_x OP (v); \
2037173419cfSchristos (dst)[0] = __gmp_r & GMP_NUMB_MASK; \
2038173419cfSchristos if (__gmp_r >> GMP_NUMB_BITS != 0) \
2039173419cfSchristos { \
2040173419cfSchristos (cout) = 1; \
2041173419cfSchristos for (__gmp_i = 1; __gmp_i < (n);) \
2042173419cfSchristos { \
2043173419cfSchristos __gmp_x = (src)[__gmp_i]; \
2044173419cfSchristos __gmp_r = __gmp_x OP 1; \
2045173419cfSchristos (dst)[__gmp_i] = __gmp_r & GMP_NUMB_MASK; \
2046173419cfSchristos ++__gmp_i; \
2047173419cfSchristos if (__gmp_r >> GMP_NUMB_BITS == 0) \
2048173419cfSchristos { \
2049173419cfSchristos if ((src) != (dst)) \
2050173419cfSchristos __GMPN_COPY_REST (dst, src, n, __gmp_i); \
2051173419cfSchristos (cout) = 0; \
2052173419cfSchristos break; \
2053173419cfSchristos } \
2054173419cfSchristos } \
2055173419cfSchristos } \
2056173419cfSchristos else \
2057173419cfSchristos { \
2058173419cfSchristos if ((src) != (dst)) \
2059173419cfSchristos __GMPN_COPY_REST (dst, src, n, 1); \
2060173419cfSchristos (cout) = 0; \
2061173419cfSchristos } \
2062173419cfSchristos } while (0)
2063173419cfSchristos #endif
2064173419cfSchristos
2065173419cfSchristos #define __GMPN_ADDCB(r,x,y) ((r) < (y))
2066173419cfSchristos #define __GMPN_SUBCB(r,x,y) ((x) < (y))
2067173419cfSchristos
2068173419cfSchristos #define __GMPN_ADD_1(cout, dst, src, n, v) \
2069173419cfSchristos __GMPN_AORS_1(cout, dst, src, n, v, +, __GMPN_ADDCB)
2070173419cfSchristos #define __GMPN_SUB_1(cout, dst, src, n, v) \
2071173419cfSchristos __GMPN_AORS_1(cout, dst, src, n, v, -, __GMPN_SUBCB)
2072173419cfSchristos
2073173419cfSchristos
2074173419cfSchristos /* Compare {xp,size} and {yp,size}, setting "result" to positive, zero or
2075173419cfSchristos negative. size==0 is allowed. On random data usually only one limb will
2076173419cfSchristos need to be examined to get a result, so it's worth having it inline. */
2077173419cfSchristos #define __GMPN_CMP(result, xp, yp, size) \
2078173419cfSchristos do { \
2079173419cfSchristos mp_size_t __gmp_i; \
2080173419cfSchristos mp_limb_t __gmp_x, __gmp_y; \
2081173419cfSchristos \
2082173419cfSchristos /* ASSERT ((size) >= 0); */ \
2083173419cfSchristos \
2084173419cfSchristos (result) = 0; \
2085173419cfSchristos __gmp_i = (size); \
2086173419cfSchristos while (--__gmp_i >= 0) \
2087173419cfSchristos { \
2088173419cfSchristos __gmp_x = (xp)[__gmp_i]; \
2089173419cfSchristos __gmp_y = (yp)[__gmp_i]; \
2090173419cfSchristos if (__gmp_x != __gmp_y) \
2091173419cfSchristos { \
2092173419cfSchristos /* Cannot use __gmp_x - __gmp_y, may overflow an "int" */ \
2093173419cfSchristos (result) = (__gmp_x > __gmp_y ? 1 : -1); \
2094173419cfSchristos break; \
2095173419cfSchristos } \
2096173419cfSchristos } \
2097173419cfSchristos } while (0)
2098173419cfSchristos
2099173419cfSchristos
2100173419cfSchristos #if defined (__GMPN_COPY) && ! defined (__GMPN_COPY_REST)
2101173419cfSchristos #define __GMPN_COPY_REST(dst, src, size, start) \
2102173419cfSchristos do { \
2103173419cfSchristos /* ASSERT ((start) >= 0); */ \
2104173419cfSchristos /* ASSERT ((start) <= (size)); */ \
2105173419cfSchristos __GMPN_COPY ((dst)+(start), (src)+(start), (size)-(start)); \
2106173419cfSchristos } while (0)
2107173419cfSchristos #endif
2108173419cfSchristos
2109173419cfSchristos /* Copy {src,size} to {dst,size}, starting at "start". This is designed to
2110173419cfSchristos keep the indexing dst[j] and src[j] nice and simple for __GMPN_ADD_1,
2111173419cfSchristos __GMPN_ADD, etc. */
2112173419cfSchristos #if ! defined (__GMPN_COPY_REST)
2113173419cfSchristos #define __GMPN_COPY_REST(dst, src, size, start) \
2114173419cfSchristos do { \
2115173419cfSchristos mp_size_t __gmp_j; \
2116173419cfSchristos /* ASSERT ((size) >= 0); */ \
2117173419cfSchristos /* ASSERT ((start) >= 0); */ \
2118173419cfSchristos /* ASSERT ((start) <= (size)); */ \
2119173419cfSchristos /* ASSERT (MPN_SAME_OR_SEPARATE_P (dst, src, size)); */ \
2120173419cfSchristos __GMP_CRAY_Pragma ("_CRI ivdep"); \
2121173419cfSchristos for (__gmp_j = (start); __gmp_j < (size); __gmp_j++) \
2122173419cfSchristos (dst)[__gmp_j] = (src)[__gmp_j]; \
2123173419cfSchristos } while (0)
2124173419cfSchristos #endif
2125173419cfSchristos
2126173419cfSchristos /* Enhancement: Use some of the smarter code from gmp-impl.h. Maybe use
2127173419cfSchristos mpn_copyi if there's a native version, and if we don't mind demanding
2128173419cfSchristos binary compatibility for it (on targets which use it). */
2129173419cfSchristos
2130173419cfSchristos #if ! defined (__GMPN_COPY)
2131173419cfSchristos #define __GMPN_COPY(dst, src, size) __GMPN_COPY_REST (dst, src, size, 0)
2132173419cfSchristos #endif
2133173419cfSchristos
2134173419cfSchristos
2135173419cfSchristos #if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpn_add)
2136173419cfSchristos #if ! defined (__GMP_FORCE_mpn_add)
2137173419cfSchristos __GMP_EXTERN_INLINE
2138173419cfSchristos #endif
2139173419cfSchristos mp_limb_t
mpn_add(mp_ptr __gmp_wp,mp_srcptr __gmp_xp,mp_size_t __gmp_xsize,mp_srcptr __gmp_yp,mp_size_t __gmp_ysize)2140173419cfSchristos mpn_add (mp_ptr __gmp_wp, mp_srcptr __gmp_xp, mp_size_t __gmp_xsize, mp_srcptr __gmp_yp, mp_size_t __gmp_ysize)
2141173419cfSchristos {
2142173419cfSchristos mp_limb_t __gmp_c;
2143173419cfSchristos __GMPN_ADD (__gmp_c, __gmp_wp, __gmp_xp, __gmp_xsize, __gmp_yp, __gmp_ysize);
2144173419cfSchristos return __gmp_c;
2145173419cfSchristos }
2146173419cfSchristos #endif
2147173419cfSchristos
2148173419cfSchristos #if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpn_add_1)
2149173419cfSchristos #if ! defined (__GMP_FORCE_mpn_add_1)
2150173419cfSchristos __GMP_EXTERN_INLINE
2151173419cfSchristos #endif
2152173419cfSchristos mp_limb_t
mpn_add_1(mp_ptr __gmp_dst,mp_srcptr __gmp_src,mp_size_t __gmp_size,mp_limb_t __gmp_n)2153173419cfSchristos mpn_add_1 (mp_ptr __gmp_dst, mp_srcptr __gmp_src, mp_size_t __gmp_size, mp_limb_t __gmp_n) __GMP_NOTHROW
2154173419cfSchristos {
2155173419cfSchristos mp_limb_t __gmp_c;
2156173419cfSchristos __GMPN_ADD_1 (__gmp_c, __gmp_dst, __gmp_src, __gmp_size, __gmp_n);
2157173419cfSchristos return __gmp_c;
2158173419cfSchristos }
2159173419cfSchristos #endif
2160173419cfSchristos
2161173419cfSchristos #if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpn_cmp)
2162173419cfSchristos #if ! defined (__GMP_FORCE_mpn_cmp)
2163173419cfSchristos __GMP_EXTERN_INLINE
2164173419cfSchristos #endif
2165173419cfSchristos int
mpn_cmp(mp_srcptr __gmp_xp,mp_srcptr __gmp_yp,mp_size_t __gmp_size)2166173419cfSchristos mpn_cmp (mp_srcptr __gmp_xp, mp_srcptr __gmp_yp, mp_size_t __gmp_size) __GMP_NOTHROW
2167173419cfSchristos {
2168173419cfSchristos int __gmp_result;
2169173419cfSchristos __GMPN_CMP (__gmp_result, __gmp_xp, __gmp_yp, __gmp_size);
2170173419cfSchristos return __gmp_result;
2171173419cfSchristos }
2172173419cfSchristos #endif
2173173419cfSchristos
2174173419cfSchristos #if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpn_zero_p)
2175173419cfSchristos #if ! defined (__GMP_FORCE_mpn_zero_p)
2176173419cfSchristos __GMP_EXTERN_INLINE
2177173419cfSchristos #endif
2178173419cfSchristos int
mpn_zero_p(mp_srcptr __gmp_p,mp_size_t __gmp_n)2179173419cfSchristos mpn_zero_p (mp_srcptr __gmp_p, mp_size_t __gmp_n) __GMP_NOTHROW
2180173419cfSchristos {
2181173419cfSchristos /* if (__GMP_LIKELY (__gmp_n > 0)) */
2182173419cfSchristos do {
2183173419cfSchristos if (__gmp_p[--__gmp_n] != 0)
2184173419cfSchristos return 0;
2185173419cfSchristos } while (__gmp_n != 0);
2186173419cfSchristos return 1;
2187173419cfSchristos }
2188173419cfSchristos #endif
2189173419cfSchristos
2190173419cfSchristos #if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpn_sub)
2191173419cfSchristos #if ! defined (__GMP_FORCE_mpn_sub)
2192173419cfSchristos __GMP_EXTERN_INLINE
2193173419cfSchristos #endif
2194173419cfSchristos mp_limb_t
mpn_sub(mp_ptr __gmp_wp,mp_srcptr __gmp_xp,mp_size_t __gmp_xsize,mp_srcptr __gmp_yp,mp_size_t __gmp_ysize)2195173419cfSchristos mpn_sub (mp_ptr __gmp_wp, mp_srcptr __gmp_xp, mp_size_t __gmp_xsize, mp_srcptr __gmp_yp, mp_size_t __gmp_ysize)
2196173419cfSchristos {
2197173419cfSchristos mp_limb_t __gmp_c;
2198173419cfSchristos __GMPN_SUB (__gmp_c, __gmp_wp, __gmp_xp, __gmp_xsize, __gmp_yp, __gmp_ysize);
2199173419cfSchristos return __gmp_c;
2200173419cfSchristos }
2201173419cfSchristos #endif
2202173419cfSchristos
2203173419cfSchristos #if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpn_sub_1)
2204173419cfSchristos #if ! defined (__GMP_FORCE_mpn_sub_1)
2205173419cfSchristos __GMP_EXTERN_INLINE
2206173419cfSchristos #endif
2207173419cfSchristos mp_limb_t
mpn_sub_1(mp_ptr __gmp_dst,mp_srcptr __gmp_src,mp_size_t __gmp_size,mp_limb_t __gmp_n)2208173419cfSchristos mpn_sub_1 (mp_ptr __gmp_dst, mp_srcptr __gmp_src, mp_size_t __gmp_size, mp_limb_t __gmp_n) __GMP_NOTHROW
2209173419cfSchristos {
2210173419cfSchristos mp_limb_t __gmp_c;
2211173419cfSchristos __GMPN_SUB_1 (__gmp_c, __gmp_dst, __gmp_src, __gmp_size, __gmp_n);
2212173419cfSchristos return __gmp_c;
2213173419cfSchristos }
2214173419cfSchristos #endif
2215173419cfSchristos
2216173419cfSchristos #if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpn_neg)
2217173419cfSchristos #if ! defined (__GMP_FORCE_mpn_neg)
2218173419cfSchristos __GMP_EXTERN_INLINE
2219173419cfSchristos #endif
2220173419cfSchristos mp_limb_t
mpn_neg(mp_ptr __gmp_rp,mp_srcptr __gmp_up,mp_size_t __gmp_n)2221173419cfSchristos mpn_neg (mp_ptr __gmp_rp, mp_srcptr __gmp_up, mp_size_t __gmp_n)
2222173419cfSchristos {
2223173419cfSchristos while (*__gmp_up == 0) /* Low zero limbs are unchanged by negation. */
2224173419cfSchristos {
2225173419cfSchristos *__gmp_rp = 0;
2226173419cfSchristos if (!--__gmp_n) /* All zero */
2227173419cfSchristos return 0;
2228173419cfSchristos ++__gmp_up; ++__gmp_rp;
2229173419cfSchristos }
2230173419cfSchristos
2231173419cfSchristos *__gmp_rp = (- *__gmp_up) & GMP_NUMB_MASK;
2232173419cfSchristos
2233173419cfSchristos if (--__gmp_n) /* Higher limbs get complemented. */
2234173419cfSchristos mpn_com (++__gmp_rp, ++__gmp_up, __gmp_n);
2235173419cfSchristos
2236173419cfSchristos return 1;
2237173419cfSchristos }
2238173419cfSchristos #endif
2239173419cfSchristos
2240173419cfSchristos #if defined (__cplusplus)
2241173419cfSchristos }
2242173419cfSchristos #endif
2243173419cfSchristos
2244173419cfSchristos
2245173419cfSchristos /* Allow faster testing for negative, zero, and positive. */
2246173419cfSchristos #define mpz_sgn(Z) ((Z)->_mp_size < 0 ? -1 : (Z)->_mp_size > 0)
2247173419cfSchristos #define mpf_sgn(F) ((F)->_mp_size < 0 ? -1 : (F)->_mp_size > 0)
2248173419cfSchristos #define mpq_sgn(Q) ((Q)->_mp_num._mp_size < 0 ? -1 : (Q)->_mp_num._mp_size > 0)
2249173419cfSchristos
2250173419cfSchristos /* When using GCC, optimize certain common comparisons. */
2251173419cfSchristos #if defined (__GNUC__) && __GNUC__ >= 2
2252173419cfSchristos #define mpz_cmp_ui(Z,UI) \
2253173419cfSchristos (__builtin_constant_p (UI) && (UI) == 0 \
2254173419cfSchristos ? mpz_sgn (Z) : _mpz_cmp_ui (Z,UI))
2255173419cfSchristos #define mpz_cmp_si(Z,SI) \
2256173419cfSchristos (__builtin_constant_p ((SI) >= 0) && (SI) >= 0 \
2257173419cfSchristos ? mpz_cmp_ui (Z, __GMP_CAST (unsigned long, SI)) \
2258173419cfSchristos : _mpz_cmp_si (Z,SI))
2259173419cfSchristos #define mpq_cmp_ui(Q,NUI,DUI) \
2260173419cfSchristos (__builtin_constant_p (NUI) && (NUI) == 0 ? mpq_sgn (Q) \
2261173419cfSchristos : __builtin_constant_p ((NUI) == (DUI)) && (NUI) == (DUI) \
2262173419cfSchristos ? mpz_cmp (mpq_numref (Q), mpq_denref (Q)) \
2263173419cfSchristos : _mpq_cmp_ui (Q,NUI,DUI))
2264173419cfSchristos #define mpq_cmp_si(q,n,d) \
2265173419cfSchristos (__builtin_constant_p ((n) >= 0) && (n) >= 0 \
2266173419cfSchristos ? mpq_cmp_ui (q, __GMP_CAST (unsigned long, n), d) \
2267173419cfSchristos : _mpq_cmp_si (q, n, d))
2268173419cfSchristos #else
2269173419cfSchristos #define mpz_cmp_ui(Z,UI) _mpz_cmp_ui (Z,UI)
2270173419cfSchristos #define mpz_cmp_si(Z,UI) _mpz_cmp_si (Z,UI)
2271173419cfSchristos #define mpq_cmp_ui(Q,NUI,DUI) _mpq_cmp_ui (Q,NUI,DUI)
2272173419cfSchristos #define mpq_cmp_si(q,n,d) _mpq_cmp_si(q,n,d)
2273173419cfSchristos #endif
2274173419cfSchristos
2275173419cfSchristos
2276173419cfSchristos /* Using "&" rather than "&&" means these can come out branch-free. Every
2277173419cfSchristos mpz_t has at least one limb allocated, so fetching the low limb is always
2278173419cfSchristos allowed. */
2279173419cfSchristos #define mpz_odd_p(z) (((z)->_mp_size != 0) & __GMP_CAST (int, (z)->_mp_d[0]))
2280173419cfSchristos #define mpz_even_p(z) (! mpz_odd_p (z))
2281173419cfSchristos
2282173419cfSchristos
2283173419cfSchristos /**************** C++ routines ****************/
2284173419cfSchristos
2285173419cfSchristos #ifdef __cplusplus
2286173419cfSchristos __GMP_DECLSPEC_XX std::ostream& operator<< (std::ostream &, mpz_srcptr);
2287173419cfSchristos __GMP_DECLSPEC_XX std::ostream& operator<< (std::ostream &, mpq_srcptr);
2288173419cfSchristos __GMP_DECLSPEC_XX std::ostream& operator<< (std::ostream &, mpf_srcptr);
2289173419cfSchristos __GMP_DECLSPEC_XX std::istream& operator>> (std::istream &, mpz_ptr);
2290173419cfSchristos __GMP_DECLSPEC_XX std::istream& operator>> (std::istream &, mpq_ptr);
2291173419cfSchristos __GMP_DECLSPEC_XX std::istream& operator>> (std::istream &, mpf_ptr);
2292173419cfSchristos #endif
2293173419cfSchristos
2294173419cfSchristos
2295173419cfSchristos /* Source-level compatibility with GMP 2 and earlier. */
2296173419cfSchristos #define mpn_divmod(qp,np,nsize,dp,dsize) \
2297173419cfSchristos mpn_divrem (qp, __GMP_CAST (mp_size_t, 0), np, nsize, dp, dsize)
2298173419cfSchristos
2299173419cfSchristos /* Source-level compatibility with GMP 1. */
2300173419cfSchristos #define mpz_mdiv mpz_fdiv_q
2301173419cfSchristos #define mpz_mdivmod mpz_fdiv_qr
2302173419cfSchristos #define mpz_mmod mpz_fdiv_r
2303173419cfSchristos #define mpz_mdiv_ui mpz_fdiv_q_ui
2304173419cfSchristos #define mpz_mdivmod_ui(q,r,n,d) \
2305173419cfSchristos (((r) == 0) ? mpz_fdiv_q_ui (q,n,d) : mpz_fdiv_qr_ui (q,r,n,d))
2306173419cfSchristos #define mpz_mmod_ui(r,n,d) \
2307173419cfSchristos (((r) == 0) ? mpz_fdiv_ui (n,d) : mpz_fdiv_r_ui (r,n,d))
2308173419cfSchristos
2309173419cfSchristos /* Useful synonyms, but not quite compatible with GMP 1. */
2310173419cfSchristos #define mpz_div mpz_fdiv_q
2311173419cfSchristos #define mpz_divmod mpz_fdiv_qr
2312173419cfSchristos #define mpz_div_ui mpz_fdiv_q_ui
2313173419cfSchristos #define mpz_divmod_ui mpz_fdiv_qr_ui
2314173419cfSchristos #define mpz_div_2exp mpz_fdiv_q_2exp
2315173419cfSchristos #define mpz_mod_2exp mpz_fdiv_r_2exp
2316173419cfSchristos
2317173419cfSchristos enum
2318173419cfSchristos {
2319173419cfSchristos GMP_ERROR_NONE = 0,
2320173419cfSchristos GMP_ERROR_UNSUPPORTED_ARGUMENT = 1,
2321173419cfSchristos GMP_ERROR_DIVISION_BY_ZERO = 2,
2322173419cfSchristos GMP_ERROR_SQRT_OF_NEGATIVE = 4,
2323173419cfSchristos GMP_ERROR_INVALID_ARGUMENT = 8
2324173419cfSchristos };
2325173419cfSchristos
2326173419cfSchristos /* Define CC and CFLAGS which were used to build this version of GMP */
2327173419cfSchristos #define __GMP_CC "gcc"
2328*dbbd8e88Smrg #define __GMP_CFLAGS "-O2 -pedantic"
2329173419cfSchristos
2330173419cfSchristos /* Major version number is the value of __GNU_MP__ too, above. */
2331173419cfSchristos #define __GNU_MP_VERSION 6
2332173419cfSchristos #define __GNU_MP_VERSION_MINOR 2
2333*dbbd8e88Smrg #define __GNU_MP_VERSION_PATCHLEVEL 1
2334173419cfSchristos #define __GNU_MP_RELEASE (__GNU_MP_VERSION * 10000 + __GNU_MP_VERSION_MINOR * 100 + __GNU_MP_VERSION_PATCHLEVEL)
2335173419cfSchristos
2336173419cfSchristos #define __GMP_H__
2337173419cfSchristos #endif /* __GMP_H__ */
2338