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