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