Ticket #11616: mpir-2.4.0.p2-p3.diff

File mpir-2.4.0.p2-p3.diff, 143.6 KB (added by jdemeyer, 9 years ago)

Diff between the 2.4.0.p2 and 2.4.0.p3 spkgs. For reference / review only.

  • SPKG.txt

    diff --git a/SPKG.txt b/SPKG.txt
    a b  
    2424
    2525== Special Update/Build Instructions ==
    2626 * TODO:
    27    - Use 'patch' also to (unconditionally) apply the harmless patch for Sun CC
    28      (on SunOS), as the current prepatched file which is still copied over has
    29      to get refreshed on each upgrade.
    3027   - Perhaps also modify CXXFLAGS (and/or CPPFLAGS).
    3128   - We currently don't use anything of GMP's/MPIR's CC setting, and matching
    3229     with the current compiler (`$CC`) is perhaps suboptimal.
     
    4643   (Saves 13 of 40 MB uncompressed.)
    4744
    4845=== Patches ===
    49  * We currently apply a trivial patch to gmp-h.in on SunOS such that
    50    MPIR would compile with Sun CC there.  See also `spkg-install`.
    51    This patch could be applied on all platforms, as the changes only take
    52    effect if the preprocessor variable `__SUNPRO_CC` is defined.
     46 * gmp-h.in.patch: a trivial patch adding some #includes such that MPIR
     47   would compile on SunOS with Sun CC.  The changes in this patch only
     48   take effect if the preprocessor variable `__SUNPRO_CC` is defined.
    5349 * We apply a simple patch to upstream yasm's re2c code, to avoid a potential
    5450   race condition when building yasm in parallel.  (Cf. #11844.)
     51 * quote_asm.patch: replace things of the form "define(OPERATION_foo,1)" by
     52   "define(`OPERATION_foo',1)".  This gives proper quoting for use with m4,
     53   otherwise the define might expand to "define(,1)".  Some versions of m4
     54   bail out with an error when encountering "define(,1)".
     55   These files were patched using
     56     find mpn -name '*.asm' -exec sed -i 's/define(\(OPERATION[^,]*\),/define(\`\1'"'"',/' {} \;
    5557
    5658== Changelog ==
    5759
     60=== mpir-2.4.0.p3 (Jeroen Demeyer, April 26th, 2012) ===
     61 Trac #11616, reviewer fixes:
     62 * When the first configure run (with CFLAGS unset) of MPIR fails, bail
     63   out with an error.  I am not aware of any system where MPIR fails
     64   to configure with CFLAGS unset but succeeds with CFLAGS set.
     65   This implies the following simplifications:
     66   - We no longer read CC and CFLAGS from /usr/include/gmp.h or
     67     /usr/local/include/gmp.h
     68   - We no longer try to add -march=native, we simply use MPIR's flags.
     69 * Extract $CC and $CFLAGS from Makefile instead of mpir.h, which is
     70   simpler and more reliable.
     71 * Added `quote_asm.patch` to add proper quoting to the m4 in .asm files.
     72 * Use `patch` to patch gmp-h.in instead of copying the file.
     73 * In get_processor_specific_cflags() in spkg-install, also check for
     74   -mpower* and -mno-power* flags, as MPIR adds -mpower on 32-bit
     75   PowerPC systems.
     76
    5877=== mpir-2.4.0.p2 (Leif Leonhardy, April 4th, 2012) ===
    5978 #11616 (upgrading MPIR), further fixes:
    6079 * Before enabling `-march=native`, minimalistically check whether the
  • deleted file patches/gmp-h.in

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

    diff --git a/patches/gmp-h.in.diff b/patches/gmp-h.in.diff
    deleted file mode 100644
    + -  
    1 --- ../src/gmp-h.in     2010-06-24 03:35:47.000000000 -0700
    2 +++ gmp-h.in    2010-08-16 22:04:40.000000000 -0700
    3 @@ -22,6 +22,11 @@
    4  
    5  #ifndef __GMP_H__
    6  
    7 +#ifdef __SUNPRO_CC    /* See: http://trac.sagemath.org/sage_trac/ticket/7849 */
    8 +#include <stddef.h>   /* This is Bill Hart's fix, but I've applied it only */
    9 +#include <stdarg.h>   /* on Sun Studio */
    10 +#endif
    11 +
    12  #if defined (__cplusplus)
    13  #include <iosfwd>   /* for std::istream, std::ostream, std::string */
    14  #include <cstdio>
  • new file patches/gmp-h.in.patch

    diff --git a/patches/gmp-h.in.patch b/patches/gmp-h.in.patch
    new file mode 100644
    - +  
     1diff -ru src/gmp-h.in src.patched/gmp-h.in
     2--- src/gmp-h.in        2011-06-14 07:33:49.000000000 +0200
     3+++ src.patched/gmp-h.in        2012-04-07 14:32:53.758280009 +0200
     4@@ -22,6 +22,11 @@
     5 
     6 #ifndef __GMP_H__
     7 
     8+#ifdef __SUNPRO_CC    /* See: http://trac.sagemath.org/sage_trac/ticket/7849 */
     9+#include <stddef.h>   /* This is Bill Hart's fix, but I've applied it only */
     10+#include <stdarg.h>   /* on Sun Studio */
     11+#endif
     12+
     13 #if defined (__cplusplus)
     14 #include <iosfwd>   /* for std::istream, std::ostream, std::string */
     15 #include <cstdio>
  • new file patches/quote_asm.patch

    diff --git a/patches/quote_asm.patch b/patches/quote_asm.patch
    new file mode 100644
    - +  
     1diff -ru src/mpn/alpha/addlsh1_n.asm src.patched/mpn/alpha/addlsh1_n.asm
     2--- src/mpn/alpha/addlsh1_n.asm 2010-12-31 08:26:24.000000000 +0100
     3+++ src.patched/mpn/alpha/addlsh1_n.asm 2012-04-07 14:27:57.058280100 +0200
     4@@ -54,7 +54,7 @@
     5 define(`ps', `r25')
     6 define(`sl', `r28')
     7 
     8-define(OPERATION_addlsh1_n,1)
     9+define(`OPERATION_addlsh1_n',1)
     10 
     11 ifdef(`OPERATION_addlsh1_n',`
     12   define(ADDSUB,       addq)
     13diff -ru src/mpn/alpha/sublsh1_n.asm src.patched/mpn/alpha/sublsh1_n.asm
     14--- src/mpn/alpha/sublsh1_n.asm 2010-12-31 08:26:10.000000000 +0100
     15+++ src.patched/mpn/alpha/sublsh1_n.asm 2012-04-07 14:27:57.048279798 +0200
     16@@ -54,7 +54,7 @@
     17 define(`ps', `r25')
     18 define(`sl', `r28')
     19 
     20-define(OPERATION_sublsh1_n,1)
     21+define(`OPERATION_sublsh1_n',1)
     22 
     23 ifdef(`OPERATION_addlsh1_n',`
     24   define(ADDSUB,       addq)
     25diff -ru src/mpn/ia64/add_n.asm src.patched/mpn/ia64/add_n.asm
     26--- src/mpn/ia64/add_n.asm      2010-12-31 08:21:21.000000000 +0100
     27+++ src.patched/mpn/ia64/add_n.asm      2012-04-07 14:27:57.628279922 +0200
     28@@ -33,7 +33,7 @@
     29 define(`vp',`r34')
     30 define(`n',`r35')
     31 
     32-define(OPERATION_add_n,1)
     33+define(`OPERATION_add_n',1)
     34 
     35 ifdef(`OPERATION_add_n',`
     36   define(ADDSUB,       add)
     37diff -ru src/mpn/ia64/addlsh1_n.asm src.patched/mpn/ia64/addlsh1_n.asm
     38--- src/mpn/ia64/addlsh1_n.asm  2010-12-31 08:25:53.000000000 +0100
     39+++ src.patched/mpn/ia64/addlsh1_n.asm  2012-04-07 14:27:57.668283269 +0200
     40@@ -32,7 +32,7 @@
     41 define(`vp',`r34')
     42 define(`n',`r35')
     43 
     44-define(OPERATION_addlsh1_n,1)
     45+define(`OPERATION_addlsh1_n',1)
     46 
     47 ifdef(`OPERATION_addlsh1_n',`
     48   define(ADDSUB,       add)
     49diff -ru src/mpn/ia64/and_n.asm src.patched/mpn/ia64/and_n.asm
     50--- src/mpn/ia64/and_n.asm      2010-12-31 08:11:37.000000000 +0100
     51+++ src.patched/mpn/ia64/and_n.asm      2012-04-07 14:27:57.678272121 +0200
     52@@ -34,7 +34,7 @@
     53 define(`vp', `r34')
     54 define(`n', `r35')
     55 
     56-define(OPERATION_and_n,1)
     57+define(`OPERATION_and_n',1)
     58 
     59 ifdef(`OPERATION_and_n',
     60 `      define(`func',`mpn_and_n')
     61diff -ru src/mpn/ia64/andn_n.asm src.patched/mpn/ia64/andn_n.asm
     62--- src/mpn/ia64/andn_n.asm     2010-12-31 08:11:10.000000000 +0100
     63+++ src.patched/mpn/ia64/andn_n.asm     2012-04-07 14:27:57.468269051 +0200
     64@@ -34,7 +34,7 @@
     65 define(`vp', `r34')
     66 define(`n', `r35')
     67 
     68-define(OPERATION_andn_n,1)
     69+define(`OPERATION_andn_n',1)
     70 
     71 ifdef(`OPERATION_and_n',
     72 `      define(`func',`mpn_and_n')
     73diff -ru src/mpn/ia64/ior_n.asm src.patched/mpn/ia64/ior_n.asm
     74--- src/mpn/ia64/ior_n.asm      2010-12-31 08:12:01.000000000 +0100
     75+++ src.patched/mpn/ia64/ior_n.asm      2012-04-07 14:27:57.448269684 +0200
     76@@ -34,7 +34,7 @@
     77 define(`vp', `r34')
     78 define(`n', `r35')
     79 
     80-define(OPERATION_ior_n,1)
     81+define(`OPERATION_ior_n',1)
     82 
     83 ifdef(`OPERATION_and_n',
     84 `      define(`func',`mpn_and_n')
     85diff -ru src/mpn/ia64/iorn_n.asm src.patched/mpn/ia64/iorn_n.asm
     86--- src/mpn/ia64/iorn_n.asm     2010-12-31 08:12:11.000000000 +0100
     87+++ src.patched/mpn/ia64/iorn_n.asm     2012-04-07 14:27:57.658279932 +0200
     88@@ -34,7 +34,7 @@
     89 define(`vp', `r34')
     90 define(`n', `r35')
     91 
     92-define(OPERATION_iorn_n,1)
     93+define(`OPERATION_iorn_n',1)
     94 
     95 ifdef(`OPERATION_and_n',
     96 `      define(`func',`mpn_and_n')
     97diff -ru src/mpn/ia64/lshift.asm src.patched/mpn/ia64/lshift.asm
     98--- src/mpn/ia64/lshift.asm     2010-12-31 08:26:45.000000000 +0100
     99+++ src.patched/mpn/ia64/lshift.asm     2012-04-07 14:27:57.618271813 +0200
     100@@ -39,7 +39,7 @@
     101 
     102 define(`tnc',`r9')
     103 
     104-define(OPERATION_lshift,1)
     105+define(`OPERATION_lshift',1)
     106 
     107 ifdef(`OPERATION_lshift',`
     108        define(`FSH',`shl')
     109diff -ru src/mpn/ia64/nand_n.asm src.patched/mpn/ia64/nand_n.asm
     110--- src/mpn/ia64/nand_n.asm     2010-12-31 08:11:26.000000000 +0100
     111+++ src.patched/mpn/ia64/nand_n.asm     2012-04-07 14:27:57.488270124 +0200
     112@@ -34,7 +34,7 @@
     113 define(`vp', `r34')
     114 define(`n', `r35')
     115 
     116-define(OPERATION_nand_n,1)
     117+define(`OPERATION_nand_n',1)
     118 
     119 ifdef(`OPERATION_and_n',
     120 `      define(`func',`mpn_and_n')
     121diff -ru src/mpn/ia64/nior_n.asm src.patched/mpn/ia64/nior_n.asm
     122--- src/mpn/ia64/nior_n.asm     2010-12-31 08:12:21.000000000 +0100
     123+++ src.patched/mpn/ia64/nior_n.asm     2012-04-07 14:27:57.548279945 +0200
     124@@ -34,7 +34,7 @@
     125 define(`vp', `r34')
     126 define(`n', `r35')
     127 
     128-define(OPERATION_nior_n,1)
     129+define(`OPERATION_nior_n',1)
     130 
     131 ifdef(`OPERATION_and_n',
     132 `      define(`func',`mpn_and_n')
     133diff -ru src/mpn/ia64/rsh1add_n.asm src.patched/mpn/ia64/rsh1add_n.asm
     134--- src/mpn/ia64/rsh1add_n.asm  2010-12-31 08:24:25.000000000 +0100
     135+++ src.patched/mpn/ia64/rsh1add_n.asm  2012-04-07 14:27:57.538280044 +0200
     136@@ -33,7 +33,7 @@
     137 define(`vp',`r34')
     138 define(`n',`r35')
     139 
     140-define(OPERATION_rsh1add_n,1)
     141+define(`OPERATION_rsh1add_n',1)
     142 
     143 ifdef(`OPERATION_rsh1add_n',`
     144   define(ADDSUB,       add)
     145diff -ru src/mpn/ia64/rsh1sub_n.asm src.patched/mpn/ia64/rsh1sub_n.asm
     146--- src/mpn/ia64/rsh1sub_n.asm  2010-12-31 08:24:36.000000000 +0100
     147+++ src.patched/mpn/ia64/rsh1sub_n.asm  2012-04-07 14:27:57.508269882 +0200
     148@@ -33,7 +33,7 @@
     149 define(`vp',`r34')
     150 define(`n',`r35')
     151 
     152-define(OPERATION_rsh1sub_n,1)
     153+define(`OPERATION_rsh1sub_n',1)
     154 
     155 ifdef(`OPERATION_rsh1add_n',`
     156   define(ADDSUB,       add)
     157diff -ru src/mpn/ia64/rshift.asm src.patched/mpn/ia64/rshift.asm
     158--- src/mpn/ia64/rshift.asm     2010-12-31 08:26:55.000000000 +0100
     159+++ src.patched/mpn/ia64/rshift.asm     2012-04-07 14:27:57.628279922 +0200
     160@@ -39,7 +39,7 @@
     161 
     162 define(`tnc',`r9')
     163 
     164-define(OPERATION_rshift,1)
     165+define(`OPERATION_rshift',1)
     166 
     167 ifdef(`OPERATION_lshift',`
     168        define(`FSH',`shl')
     169diff -ru src/mpn/ia64/sub_n.asm src.patched/mpn/ia64/sub_n.asm
     170--- src/mpn/ia64/sub_n.asm      2010-12-31 08:21:31.000000000 +0100
     171+++ src.patched/mpn/ia64/sub_n.asm      2012-04-07 14:27:57.518279963 +0200
     172@@ -33,7 +33,7 @@
     173 define(`vp',`r34')
     174 define(`n',`r35')
     175 
     176-define(OPERATION_sub_n,1)
     177+define(`OPERATION_sub_n',1)
     178 
     179 ifdef(`OPERATION_add_n',`
     180   define(ADDSUB,       add)
     181diff -ru src/mpn/ia64/sublsh1_n.asm src.patched/mpn/ia64/sublsh1_n.asm
     182--- src/mpn/ia64/sublsh1_n.asm  2010-12-31 08:25:40.000000000 +0100
     183+++ src.patched/mpn/ia64/sublsh1_n.asm  2012-04-07 14:27:57.638269756 +0200
     184@@ -32,7 +32,7 @@
     185 define(`vp',`r34')
     186 define(`n',`r35')
     187 
     188-define(OPERATION_sublsh1_n,1)
     189+define(`OPERATION_sublsh1_n',1)
     190 
     191 ifdef(`OPERATION_addlsh1_n',`
     192   define(ADDSUB,       add)
     193diff -ru src/mpn/ia64/xnor_n.asm src.patched/mpn/ia64/xnor_n.asm
     194--- src/mpn/ia64/xnor_n.asm     2010-12-31 08:12:45.000000000 +0100
     195+++ src.patched/mpn/ia64/xnor_n.asm     2012-04-07 14:27:57.608279181 +0200
     196@@ -34,7 +34,7 @@
     197 define(`vp', `r34')
     198 define(`n', `r35')
     199 
     200-define(OPERATION_xnor_n,1)
     201+define(`OPERATION_xnor_n',1)
     202 
     203 ifdef(`OPERATION_and_n',
     204 `      define(`func',`mpn_and_n')
     205diff -ru src/mpn/ia64/xor_n.asm src.patched/mpn/ia64/xor_n.asm
     206--- src/mpn/ia64/xor_n.asm      2010-12-31 08:12:33.000000000 +0100
     207+++ src.patched/mpn/ia64/xor_n.asm      2012-04-07 14:27:57.608279181 +0200
     208@@ -34,7 +34,7 @@
     209 define(`vp', `r34')
     210 define(`n', `r35')
     211 
     212-define(OPERATION_xor_n,1)
     213+define(`OPERATION_xor_n',1)
     214 
     215 ifdef(`OPERATION_and_n',
     216 `      define(`func',`mpn_and_n')
     217diff -ru src/mpn/m68k/add_n.asm src.patched/mpn/m68k/add_n.asm
     218--- src/mpn/m68k/add_n.asm      2010-12-31 08:23:57.000000000 +0100
     219+++ src.patched/mpn/m68k/add_n.asm      2012-04-07 14:27:53.028268643 +0200
     220@@ -25,7 +25,7 @@
     221 C         cycles/limb
     222 C 68040:      6
     223 
     224-define(OPERATION_add_n,1)
     225+define(`OPERATION_add_n',1)
     226 
     227 ifdef(`OPERATION_add_n',`
     228   define(M4_inst,       addxl)
     229diff -ru src/mpn/m68k/mc68020/addmul_1.asm src.patched/mpn/m68k/mc68020/addmul_1.asm
     230--- src/mpn/m68k/mc68020/addmul_1.asm   2010-12-30 08:34:14.000000000 +0100
     231+++ src.patched/mpn/m68k/mc68020/addmul_1.asm   2012-04-07 14:27:53.008279908 +0200
     232@@ -25,7 +25,7 @@
     233 C         cycles/limb
     234 C 68040:     25
     235 
     236-define(OPERATION_addmul_1,1)
     237+define(`OPERATION_addmul_1',1)
     238 
     239 ifdef(`OPERATION_addmul_1',`
     240   define(M4_inst,       addl)
     241diff -ru src/mpn/m68k/mc68020/submul_1.asm src.patched/mpn/m68k/mc68020/submul_1.asm
     242--- src/mpn/m68k/mc68020/submul_1.asm   2010-12-30 08:34:34.000000000 +0100
     243+++ src.patched/mpn/m68k/mc68020/submul_1.asm   2012-04-07 14:27:53.008279908 +0200
     244@@ -25,7 +25,7 @@
     245 C         cycles/limb
     246 C 68040:     25
     247 
     248-define(OPERATION_submul_1,1)
     249+define(`OPERATION_submul_1',1)
     250 
     251 ifdef(`OPERATION_addmul_1',`
     252   define(M4_inst,       addl)
     253diff -ru src/mpn/m68k/sub_n.asm src.patched/mpn/m68k/sub_n.asm
     254--- src/mpn/m68k/sub_n.asm      2010-12-31 08:24:06.000000000 +0100
     255+++ src.patched/mpn/m68k/sub_n.asm      2012-04-07 14:27:52.988268768 +0200
     256@@ -25,7 +25,7 @@
     257 C         cycles/limb
     258 C 68040:      6
     259 
     260-define(OPERATION_sub_n,1)
     261+define(`OPERATION_sub_n',1)
     262 
     263 ifdef(`OPERATION_add_n',`
     264   define(M4_inst,       addxl)
     265diff -ru src/mpn/powerpc32/vmx/and_n.asm src.patched/mpn/powerpc32/vmx/and_n.asm
     266--- src/mpn/powerpc32/vmx/and_n.asm     2010-12-31 08:16:01.000000000 +0100
     267+++ src.patched/mpn/powerpc32/vmx/and_n.asm     2012-04-07 14:27:52.968280448 +0200
     268@@ -56,7 +56,7 @@
     269 define(`vnegb', `')            C default neg-before to null
     270 define(`vnega', `')            C default neg-before to null
     271 
     272-define(OPERATION_and_n,1)
     273+define(`OPERATION_and_n',1)
     274 
     275 ifdef(`OPERATION_and_n',
     276 `      define(`func',  `mpn_and_n')
     277diff -ru src/mpn/powerpc32/vmx/andn_n.asm src.patched/mpn/powerpc32/vmx/andn_n.asm
     278--- src/mpn/powerpc32/vmx/andn_n.asm    2010-12-31 08:16:13.000000000 +0100
     279+++ src.patched/mpn/powerpc32/vmx/andn_n.asm    2012-04-07 14:27:52.918280512 +0200
     280@@ -56,7 +56,7 @@
     281 define(`vnegb', `')            C default neg-before to null
     282 define(`vnega', `')            C default neg-before to null
     283 
     284-define(OPERATION_andn_n,1)
     285+define(`OPERATION_andn_n',1)
     286 
     287 ifdef(`OPERATION_and_n',
     288 `      define(`func',  `mpn_and_n')
     289diff -ru src/mpn/powerpc32/vmx/ior_n.asm src.patched/mpn/powerpc32/vmx/ior_n.asm
     290--- src/mpn/powerpc32/vmx/ior_n.asm     2010-12-31 08:16:39.000000000 +0100
     291+++ src.patched/mpn/powerpc32/vmx/ior_n.asm     2012-04-07 14:27:52.918280512 +0200
     292@@ -56,7 +56,7 @@
     293 define(`vnegb', `')            C default neg-before to null
     294 define(`vnega', `')            C default neg-before to null
     295 
     296-define(OPERATION_ior_n,1)
     297+define(`OPERATION_ior_n',1)
     298 
     299 ifdef(`OPERATION_and_n',
     300 `      define(`func',  `mpn_and_n')
     301diff -ru src/mpn/powerpc32/vmx/iorn_n.asm src.patched/mpn/powerpc32/vmx/iorn_n.asm
     302--- src/mpn/powerpc32/vmx/iorn_n.asm    2010-12-31 08:16:51.000000000 +0100
     303+++ src.patched/mpn/powerpc32/vmx/iorn_n.asm    2012-04-07 14:27:52.968280448 +0200
     304@@ -56,7 +56,7 @@
     305 define(`vnegb', `')            C default neg-before to null
     306 define(`vnega', `')            C default neg-before to null
     307 
     308-define(OPERATION_iorn_n,1)
     309+define(`OPERATION_iorn_n',1)
     310 
     311 ifdef(`OPERATION_and_n',
     312 `      define(`func',  `mpn_and_n')
     313diff -ru src/mpn/powerpc32/vmx/nand_n.asm src.patched/mpn/powerpc32/vmx/nand_n.asm
     314--- src/mpn/powerpc32/vmx/nand_n.asm    2010-12-31 08:16:26.000000000 +0100
     315+++ src.patched/mpn/powerpc32/vmx/nand_n.asm    2012-04-07 14:27:52.928276559 +0200
     316@@ -56,7 +56,7 @@
     317 define(`vnegb', `')            C default neg-before to null
     318 define(`vnega', `')            C default neg-before to null
     319 
     320-define(OPERATION_nand_n,1)
     321+define(`OPERATION_nand_n',1)
     322 
     323 ifdef(`OPERATION_and_n',
     324 `      define(`func',  `mpn_and_n')
     325diff -ru src/mpn/powerpc32/vmx/nior_n.asm src.patched/mpn/powerpc32/vmx/nior_n.asm
     326--- src/mpn/powerpc32/vmx/nior_n.asm    2010-12-31 08:17:04.000000000 +0100
     327+++ src.patched/mpn/powerpc32/vmx/nior_n.asm    2012-04-07 14:27:52.938268875 +0200
     328@@ -56,7 +56,7 @@
     329 define(`vnegb', `')            C default neg-before to null
     330 define(`vnega', `')            C default neg-before to null
     331 
     332-define(OPERATION_nior_n,1)
     333+define(`OPERATION_nior_n',1)
     334 
     335 ifdef(`OPERATION_and_n',
     336 `      define(`func',  `mpn_and_n')
     337diff -ru src/mpn/powerpc32/vmx/xnor_n.asm src.patched/mpn/powerpc32/vmx/xnor_n.asm
     338--- src/mpn/powerpc32/vmx/xnor_n.asm    2010-12-31 08:17:31.000000000 +0100
     339+++ src.patched/mpn/powerpc32/vmx/xnor_n.asm    2012-04-07 14:27:52.958279999 +0200
     340@@ -56,7 +56,7 @@
     341 define(`vnegb', `')            C default neg-before to null
     342 define(`vnega', `')            C default neg-before to null
     343 
     344-define(OPERATION_xnor_n,1)
     345+define(`OPERATION_xnor_n',1)
     346 
     347 ifdef(`OPERATION_and_n',
     348 `      define(`func',  `mpn_and_n')
     349diff -ru src/mpn/powerpc32/vmx/xor_n.asm src.patched/mpn/powerpc32/vmx/xor_n.asm
     350--- src/mpn/powerpc32/vmx/xor_n.asm     2010-12-31 08:17:18.000000000 +0100
     351+++ src.patched/mpn/powerpc32/vmx/xor_n.asm     2012-04-07 14:27:52.958279999 +0200
     352@@ -56,7 +56,7 @@
     353 define(`vnegb', `')            C default neg-before to null
     354 define(`vnega', `')            C default neg-before to null
     355 
     356-define(OPERATION_xor_n,1)
     357+define(`OPERATION_xor_n',1)
     358 
     359 ifdef(`OPERATION_and_n',
     360 `      define(`func',  `mpn_and_n')
     361diff -ru src/mpn/x86/add_n.asm src.patched/mpn/x86/add_n.asm
     362--- src/mpn/x86/add_n.asm       2010-12-31 08:30:17.000000000 +0100
     363+++ src.patched/mpn/x86/add_n.asm       2012-04-07 14:27:56.118269524 +0200
     364@@ -30,7 +30,7 @@
     365 C K7:   2.25
     366 C P4:   8.75
     367 
     368-define(OPERATION_add_n,1)
     369+define(`OPERATION_add_n',1)
     370 
     371 ifdef(`OPERATION_add_n',`
     372        define(M4_inst,        adcl)
     373diff -ru src/mpn/x86/addmul_1.asm src.patched/mpn/x86/addmul_1.asm
     374--- src/mpn/x86/addmul_1.asm    2010-12-31 08:21:58.000000000 +0100
     375+++ src.patched/mpn/x86/addmul_1.asm    2012-04-07 14:27:55.848269439 +0200
     376@@ -38,7 +38,7 @@
     377 C K7:                            5.25
     378 C K8:
     379 
     380-define(OPERATION_addmul_1,1)
     381+define(`OPERATION_addmul_1',1)
     382 
     383 ifdef(`OPERATION_addmul_1',`
     384       define(M4_inst,        addl)
     385diff -ru src/mpn/x86/applenopic/addmul_1.asm src.patched/mpn/x86/applenopic/addmul_1.asm
     386--- src/mpn/x86/applenopic/addmul_1.asm 2010-12-31 08:22:55.000000000 +0100
     387+++ src.patched/mpn/x86/applenopic/addmul_1.asm 2012-04-07 14:27:56.058280957 +0200
     388@@ -38,7 +38,7 @@
     389 C K7:                            5.25
     390 C K8:
     391 
     392-define(OPERATION_addmul_1,1)
     393+define(`OPERATION_addmul_1',1)
     394 
     395 ifdef(`OPERATION_addmul_1',`
     396       define(M4_inst,        addl)
     397diff -ru src/mpn/x86/applenopic/submul_1.asm src.patched/mpn/x86/applenopic/submul_1.asm
     398--- src/mpn/x86/applenopic/submul_1.asm 2010-12-31 08:23:06.000000000 +0100
     399+++ src.patched/mpn/x86/applenopic/submul_1.asm 2012-04-07 14:27:56.028279791 +0200
     400@@ -38,7 +38,7 @@
     401 C K7:                            5.25
     402 C K8:
     403 
     404-define(OPERATION_submul_1,1)
     405+define(`OPERATION_submul_1',1)
     406 
     407 ifdef(`OPERATION_addmul_1',`
     408       define(M4_inst,        addl)
     409diff -ru src/mpn/x86/core2/add_n.asm src.patched/mpn/x86/core2/add_n.asm
     410--- src/mpn/x86/core2/add_n.asm 2010-12-31 08:30:57.000000000 +0100
     411+++ src.patched/mpn/x86/core2/add_n.asm 2012-04-07 14:27:55.428291699 +0200
     412@@ -35,7 +35,7 @@
     413 
     414 deflit(UNROLL_COUNT, 16)
     415 
     416-define(OPERATION_add_n,1)
     417+define(`OPERATION_add_n',1)
     418 
     419 ifdef(`OPERATION_add_n', `
     420        define(M4_inst,        adcl)
     421diff -ru src/mpn/x86/core2/sub_n.asm src.patched/mpn/x86/core2/sub_n.asm
     422--- src/mpn/x86/core2/sub_n.asm 2010-12-31 08:31:08.000000000 +0100
     423+++ src.patched/mpn/x86/core2/sub_n.asm 2012-04-07 14:27:55.368279962 +0200
     424@@ -35,7 +35,7 @@
     425 
     426 deflit(UNROLL_COUNT, 16)
     427 
     428-define(OPERATION_sub_n,1)
     429+define(`OPERATION_sub_n',1)
     430 
     431 ifdef(`OPERATION_add_n', `
     432        define(M4_inst,        adcl)
     433diff -ru src/mpn/x86/k6/add_n.asm src.patched/mpn/x86/k6/add_n.asm
     434--- src/mpn/x86/k6/add_n.asm    2010-12-31 08:29:14.000000000 +0100
     435+++ src.patched/mpn/x86/k6/add_n.asm    2012-04-07 14:27:55.778269241 +0200
     436@@ -24,7 +24,7 @@
     437 
     438 C K6: normal 3.25 cycles/limb, in-place 2.75 cycles/limb.
     439 
     440-define(OPERATION_add_n,1)
     441+define(`OPERATION_add_n',1)
     442 
     443 ifdef(`OPERATION_add_n', `
     444        define(M4_inst,        adcl)
     445diff -ru src/mpn/x86/k6/addmul_1.asm src.patched/mpn/x86/k6/addmul_1.asm
     446--- src/mpn/x86/k6/addmul_1.asm 2010-12-31 08:29:47.000000000 +0100
     447+++ src.patched/mpn/x86/k6/addmul_1.asm 2012-04-07 14:27:55.628279965 +0200
     448@@ -52,7 +52,7 @@
     449 
     450 deflit(UNROLL_COUNT, 16)
     451 
     452-define(OPERATION_addmul_1,1)
     453+define(`OPERATION_addmul_1',1)
     454 
     455 ifdef(`OPERATION_addmul_1', `
     456        define(M4_inst,        addl)
     457diff -ru src/mpn/x86/k6/mmx/and_n.asm src.patched/mpn/x86/k6/mmx/and_n.asm
     458--- src/mpn/x86/k6/mmx/and_n.asm        2010-12-31 08:13:39.000000000 +0100
     459+++ src.patched/mpn/x86/k6/mmx/and_n.asm        2012-04-07 14:27:55.758280292 +0200
     460@@ -41,7 +41,7 @@
     461 dnl  M4_*_neg_dst means whether to negate the final result before writing
     462 dnl  M4_*_neg_src2 means whether to negate the src2 values before using them
     463 
     464-define(OPERATION_and_n,1)
     465+define(`OPERATION_and_n',1)
     466 
     467 define(M4_choose_op,
     468 m4_assert_numargs(7)
     469diff -ru src/mpn/x86/k6/mmx/andn_n.asm src.patched/mpn/x86/k6/mmx/andn_n.asm
     470--- src/mpn/x86/k6/mmx/andn_n.asm       2010-12-31 08:13:53.000000000 +0100
     471+++ src.patched/mpn/x86/k6/mmx/andn_n.asm       2012-04-07 14:27:55.668280102 +0200
     472@@ -41,7 +41,7 @@
     473 dnl  M4_*_neg_dst means whether to negate the final result before writing
     474 dnl  M4_*_neg_src2 means whether to negate the src2 values before using them
     475 
     476-define(OPERATION_andn_n,1)
     477+define(`OPERATION_andn_n',1)
     478 
     479 define(M4_choose_op,
     480 m4_assert_numargs(7)
     481diff -ru src/mpn/x86/k6/mmx/hamdist.asm src.patched/mpn/x86/k6/mmx/hamdist.asm
     482--- src/mpn/x86/k6/mmx/hamdist.asm      2010-12-31 08:19:05.000000000 +0100
     483+++ src.patched/mpn/x86/k6/mmx/hamdist.asm      2012-04-07 14:27:55.698278894 +0200
     484@@ -34,7 +34,7 @@
     485 C The code here isn't optimal, but it's already a 2x speedup over the plain
     486 C integer mpn/generic/popcount.c,hamdist.c.
     487 
     488-define(OPERATION_hamdist,1)
     489+define(`OPERATION_hamdist',1)
     490 
     491 ifdef(`OPERATION_popcount',,
     492 `ifdef(`OPERATION_hamdist',,
     493diff -ru src/mpn/x86/k6/mmx/ior_n.asm src.patched/mpn/x86/k6/mmx/ior_n.asm
     494--- src/mpn/x86/k6/mmx/ior_n.asm        2010-12-31 08:14:20.000000000 +0100
     495+++ src.patched/mpn/x86/k6/mmx/ior_n.asm        2012-04-07 14:27:55.668280102 +0200
     496@@ -41,7 +41,7 @@
     497 dnl  M4_*_neg_dst means whether to negate the final result before writing
     498 dnl  M4_*_neg_src2 means whether to negate the src2 values before using them
     499 
     500-define(OPERATION_ior_n,1)
     501+define(`OPERATION_ior_n',1)
     502 
     503 define(M4_choose_op,
     504 m4_assert_numargs(7)
     505diff -ru src/mpn/x86/k6/mmx/iorn_n.asm src.patched/mpn/x86/k6/mmx/iorn_n.asm
     506--- src/mpn/x86/k6/mmx/iorn_n.asm       2010-12-31 08:14:32.000000000 +0100
     507+++ src.patched/mpn/x86/k6/mmx/iorn_n.asm       2012-04-07 14:27:55.748280101 +0200
     508@@ -41,7 +41,7 @@
     509 dnl  M4_*_neg_dst means whether to negate the final result before writing
     510 dnl  M4_*_neg_src2 means whether to negate the src2 values before using them
     511 
     512-define(OPERATION_iorn_n,1)
     513+define(`OPERATION_iorn_n',1)
     514 
     515 define(M4_choose_op,
     516 m4_assert_numargs(7)
     517diff -ru src/mpn/x86/k6/mmx/nand_n.asm src.patched/mpn/x86/k6/mmx/nand_n.asm
     518--- src/mpn/x86/k6/mmx/nand_n.asm       2010-12-31 08:14:07.000000000 +0100
     519+++ src.patched/mpn/x86/k6/mmx/nand_n.asm       2012-04-07 14:27:55.678270024 +0200
     520@@ -41,7 +41,7 @@
     521 dnl  M4_*_neg_dst means whether to negate the final result before writing
     522 dnl  M4_*_neg_src2 means whether to negate the src2 values before using them
     523 
     524-define(OPERATION_nand_n,1)
     525+define(`OPERATION_nand_n',1)
     526 
     527 define(M4_choose_op,
     528 m4_assert_numargs(7)
     529diff -ru src/mpn/x86/k6/mmx/nior_n.asm src.patched/mpn/x86/k6/mmx/nior_n.asm
     530--- src/mpn/x86/k6/mmx/nior_n.asm       2010-12-31 08:14:43.000000000 +0100
     531+++ src.patched/mpn/x86/k6/mmx/nior_n.asm       2012-04-07 14:27:55.708275203 +0200
     532@@ -41,7 +41,7 @@
     533 dnl  M4_*_neg_dst means whether to negate the final result before writing
     534 dnl  M4_*_neg_src2 means whether to negate the src2 values before using them
     535 
     536-define(OPERATION_nior_n,1)
     537+define(`OPERATION_nior_n',1)
     538 
     539 define(M4_choose_op,
     540 m4_assert_numargs(7)
     541diff -ru src/mpn/x86/k6/mmx/popcount.asm src.patched/mpn/x86/k6/mmx/popcount.asm
     542--- src/mpn/x86/k6/mmx/popcount.asm     2010-12-31 08:18:54.000000000 +0100
     543+++ src.patched/mpn/x86/k6/mmx/popcount.asm     2012-04-07 14:27:55.688279899 +0200
     544@@ -34,7 +34,7 @@
     545 C The code here isn't optimal, but it's already a 2x speedup over the plain
     546 C integer mpn/generic/popcount.c,hamdist.c.
     547 
     548-define(OPERATION_popcount,1)
     549+define(`OPERATION_popcount',1)
     550 
     551 ifdef(`OPERATION_popcount',,
     552 `ifdef(`OPERATION_hamdist',,
     553diff -ru src/mpn/x86/k6/mmx/xnor_n.asm src.patched/mpn/x86/k6/mmx/xnor_n.asm
     554--- src/mpn/x86/k6/mmx/xnor_n.asm       2010-12-31 08:15:05.000000000 +0100
     555+++ src.patched/mpn/x86/k6/mmx/xnor_n.asm       2012-04-07 14:27:55.718279824 +0200
     556@@ -41,7 +41,7 @@
     557 dnl  M4_*_neg_dst means whether to negate the final result before writing
     558 dnl  M4_*_neg_src2 means whether to negate the src2 values before using them
     559 
     560-define(OPERATION_xnor_n,1)
     561+define(`OPERATION_xnor_n',1)
     562 
     563 define(M4_choose_op,
     564 m4_assert_numargs(7)
     565diff -ru src/mpn/x86/k6/mmx/xor_n.asm src.patched/mpn/x86/k6/mmx/xor_n.asm
     566--- src/mpn/x86/k6/mmx/xor_n.asm        2010-12-31 08:14:55.000000000 +0100
     567+++ src.patched/mpn/x86/k6/mmx/xor_n.asm        2012-04-07 14:27:55.728269986 +0200
     568@@ -41,7 +41,7 @@
     569 dnl  M4_*_neg_dst means whether to negate the final result before writing
     570 dnl  M4_*_neg_src2 means whether to negate the src2 values before using them
     571 
     572-define(OPERATION_xor_n,1)
     573+define(`OPERATION_xor_n',1)
     574 
     575 define(M4_choose_op,
     576 m4_assert_numargs(7)
     577diff -ru src/mpn/x86/k6/sub_n.asm src.patched/mpn/x86/k6/sub_n.asm
     578--- src/mpn/x86/k6/sub_n.asm    2010-12-31 08:29:24.000000000 +0100
     579+++ src.patched/mpn/x86/k6/sub_n.asm    2012-04-07 14:27:55.598269852 +0200
     580@@ -24,7 +24,7 @@
     581 
     582 C K6: normal 3.25 cycles/limb, in-place 2.75 cycles/limb.
     583 
     584-define(OPERATION_sub_n,1)
     585+define(`OPERATION_sub_n',1)
     586 
     587 ifdef(`OPERATION_add_n', `
     588        define(M4_inst,        adcl)
     589diff -ru src/mpn/x86/k6/submul_1.asm src.patched/mpn/x86/k6/submul_1.asm
     590--- src/mpn/x86/k6/submul_1.asm 2010-12-31 08:29:58.000000000 +0100
     591+++ src.patched/mpn/x86/k6/submul_1.asm 2012-04-07 14:27:55.608280112 +0200
     592@@ -52,7 +52,7 @@
     593 
     594 deflit(UNROLL_COUNT, 16)
     595 
     596-define(OPERATION_submul_1,1)
     597+define(`OPERATION_submul_1',1)
     598 
     599 ifdef(`OPERATION_addmul_1', `
     600        define(M4_inst,        addl)
     601diff -ru src/mpn/x86/k7/add_n.asm src.patched/mpn/x86/k7/add_n.asm
     602--- src/mpn/x86/k7/add_n.asm    2010-12-31 08:27:25.000000000 +0100
     603+++ src.patched/mpn/x86/k7/add_n.asm    2012-04-07 14:27:56.808269459 +0200
     604@@ -35,7 +35,7 @@
     605 
     606 deflit(UNROLL_COUNT, 16)
     607 
     608-define(OPERATION_add_n,1)
     609+define(`OPERATION_add_n',1)
     610 
     611 ifdef(`OPERATION_add_n', `
     612        define(M4_inst,        adcl)
     613diff -ru src/mpn/x86/k7/addmul_1.asm src.patched/mpn/x86/k7/addmul_1.asm
     614--- src/mpn/x86/k7/addmul_1.asm 2010-12-31 08:28:08.000000000 +0100
     615+++ src.patched/mpn/x86/k7/addmul_1.asm 2012-04-07 14:27:56.698279971 +0200
     616@@ -47,7 +47,7 @@
     617 
     618 deflit(UNROLL_COUNT, 16)
     619 
     620-define(OPERATION_addmul_1,1)
     621+define(`OPERATION_addmul_1',1)
     622 
     623 ifdef(`OPERATION_addmul_1',`
     624        define(M4_inst,        addl)
     625diff -ru src/mpn/x86/k7/mmx/hamdist.asm src.patched/mpn/x86/k7/mmx/hamdist.asm
     626--- src/mpn/x86/k7/mmx/hamdist.asm      2010-12-31 08:20:40.000000000 +0100
     627+++ src.patched/mpn/x86/k7/mmx/hamdist.asm      2012-04-07 14:27:56.728280013 +0200
     628@@ -38,7 +38,7 @@
     629 C MMX instructions" in the Athlon Optimization Guide, AMD document 22007,
     630 C page 158 of rev E (reference in mpn/x86/k7/README).
     631 
     632-define(OPERATION_hamdist,1)
     633+define(`OPERATION_hamdist',1)
     634 
     635 ifdef(`OPERATION_popcount',,
     636 `ifdef(`OPERATION_hamdist',,
     637diff -ru src/mpn/x86/k7/mmx/popcount.asm src.patched/mpn/x86/k7/mmx/popcount.asm
     638--- src/mpn/x86/k7/mmx/popcount.asm     2010-12-31 08:20:30.000000000 +0100
     639+++ src.patched/mpn/x86/k7/mmx/popcount.asm     2012-04-07 14:27:56.728280013 +0200
     640@@ -38,7 +38,7 @@
     641 C MMX instructions" in the Athlon Optimization Guide, AMD document 22007,
     642 C page 158 of rev E (reference in mpn/x86/k7/README).
     643 
     644-define(OPERATION_popcount,1)
     645+define(`OPERATION_popcount',1)
     646 
     647 ifdef(`OPERATION_popcount',,
     648 `ifdef(`OPERATION_hamdist',,
     649diff -ru src/mpn/x86/k7/sub_n.asm src.patched/mpn/x86/k7/sub_n.asm
     650--- src/mpn/x86/k7/sub_n.asm    2010-12-31 08:27:37.000000000 +0100
     651+++ src.patched/mpn/x86/k7/sub_n.asm    2012-04-07 14:27:56.668269259 +0200
     652@@ -35,7 +35,7 @@
     653 
     654 deflit(UNROLL_COUNT, 16)
     655 
     656-define(OPERATION_sub_n,1)
     657+define(`OPERATION_sub_n',1)
     658 
     659 ifdef(`OPERATION_add_n', `
     660        define(M4_inst,        adcl)
     661diff -ru src/mpn/x86/k7/submul_1.asm src.patched/mpn/x86/k7/submul_1.asm
     662--- src/mpn/x86/k7/submul_1.asm 2010-12-31 08:28:18.000000000 +0100
     663+++ src.patched/mpn/x86/k7/submul_1.asm 2012-04-07 14:27:56.678279889 +0200
     664@@ -47,7 +47,7 @@
     665 
     666 deflit(UNROLL_COUNT, 16)
     667 
     668-define(OPERATION_submul_1,1)
     669+define(`OPERATION_submul_1',1)
     670 
     671 ifdef(`OPERATION_addmul_1',`
     672        define(M4_inst,        addl)
     673diff -ru src/mpn/x86/nehalem/hamdist.asm src.patched/mpn/x86/nehalem/hamdist.asm
     674--- src/mpn/x86/nehalem/hamdist.asm     2010-12-31 08:20:07.000000000 +0100
     675+++ src.patched/mpn/x86/nehalem/hamdist.asm     2012-04-07 14:27:55.478269000 +0200
     676@@ -38,7 +38,7 @@
     677 C might be possible, but 8.5 c/l relying on out-of-order execution is
     678 C already quite reasonable.
     679 
     680-define(OPERATION_hamdist,1)
     681+define(`OPERATION_hamdist',1)
     682 
     683 ifdef(`OPERATION_popcount',,
     684 `ifdef(`OPERATION_hamdist',,
     685diff -ru src/mpn/x86/nehalem/popcount.asm src.patched/mpn/x86/nehalem/popcount.asm
     686--- src/mpn/x86/nehalem/popcount.asm    2010-12-31 08:19:57.000000000 +0100
     687+++ src.patched/mpn/x86/nehalem/popcount.asm    2012-04-07 14:27:55.468288235 +0200
     688@@ -38,7 +38,7 @@
     689 C might be possible, but 8.5 c/l relying on out-of-order execution is
     690 C already quite reasonable.
     691 
     692-define(OPERATION_popcount,1)
     693+define(`OPERATION_popcount',1)
     694 
     695 ifdef(`OPERATION_popcount',,
     696 `ifdef(`OPERATION_hamdist',,
     697diff -ru src/mpn/x86/pentium/add_n.asm src.patched/mpn/x86/pentium/add_n.asm
     698--- src/mpn/x86/pentium/add_n.asm       2010-12-31 08:32:53.000000000 +0100
     699+++ src.patched/mpn/x86/pentium/add_n.asm       2012-04-07 14:27:56.318273599 +0200
     700@@ -25,7 +25,7 @@
     701 
     702 C P5: 2.375 cycles/limb
     703 
     704-define(OPERATION_add_n,1)
     705+define(`OPERATION_add_n',1)
     706 
     707 ifdef(`OPERATION_add_n',`
     708        define(M4_inst,        adcl)
     709diff -ru src/mpn/x86/pentium/addmul_1.asm src.patched/mpn/x86/pentium/addmul_1.asm
     710--- src/mpn/x86/pentium/addmul_1.asm    2010-12-31 08:33:16.000000000 +0100
     711+++ src.patched/mpn/x86/pentium/addmul_1.asm    2012-04-07 14:27:56.238269339 +0200
     712@@ -25,7 +25,7 @@
     713 
     714 C P5: 14.0 cycles/limb
     715 
     716-define(OPERATION_addmul_1,1)
     717+define(`OPERATION_addmul_1',1)
     718 
     719 ifdef(`OPERATION_addmul_1', `
     720       define(M4_inst,        addl)
     721diff -ru src/mpn/x86/pentium/and_n.asm src.patched/mpn/x86/pentium/and_n.asm
     722--- src/mpn/x86/pentium/and_n.asm       2010-12-31 07:06:04.000000000 +0100
     723+++ src.patched/mpn/x86/pentium/and_n.asm       2012-04-07 14:27:56.348273028 +0200
     724@@ -25,7 +25,7 @@
     725 C P5: 3.0 c/l  and, ior, xor
     726 C     3.5 c/l  andn, iorn, nand, nior, xnor
     727 
     728-define(OPERATION_and_n,1)
     729+define(`OPERATION_and_n',1)
     730 
     731 define(M4_choose_op,
     732 `ifdef(`OPERATION_$1',`
     733diff -ru src/mpn/x86/pentium/andn_n.asm src.patched/mpn/x86/pentium/andn_n.asm
     734--- src/mpn/x86/pentium/andn_n.asm      2010-12-31 07:08:32.000000000 +0100
     735+++ src.patched/mpn/x86/pentium/andn_n.asm      2012-04-07 14:27:56.148279866 +0200
     736@@ -25,7 +25,7 @@
     737 C P5: 3.0 c/l  and, ior, xor
     738 C     3.5 c/l  andn, iorn, nand, nior, xnor
     739 
     740-define(OPERATION_andn_n,1)
     741+define(`OPERATION_andn_n',1)
     742 
     743 define(M4_choose_op,
     744 `ifdef(`OPERATION_$1',`
     745diff -ru src/mpn/x86/pentium/ior_n.asm src.patched/mpn/x86/pentium/ior_n.asm
     746--- src/mpn/x86/pentium/ior_n.asm       2010-12-31 07:00:34.000000000 +0100
     747+++ src.patched/mpn/x86/pentium/ior_n.asm       2012-04-07 14:27:56.128280857 +0200
     748@@ -25,7 +25,7 @@
     749 C P5: 3.0 c/l  and, ior, xor
     750 C     3.5 c/l  andn, iorn, nand, nior, xnor
     751 
     752-define(OPERATION_ior_n,1)
     753+define(`OPERATION_ior_n',1)
     754 
     755 define(M4_choose_op,
     756 `ifdef(`OPERATION_$1',`
     757diff -ru src/mpn/x86/pentium/iorn_n.asm src.patched/mpn/x86/pentium/iorn_n.asm
     758--- src/mpn/x86/pentium/iorn_n.asm      2010-12-31 07:01:04.000000000 +0100
     759+++ src.patched/mpn/x86/pentium/iorn_n.asm      2012-04-07 14:27:56.338280957 +0200
     760@@ -25,7 +25,7 @@
     761 C P5: 3.0 c/l  and, ior, xor
     762 C     3.5 c/l  andn, iorn, nand, nior, xnor
     763 
     764-define(OPERATION_iorn_n,1)
     765+define(`OPERATION_iorn_n',1)
     766 
     767 define(M4_choose_op,
     768 `ifdef(`OPERATION_$1',`
     769diff -ru src/mpn/x86/pentium/nand_n.asm src.patched/mpn/x86/pentium/nand_n.asm
     770--- src/mpn/x86/pentium/nand_n.asm      2010-12-31 07:08:55.000000000 +0100
     771+++ src.patched/mpn/x86/pentium/nand_n.asm      2012-04-07 14:27:56.158270225 +0200
     772@@ -25,7 +25,7 @@
     773 C P5: 3.0 c/l  and, ior, xor
     774 C     3.5 c/l  andn, iorn, nand, nior, xnor
     775 
     776-define(OPERATION_nand_n,1)
     777+define(`OPERATION_nand_n',1)
     778 
     779 define(M4_choose_op,
     780 `ifdef(`OPERATION_$1',`
     781diff -ru src/mpn/x86/pentium/nior_n.asm src.patched/mpn/x86/pentium/nior_n.asm
     782--- src/mpn/x86/pentium/nior_n.asm      2010-12-31 07:01:31.000000000 +0100
     783+++ src.patched/mpn/x86/pentium/nior_n.asm      2012-04-07 14:27:56.188269997 +0200
     784@@ -25,7 +25,7 @@
     785 C P5: 3.0 c/l  and, ior, xor
     786 C     3.5 c/l  andn, iorn, nand, nior, xnor
     787 
     788-define(OPERATION_nior_n,1)
     789+define(`OPERATION_nior_n',1)
     790 
     791 define(M4_choose_op,
     792 `ifdef(`OPERATION_$1',`
     793diff -ru src/mpn/x86/pentium/sub_n.asm src.patched/mpn/x86/pentium/sub_n.asm
     794--- src/mpn/x86/pentium/sub_n.asm       2010-12-31 08:33:04.000000000 +0100
     795+++ src.patched/mpn/x86/pentium/sub_n.asm       2012-04-07 14:27:56.178269643 +0200
     796@@ -25,7 +25,7 @@
     797 
     798 C P5: 2.375 cycles/limb
     799 
     800-define(OPERATION_sub_n,1)
     801+define(`OPERATION_sub_n',1)
     802 
     803 ifdef(`OPERATION_add_n',`
     804        define(M4_inst,        adcl)
     805diff -ru src/mpn/x86/pentium/submul_1.asm src.patched/mpn/x86/pentium/submul_1.asm
     806--- src/mpn/x86/pentium/submul_1.asm    2010-12-31 08:33:30.000000000 +0100
     807+++ src.patched/mpn/x86/pentium/submul_1.asm    2012-04-07 14:27:56.198268327 +0200
     808@@ -25,7 +25,7 @@
     809 
     810 C P5: 14.0 cycles/limb
     811 
     812-define(OPERATION_submul_1,1)
     813+define(`OPERATION_submul_1',1)
     814 
     815 ifdef(`OPERATION_addmul_1', `
     816       define(M4_inst,        addl)
     817diff -ru src/mpn/x86/pentium/xnor_n.asm src.patched/mpn/x86/pentium/xnor_n.asm
     818--- src/mpn/x86/pentium/xnor_n.asm      2010-12-31 07:09:38.000000000 +0100
     819+++ src.patched/mpn/x86/pentium/xnor_n.asm      2012-04-07 14:27:56.258279761 +0200
     820@@ -25,7 +25,7 @@
     821 C P5: 3.0 c/l  and, ior, xor
     822 C     3.5 c/l  andn, iorn, nand, nior, xnor
     823 
     824-define(OPERATION_xnor_n,1)
     825+define(`OPERATION_xnor_n',1)
     826 
     827 define(M4_choose_op,
     828 `ifdef(`OPERATION_$1',`
     829diff -ru src/mpn/x86/pentium/xor_n.asm src.patched/mpn/x86/pentium/xor_n.asm
     830--- src/mpn/x86/pentium/xor_n.asm       2010-12-31 07:09:16.000000000 +0100
     831+++ src.patched/mpn/x86/pentium/xor_n.asm       2012-04-07 14:27:56.268279961 +0200
     832@@ -25,7 +25,7 @@
     833 C P5: 3.0 c/l  and, ior, xor
     834 C     3.5 c/l  andn, iorn, nand, nior, xnor
     835 
     836-define(OPERATION_xor_n,1)
     837+define(`OPERATION_xor_n',1)
     838 
     839 define(M4_choose_op,
     840 `ifdef(`OPERATION_$1',`
     841diff -ru src/mpn/x86/pentium4/mmx/hamdist.asm src.patched/mpn/x86/pentium4/mmx/hamdist.asm
     842--- src/mpn/x86/pentium4/mmx/hamdist.asm        2010-12-31 08:19:38.000000000 +0100
     843+++ src.patched/mpn/x86/pentium4/mmx/hamdist.asm        2012-04-07 14:27:56.508279960 +0200
     844@@ -38,7 +38,7 @@
     845 C might be possible, but 8.5 c/l relying on out-of-order execution is
     846 C already quite reasonable.
     847 
     848-define(OPERATION_hamdist,1)
     849+define(`OPERATION_hamdist',1)
     850 
     851 ifdef(`OPERATION_popcount',,
     852 `ifdef(`OPERATION_hamdist',,
     853diff -ru src/mpn/x86/pentium4/mmx/popcount.asm src.patched/mpn/x86/pentium4/mmx/popcount.asm
     854--- src/mpn/x86/pentium4/mmx/popcount.asm       2010-12-31 08:19:29.000000000 +0100
     855+++ src.patched/mpn/x86/pentium4/mmx/popcount.asm       2012-04-07 14:27:56.498279890 +0200
     856@@ -38,7 +38,7 @@
     857 C might be possible, but 8.5 c/l relying on out-of-order execution is
     858 C already quite reasonable.
     859 
     860-define(OPERATION_popcount,1)
     861+define(`OPERATION_popcount',1)
     862 
     863 ifdef(`OPERATION_popcount',,
     864 `ifdef(`OPERATION_hamdist',,
     865diff -ru src/mpn/x86/sub_n.asm src.patched/mpn/x86/sub_n.asm
     866--- src/mpn/x86/sub_n.asm       2010-12-31 08:30:28.000000000 +0100
     867+++ src.patched/mpn/x86/sub_n.asm       2012-04-07 14:27:55.438279940 +0200
     868@@ -30,7 +30,7 @@
     869 C K7:   2.25
     870 C P4:   8.75
     871 
     872-define(OPERATION_sub_n,1)
     873+define(`OPERATION_sub_n',1)
     874 
     875 ifdef(`OPERATION_add_n',`
     876        define(M4_inst,        adcl)
     877diff -ru src/mpn/x86/submul_1.asm src.patched/mpn/x86/submul_1.asm
     878--- src/mpn/x86/submul_1.asm    2010-12-31 08:21:49.000000000 +0100
     879+++ src.patched/mpn/x86/submul_1.asm    2012-04-07 14:27:55.808285202 +0200
     880@@ -38,7 +38,7 @@
     881 C K7:                            5.25
     882 C K8:
     883 
     884-define(OPERATION_submul_1,1)
     885+define(`OPERATION_submul_1',1)
     886 
     887 ifdef(`OPERATION_addmul_1',`
     888       define(M4_inst,        addl)
  • spkg-install

    diff --git a/spkg-install b/spkg-install
    a b  
    11#!/usr/bin/env bash
    22
    3 ###############################################################################
    4 # IMPORTANT: WHEN EDITING THIS FILE, MAKE SURE YOUR EDITOR DOES NOT REPLACE
    5 #            TABS BY SPACES.
    6 ###############################################################################
    7 
    83if [ -z "$SAGE_LOCAL" ]; then
    94    echo >&2 "Error: SAGE_LOCAL undefined - exiting..."
    105    echo >&2 "Maybe run 'sage -sh'?"
     
    1914# Apply patches (if any):
    2015###############################################################################
    2116
    22 # Add a patch which allows MPIR to build with Sun Studio:
    23 # (This only adds some includes if __SUNPRO_CC is defined, so is a completely
    24 # harmless change that doesn't depend on the actual compiler used.)
    25 if [ "$UNAME" = SunOS ]; then
    26     # TODO: Use 'patch' instead of copying over a patched version, which
    27     #       has to be refreshed on each new release, since gmp-h.in also
    28     #       contains the full version number.
    29     echo "Copying a version of gmp-h.in which is patched for Sun Studio..."
    30     cp ../patches/gmp-h.in . # We are in src/.
    31     if [ $? -ne 0 ]; then
    32         echo >&2 "Error: Failed to patch MPIR for Sun Studio."
    33         exit 1
    34     fi
    35 fi
    36 
    37 echo "Applying further patches (if any) to upstream sources..."
     17echo "Applying patches to upstream sources..."
    3818for patch in ../patches/*.patch; do
    3919    patch -p1 <"$patch"
    4020    if [ $? -ne 0 ]; then
     
    7858    cd "$saved"
    7959}
    8060
    81 get_upstream_selected_cflags() # Get MPIR's choice on empty CFLAGS (or system GMP's).
    82 {
    83     # Internal sanity check:
    84     if [ $# -ne 1 ]; then
    85         echo >&2 "Error: get_upstream_selected_cflags() requires 'file' parameter."
    86         exit 1
    87     fi
    88     header_file=$1
    89     if ! [ -f "$header_file" ]; then
    90         upstream_cc=""
    91         upstream_cflags=""
    92         return 1
    93     fi
    94     # The following patterns only extract the contents of (double-quoted) strings:
    95     gmp_cc_pat='/^[     ]*#[    ]*define[       ]\{1,\}__GMP_CC[        ]\{1,\}/s/.*"\([^"]*\)"/\1/p'
    96     gmp_cflags_pat='/^[         ]*#[    ]*define[       ]\{1,\}__GMP_CFLAGS[    ]\{1,\}/s/.*"\([^"]*\)"/\1/p'
    97     # Extract preprocessor definitions of __GMP_CC and __GMP_CFLAGS:
    98     upstream_cc=`sed -n -e "$gmp_cc_pat" "$header_file"`
    99     upstream_cflags=`sed -n -e "$gmp_cflags_pat" "$header_file"`
    100     # At least /some/ newer versions of MPIR define __GMP_CC and __GMP_CFLAGS
    101     # (also in gmp.h! -- how compatible is that?) to (literally) __MPIR_CC and
    102     # __MPIR_CFLAGS, respectively, i.e., to preprocessor variables, so we might
    103     # have to get the real strings from their definitions:
    104     # (Since we currently only match string literals above, both variables would
    105     # be empty in that case, and not contain the names of preprocessor variables.
    106     # We could change the patterns to actually match any definition / "value".)
    107     case "$upstream_cc" in __MPIR_CC|"")
    108         upstream_cc=`sed -n -e "${gmp_cc_pat/GMP/MPIR}" "$header_file"`
    109     esac
    110     case "$upstream_cflags" in __MPIR_CFLAGS|"")
    111         upstream_cflags=`sed -n -e "${gmp_cflags_pat/GMP/MPIR}" "$header_file"`
    112     esac
    113     # Upstream-selected CFLAGS may be empty, CC shouldn't:
    114     if [ -z "$upstream_cc" ]; then
    115         return 1
    116     fi
    117     return 0
    118 }
    119 
    12061get_processor_specific_cflags() # Extract some processor-specific CFLAGS.
    12162{
    12263    # Internal sanity check:
     
    12465        echo >&2 "Error: get_processor_specific_cflags() requires 'CFLAGS' parameter."
    12566        exit 1
    12667    fi
    127     flags=$@
     68    flags=$*
    12869    arch_flags=""
    12970    for opt in $flags; do
    13071        case $opt in
    131             -march=*|-mcpu=*|-mtune=*)
     72            -march=*|-mcpu=*|-mtune=*|-mpower*|-mno-power*)
    13273                arch_flags="$arch_flags $opt"
    13374                ;;
    13475            # We could add further '-m' or '-f' options here, but note that
    13576            # this function is also used to determine if the user specified
    13677            # some, which we don't want to override.
    137             # AFAIK, MPIR currently uses / defines at most '-m{arch,cpu,tune}',
    138             # not more specific / additional ones like e.g. '-mavx' or '-mvsx'.
    139             # (-leif, 04/2012)
    14078        esac
    14179    done
    14280    echo $arch_flags
    14381}
    14482
    145 native_build_cflags_if_supported() # Give option for a native build if supported.
    146 {
    147     # Some GCC 4.0.x versions don't support '-march=native', and it's currently
    148     # not supported on all platforms supported by Sage.
    149     # (Compilers other than 'gcc' might support it as well, in which case the
    150     # following also works. Other flavours could be added, too.)
    151     if touch foo.c && $CC -march=native -c foo.c &>/dev/null; then
    152         # Ok, the compiler (presumably GCC) understands '-march=native', which
    153         # doesn't yet mean the *assembler* will know the fancy instructions
    154         # the compiler emits with that option.
    155         # For example, Apple's assembler on Mac OS X 10.7.1 apparently doesn't
    156         # yet support AVX, which could also cause MPIR's 'configure' to fail.
    157         cat >foo.c <<-"EOF"
    158                 double d;
    159                 unsigned long fancy_insns() { return (unsigned long) d; }
    160                 int main () { return 0; }
    161         EOF
    162         if $CC -march=native -o foo foo.c &>/dev/null && ./foo >/dev/null; then
    163             echo "-march=native"
    164         else
    165             echo >&2 "Warning: Your assembler apparently doesn't understand the instructions"
    166             echo >&2 "         your compiler ($CC) generates with '-march=native'."
    167             echo >&2 "         You might also try to compile MPIR with (e.g.)"
    168             echo >&2 "             CFLAGS=\"-march=native -mno-avx\""
    169             echo >&2 "         to disable specific instruction set extension (in this case, AVX)."
    170         fi
    171     fi
    172     rm -f foo foo.* >/dev/null
    173 }
    174 
    17583###############################################################################
    17684# Set up environment variables:
    17785###############################################################################
     
    17987# The Yasm build uses PYTHON from the environment to find the Python interpreter,
    18088# so unset it in case it apparently contains nothing useful (like it did in Sage
    18189# versions prior to 5.0.beta10; cf. #10492), to not break Yasm's 'configure':
    182 if ! $PYTHON --version &>/dev/null; then
    183     # Only issue a warning if it was really non-empty, to not confuse users:
    184     if [ -n "$PYTHON" ]; then
     90if [ -n "$PYTHON" ]; then
     91    if ! $PYTHON --version &>/dev/null; then
    18592        echo >&2 "Warning: Unsetting PYTHON (=\"$PYTHON\"), since it doesn't seem"
    18693        echo >&2 "         to contain the name of / path to a Python interpreter."
     94        unset PYTHON
    18795    fi
    188     unset PYTHON
    18996fi
    19097
    19198user_cflags=$CFLAGS # Save them. 'sage-env' sets CC, but not CFLAGS.
     
    317224            fi
    318225            rm -f foo foo.c
    319226        fi
    320 
    321         # Work around a bug in GCC 4.7.0 which breaks the build on Itanium CPUs:
    322         # (Cf. #12765, #12751, and bug URL below.)
    323         case "`uname -m`-`$CC -dumpversion 2>/dev/null`" in ia64-4.7.*)
    324             # It's quite unlikely we match other compilers than GCC (e.g. clang) here.
    325             required_cflags="$required_cflags -O0 -finline-functions -fschedule-insns"
    326             echo >&2 "Warning: Disabling almost all optimization due to a bug in (at least)"
    327             echo >&2 "         GCC 4.7.0 on Itanium, which otherwise would break the build."
    328             echo >&2 "         See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48496"
    329             echo >&2 "         for current status and further details."
    330             echo >&2 "         (And please report to e.g. sage-devel in case you feel this bug"
    331             echo >&2 "          should already be fixed in GCC `$CC -dumpversion`.)"
    332         esac
    333227        ;; # Linux
    334228    CYGWIN)
    335229        # Nothing special performed (yet).
     
    339233            "by this MPIR spkg, i.e., by Sage's part of it."
    340234esac
    341235
    342 export ABI CFLAGS CXXFLAGS # Partially redundant, but safe(r).
     236# Work around a bug in GCC 4.7.0 which breaks the build on Itanium CPUs:
     237# See #12765, #12751, and http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48496
     238if [ "`uname -m`" = ia64 ] && [ "`testcc.sh $CC`" = GCC ] ; then
     239    if $CC -dumpversion | grep >/dev/null '^4\.7\.' ; then
     240        required_cflags="$required_cflags -O0 -finline-functions -fschedule-insns"
     241        echo >&2 "Warning: Disabling almost all optimization due to a bug in (at least)"
     242        echo >&2 "         GCC 4.7.0 on Itanium, which otherwise would break the build."
     243        echo >&2 "         See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48496"
     244        echo >&2 "         for current status and further details."
     245        echo >&2 "         (And please report to e.g. sage-devel in case you think this"
     246        echo >&2 "         bug is already fixed in GCC `$CC -dumpversion`.)"
     247    fi
     248fi
     249
     250export ABI CFLAGS CXXFLAGS LDFLAGS # Partially redundant, but safe(r).
    343251# We don't export CPPFLAGS here, since we don't (have to) modify them.
    344 if [ -n "$required_ldflags" ]; then
    345     export LDFLAGS # Probably redundant, but safe(r).
    346 fi
    347252
    348253###############################################################################
    349254# Now configure MPIR, eventually modifying CFLAGS [further]:
     
    368273
    369274# Pre-configure MPIR to get the settings it would use if CFLAGS were empty:
    370275echo "Checking what CFLAGS MPIR would use if they were empty..."
    371 if (unset CFLAGS CPPFLAGS CXXFLAGS &&
    372     ./configure $SAGE_CONF_OPTS $MPIR_EXTRA_OPTS) &>/dev/null;
    373 then
    374     if get_upstream_selected_cflags mpir.h; then
    375         mpir_cflags=$upstream_cflags
    376         mpir_cc=$upstream_cc
    377         echo "Settings chosen by MPIR when configuring with CFLAGS unset:"
    378         echo "  CC:      $mpir_cc"
    379         echo "  CFLAGS:  $mpir_cflags"
    380     else
    381         echo >&2 "Warning: Couldn't determine MPIR-selected CFLAGS from 'mpir.h'"
    382     fi
    383 else
    384     # We ignore errors in the first place, since we redirected all
    385     # messages to /dev/null. (The messages can be found in the 'config.log'
    386     # files if someone really wants to read them.)
    387     :;
     276(unset CFLAGS CPPFLAGS CXXFLAGS && ./configure $SAGE_CONF_OPTS $MPIR_EXTRA_OPTS) &>configure-empty.log
     277if [ $? -ne 0 ]; then
     278    # Output the log of the failed configure run
     279    cat configure-empty.log
     280    echo >&2 "Error configuring MPIR (with CFLAGS unset)."
     281    echo >&2 "Consult `pwd`/config.log for for details."
     282    exit 1
    388283fi
    389 find . -name config.cache -o -name config.status -exec rm -f {} \;
    390284
    391 for header in /usr/include/gmp.h /usr/local/include/gmp.h; do
    392     if get_upstream_selected_cflags $header; then
    393         system_cflags=upstream_cflags
    394         system_cc=upstream_cc
    395         echo "Settings found in $header:"
    396         echo "  CC:      $upstream_cc"
    397         echo "  CFLAGS:  $upstream_cflags"
    398     fi
    399 done
    400285
     286# Read MPIR-selected flags from Makefile
     287mpir_cc=`sed -n 's/^CC *= *//p' Makefile`
     288mpir_cflags=`sed -n 's/^CFLAGS *= *//p' Makefile`
     289if [ -z "$mpir_cc" ]; then
     290    echo >&2 "Error: failed to determine \$CC from Makefile"
     291    echo >&2 "Please report this to <sage-devel@googlegroups.com>"
     292    exit 1
     293fi
     294echo "Settings chosen by MPIR when configuring with CFLAGS unset:"
     295echo "  CC:      $mpir_cc"
     296echo "  CFLAGS:  $mpir_cflags"
    401297echo "Settings required to properly build MPIR, taking into account SAGE_DEBUG etc.:"
    402298echo "  CFLAGS:  $required_cflags"  # Might be empty.
    403299echo "  LDFLAGS: $required_ldflags" # Might be empty.
     
    410306echo "  (CPP, CPPFLAGS, CXX and CXXFLAGS are listed below; these don't get modified.)"
    411307
    412308if [ -z "$user_cflags" ]; then
    413     # No CFLAGS specified by user => Use either MPIR's, GMP's or our default
    414     # ones, plus those required by Sage for the package to build properly:
    415     if [ -n "$mpir_cflags" ]; then
    416         # Fine. Use upstream settings. MPIR honors '--enable-fat'.
    417         echo "Using MPIR's settings (plus mandatory ones)."
    418         CFLAGS="$mpir_cflags $required_cflags"
    419     elif [ -n "$system_cflags" ] && [ "$system_cc" = "$CC" ] &&
    420         [ "$SAGE_FAT_BINARY" != yes ];
    421     then
    422         # Use system-wide GMP's settings (since compilers match).
    423         echo "Using the settings from the system-wide GMP installation (plus mandatory ones.)"
    424         CFLAGS="$system_cflags $required_cflags"
    425     else # Use spkg's defaults, and add '-march=native' if supported and appropriate.
    426         echo "Using the spkg's (i.e. Sage's) default (plus mandatory) settings."
    427         CFLAGS="$default_cflags $required_cflags"
    428         if [ "$SAGE_FAT_BINARY" != yes ]; then
    429             CFLAGS="`native_build_cflags_if_supported` $CFLAGS"
    430         fi
    431     fi
     309    # No CFLAGS specified by user => Use MPIR's flags, plus those
     310    # required by Sage for the package to build properly:
     311    echo "Using MPIR's settings (plus mandatory ones)."
     312    CFLAGS="$mpir_cflags $required_cflags"
    432313else
    433314    # CFLAGS were specified by the user, so don't override them (unless
    434315    # necessary) and only add some useful ones to improve code generation:
     
    438319    # Now add processor-specific flags if appropriate:
    439320    if [ -z "`get_processor_specific_cflags $CFLAGS`" ]; then
    440321        # User didn't specify specific architecture, so try to add such flag(s):
    441         if [ -n "$mpir_cflags" ]; then
    442             # Add MPIR's. Honors '--enable-fat'.
    443             echo "Adding processor-specific options from MPIR."
    444             CFLAGS="`get_processor_specific_cflags $mpir_cflags` $CFLAGS"
    445         elif [ -n "$system_cflags" ] && [ "$system_cc" = "$CC" ] &&
    446             [ "$SAGE_FAT_BINARY" != yes ];
    447         then
    448             # Add system-wide GMP's processor-specific settings (since compilers match).
    449             echo "Adding processor-specific options from the system-wide GMP."
    450             CFLAGS="`get_processor_specific_cflags $system_cflags` $CFLAGS"
    451         elif [ "$SAGE_FAT_BINARY" != yes ]; then
    452             CFLAGS="`native_build_cflags_if_supported` $CFLAGS"
    453         fi
     322        # Add MPIR's. Honors '--enable-fat'.
     323        echo "Adding processor-specific options from MPIR."
     324        CFLAGS="`get_processor_specific_cflags $mpir_cflags` $CFLAGS"
    454325    else
    455326        # User did specify some processor-specific CFLAGS.
    456327        # We *might* prepend all of MPIR's CFLAGS here in addition,
    457328        # but doing so could raise a conflict.
    458         # (I'm not aware of any processor-specific flags MPIR uses / writes
    459         # to gmp.h other than -mcpu, -mtune / -march.)
    460329        :;
    461330    fi
    462331fi
     
    493362    echo "    --prefix=\"$SAGE_LOCAL\" --libdir=\"$SAGE_LOCAL/lib\" $SAGE_CONF_OPTS $MPIR_EXTRA_OPTS"
    494363fi
    495364
     365# Clear the cache of the previous configure run
     366find . -name config.cache -exec rm -f {} \;
     367
    496368./configure --prefix="$SAGE_LOCAL" --libdir="$SAGE_LOCAL/lib" $SAGE_CONF_OPTS $MPIR_EXTRA_OPTS
    497369if [ $? -ne 0 ]; then
    498370    echo >&2 "Error configuring MPIR. (See above for the options passed to it.)"