~ubuntu-branches/ubuntu/quantal/gclcvs/quantal

« back to all changes in this revision

Viewing changes to gmp3/gmp-h.in

  • Committer: Bazaar Package Importer
  • Author(s): Camm Maguire
  • Date: 2004-06-24 15:13:46 UTC
  • Revision ID: james.westby@ubuntu.com-20040624151346-xh0xaaktyyp7aorc
Tags: 2.7.0-26
C_GC_OFFSET is 2 on m68k-linux

Show diffs side-by-side

added added

removed removed

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