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