2008-04-17 17:03:07 -04:00
|
|
|
/* Definitions for GNU multiple precision functions. -*- mode: c -*-
|
|
|
|
|
|
|
|
Copyright 1991, 1993, 1994, 1995, 1996, 1997, 1999, 2000, 2001, 2002, 2003,
|
2014-03-26 09:20:01 -04:00
|
|
|
2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation,
|
|
|
|
Inc.
|
2008-04-17 17:03:07 -04:00
|
|
|
|
2008-07-24 17:14:10 -04:00
|
|
|
Copyright 2008 William Hart, Gonzalo Tornaria
|
2008-04-17 17:03:07 -04:00
|
|
|
|
2008-07-24 17:14:10 -04:00
|
|
|
This file is part of the MPIR Library.
|
|
|
|
|
|
|
|
The MPIR Library is free software; you can redistribute it and/or modify
|
2008-04-17 17:03:07 -04:00
|
|
|
it under the terms of the GNU Lesser General Public License as published by
|
2010-02-08 12:06:12 -05:00
|
|
|
the Free Software Foundation; either version 3 of the License, or (at your
|
2008-04-17 17:03:07 -04:00
|
|
|
option) any later version.
|
|
|
|
|
2008-07-24 17:14:10 -04:00
|
|
|
The MPIR Library is distributed in the hope that it will be useful, but
|
2008-04-17 17:03:07 -04:00
|
|
|
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
|
|
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
|
|
|
License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Lesser General Public License
|
2010-02-08 12:06:12 -05:00
|
|
|
along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#ifndef __GMP_H__
|
|
|
|
|
2013-08-01 13:06:30 -04:00
|
|
|
#ifdef __SUNPRO_CC /* See: http://trac.sagemath.org/sage_trac/ticket/7849 */
|
|
|
|
#include <stddef.h> /* This is Bill Hart's fix, but I've applied it only */
|
|
|
|
#include <stdarg.h> /* on Sun Studio */
|
|
|
|
#endif
|
|
|
|
|
2018-02-07 17:23:54 -05:00
|
|
|
#if defined(__has_include) /* should work on gcc 5.x or better, clang, VS 2015+ */
|
2018-02-08 07:50:08 -05:00
|
|
|
# if __has_include(<stdint.h>)
|
|
|
|
# include <stdint.h>
|
|
|
|
# endif
|
2018-02-07 07:38:17 -05:00
|
|
|
#endif
|
|
|
|
|
2008-04-17 17:03:07 -04:00
|
|
|
#if defined (__cplusplus)
|
2015-06-09 10:21:03 -04:00
|
|
|
|
|
|
|
#include <cstddef> /* for size_t */
|
2008-04-17 17:03:07 -04:00
|
|
|
#include <iosfwd> /* for std::istream, std::ostream, std::string */
|
2009-01-10 14:23:57 -05:00
|
|
|
#include <cstdio>
|
2008-04-17 17:03:07 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
/* Instantiated by configure. */
|
|
|
|
#if ! defined (__GMP_WITHIN_CONFIGURE)
|
|
|
|
#define __GMP_BITS_PER_MP_LIMB @BITS_PER_MP_LIMB@
|
|
|
|
#define GMP_LIMB_BITS @BITS_PER_MP_LIMB@
|
|
|
|
#define GMP_NAIL_BITS @GMP_NAIL_BITS@
|
|
|
|
#endif
|
|
|
|
#define GMP_NUMB_BITS (GMP_LIMB_BITS - GMP_NAIL_BITS)
|
|
|
|
#define GMP_NUMB_MASK ((~ __GMP_CAST (mp_limb_t, 0)) >> GMP_NAIL_BITS)
|
|
|
|
#define GMP_NUMB_MAX GMP_NUMB_MASK
|
|
|
|
#define GMP_NAIL_MASK (~ GMP_NUMB_MASK)
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef __GNU_MP__
|
|
|
|
#define __GNU_MP__ 4
|
|
|
|
|
|
|
|
#define __need_size_t /* tell gcc stddef.h we only want size_t */
|
2015-06-09 10:21:03 -04:00
|
|
|
#if ! defined (__cplusplus)
|
2008-04-17 17:03:07 -04:00
|
|
|
#include <stddef.h> /* for size_t */
|
|
|
|
#endif
|
|
|
|
#undef __need_size_t
|
|
|
|
|
|
|
|
/* Instantiated by configure. */
|
|
|
|
#if ! defined (__GMP_WITHIN_CONFIGURE)
|
|
|
|
@DEFN_LONG_LONG_LIMB@
|
|
|
|
#define __GMP_LIBGMP_DLL @LIBGMP_DLL@
|
|
|
|
#endif
|
|
|
|
|
2010-12-17 15:15:59 -05:00
|
|
|
/* #if defined(__GMP_WITHIN_CONFIGURE) && defined(_WIN64) */
|
2010-08-14 07:28:36 -04:00
|
|
|
#ifdef __WIN64
|
|
|
|
#define _LONG_LONG_LIMB 1
|
|
|
|
#endif
|
|
|
|
|
2008-04-17 17:03:07 -04:00
|
|
|
/* __STDC__ - some ANSI compilers define this only to 0, hence the use of
|
|
|
|
"defined" and not "__STDC__-0". In particular Sun workshop C 5.0
|
|
|
|
sets __STDC__ to 0, but requires "##" for token pasting.
|
|
|
|
|
|
|
|
_AIX - gnu ansidecl.h asserts that all known AIX compilers are ANSI but
|
|
|
|
don't always define __STDC__.
|
|
|
|
|
|
|
|
__DECC - current versions of DEC C (5.9 for instance) for alpha are ANSI,
|
|
|
|
but don't define __STDC__ in their default mode. Don't know if old
|
|
|
|
versions might have been K&R, but let's not worry about that unless
|
|
|
|
someone is still using one.
|
|
|
|
|
|
|
|
_mips - gnu ansidecl.h says the RISC/OS MIPS compiler is ANSI in SVR4
|
|
|
|
mode, but doesn't define __STDC__.
|
|
|
|
|
|
|
|
_MSC_VER - Microsoft C is ANSI, but __STDC__ is undefined unless the /Za
|
|
|
|
option is given (in which case it's 1).
|
|
|
|
|
|
|
|
_WIN32 - tested for by gnu ansidecl.h, no doubt on the assumption that
|
|
|
|
all w32 compilers are ansi.
|
|
|
|
|
|
|
|
Note: This same set of tests is used by gen-psqr.c and
|
|
|
|
demos/expr/expr-impl.h, so if anything needs adding, then be sure to
|
|
|
|
update those too. */
|
|
|
|
|
|
|
|
#if defined (__STDC__) \
|
|
|
|
|| defined (__cplusplus) \
|
|
|
|
|| defined (_AIX) \
|
|
|
|
|| defined (__DECC) \
|
|
|
|
|| (defined (__mips) && defined (_SYSTYPE_SVR4)) \
|
|
|
|
|| defined (_MSC_VER) \
|
|
|
|
|| defined (_WIN32)
|
|
|
|
#define __GMP_HAVE_CONST 1
|
|
|
|
#define __GMP_HAVE_PROTOTYPES 1
|
|
|
|
#define __GMP_HAVE_TOKEN_PASTE 1
|
|
|
|
#else
|
|
|
|
#define __GMP_HAVE_CONST 0
|
|
|
|
#define __GMP_HAVE_PROTOTYPES 0
|
|
|
|
#define __GMP_HAVE_TOKEN_PASTE 0
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#if __GMP_HAVE_CONST
|
|
|
|
#define __gmp_const const
|
|
|
|
#define __gmp_signed signed
|
|
|
|
#else
|
|
|
|
#define __gmp_const
|
|
|
|
#define __gmp_signed
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2009-02-12 07:25:23 -05:00
|
|
|
/* __GMP_DECLSPEC supports Windows DLL versions of libmpir, and is empty in
|
2008-04-17 17:03:07 -04:00
|
|
|
all other circumstances.
|
|
|
|
|
2009-02-12 07:25:23 -05:00
|
|
|
When compiling objects for libmpir, __GMP_DECLSPEC is an export directive,
|
2008-04-17 17:03:07 -04:00
|
|
|
or when compiling for an application it's an import directive. The two
|
|
|
|
cases are differentiated by __GMP_WITHIN_GMP defined by the GMP Makefiles
|
|
|
|
(and not defined from an application).
|
|
|
|
|
2009-02-12 07:25:23 -05:00
|
|
|
__GMP_DECLSPEC_XX is similarly used for libmpirxx. __GMP_WITHIN_GMPXX
|
|
|
|
indicates when building libmpirxx, and in that case libmpirxx functions are
|
|
|
|
exports, but libmpir functions which might get called are imports.
|
2008-04-17 17:03:07 -04:00
|
|
|
|
2009-02-12 07:25:23 -05:00
|
|
|
libmp.la uses __GMP_DECLSPEC, just as if it were libmpir.la. libmpir and
|
2008-04-17 17:03:07 -04:00
|
|
|
libmp don't call each other, so there's no conflict or confusion.
|
|
|
|
|
|
|
|
Libtool DLL_EXPORT define is not used.
|
|
|
|
|
|
|
|
There's no attempt to support GMP built both static and DLL. Doing so
|
|
|
|
would mean applications would have to tell us which of the two is going
|
|
|
|
to be used when linking, and that seems very tedious and error prone if
|
|
|
|
using GMP by hand, and equally tedious from a package since autoconf and
|
|
|
|
automake don't give much help.
|
|
|
|
|
|
|
|
__GMP_DECLSPEC is required on all documented global functions and
|
|
|
|
variables, the various internals in gmp-impl.h etc can be left unadorned.
|
|
|
|
But internals used by the test programs or speed measuring programs
|
|
|
|
should have __GMP_DECLSPEC, and certainly constants or variables must
|
|
|
|
have it or the wrong address will be resolved.
|
|
|
|
|
|
|
|
In gcc __declspec can go at either the start or end of a prototype.
|
|
|
|
|
|
|
|
In Microsoft C __declspec must go at the start, or after the type like
|
|
|
|
void __declspec(...) *foo()". There's no __dllexport or anything to
|
|
|
|
guard against someone foolish #defining dllexport. _export used to be
|
|
|
|
available, but no longer.
|
|
|
|
|
|
|
|
In Borland C _export still exists, but needs to go after the type, like
|
|
|
|
"void _export foo();". Would have to change the __GMP_DECLSPEC syntax to
|
|
|
|
make use of that. Probably more trouble than it's worth. */
|
|
|
|
|
|
|
|
#if defined (__GNUC__)
|
|
|
|
#define __GMP_DECLSPEC_EXPORT __declspec(__dllexport__)
|
|
|
|
#define __GMP_DECLSPEC_IMPORT __declspec(__dllimport__)
|
2018-05-07 08:10:47 -04:00
|
|
|
#elif defined (_MSC_VER) || defined (__BORLANDC__) || defined (__ORANGEC__)
|
2008-04-17 17:03:07 -04:00
|
|
|
#define __GMP_DECLSPEC_EXPORT __declspec(dllexport)
|
|
|
|
#define __GMP_DECLSPEC_IMPORT __declspec(dllimport)
|
2018-05-07 08:10:47 -04:00
|
|
|
#elif defined (__WATCOMC__)
|
2008-04-17 17:03:07 -04:00
|
|
|
#define __GMP_DECLSPEC_EXPORT __export
|
|
|
|
#define __GMP_DECLSPEC_IMPORT __import
|
2018-05-07 08:10:47 -04:00
|
|
|
#elif defined (__IBMC__)
|
2008-04-17 17:03:07 -04:00
|
|
|
#define __GMP_DECLSPEC_EXPORT _Export
|
|
|
|
#define __GMP_DECLSPEC_IMPORT _Import
|
2018-05-07 08:10:47 -04:00
|
|
|
#else
|
|
|
|
#define __GMP_DECLSPEC_EXPORT
|
|
|
|
#define __GMP_DECLSPEC_IMPORT
|
2008-04-17 17:03:07 -04:00
|
|
|
#endif
|
|
|
|
|
2014-04-02 09:14:47 -04:00
|
|
|
#if defined( _MSC_VER )
|
|
|
|
# if defined( MSC_BUILD_DLL )
|
|
|
|
# define __GMP_LIBGMP_DLL 1
|
|
|
|
# define __GMP_WITHIN_GMP 1
|
|
|
|
# define __GMP_WITHIN_GMPXX 1
|
|
|
|
# elif defined( MSC_USE_DLL )
|
|
|
|
# define __GMP_LIBGMP_DLL 1
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
2008-04-17 17:03:07 -04:00
|
|
|
#if __GMP_LIBGMP_DLL
|
|
|
|
#if __GMP_WITHIN_GMP
|
2009-02-12 07:25:23 -05:00
|
|
|
/* compiling to go into a DLL libmpir */
|
2008-04-17 17:03:07 -04:00
|
|
|
#define __GMP_DECLSPEC __GMP_DECLSPEC_EXPORT
|
|
|
|
#else
|
2009-02-12 07:25:23 -05:00
|
|
|
/* compiling to go into an application which will link to a DLL libmpir */
|
2008-04-17 17:03:07 -04:00
|
|
|
#define __GMP_DECLSPEC __GMP_DECLSPEC_IMPORT
|
|
|
|
#endif
|
|
|
|
#else
|
|
|
|
/* all other cases */
|
|
|
|
#define __GMP_DECLSPEC
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef __GMP_SHORT_LIMB
|
|
|
|
typedef unsigned int mp_limb_t;
|
|
|
|
typedef int mp_limb_signed_t;
|
|
|
|
#else
|
|
|
|
#ifdef _LONG_LONG_LIMB
|
|
|
|
typedef unsigned long long int mp_limb_t;
|
|
|
|
typedef long long int mp_limb_signed_t;
|
|
|
|
#else
|
|
|
|
typedef unsigned long int mp_limb_t;
|
|
|
|
typedef long int mp_limb_signed_t;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2010-08-13 22:44:51 -04:00
|
|
|
#ifdef _WIN64
|
2011-12-16 14:47:56 -05:00
|
|
|
#define BITS_PER_UI BITS_PER_MP_LIMB
|
2012-01-24 09:37:16 -05:00
|
|
|
typedef mp_limb_t mpir_ui;
|
|
|
|
typedef mp_limb_signed_t mpir_si;
|
2012-08-22 05:52:01 -04:00
|
|
|
typedef mpir_ui mp_bitcnt_t;
|
2010-02-08 12:06:12 -05:00
|
|
|
#else
|
2011-12-16 14:47:56 -05:00
|
|
|
#define BITS_PER_UI BITS_PER_ULONG
|
2012-01-24 09:37:16 -05:00
|
|
|
typedef unsigned long mpir_ui;
|
|
|
|
typedef long mpir_si;
|
2012-08-22 05:52:01 -04:00
|
|
|
typedef mpir_ui mp_bitcnt_t;
|
2010-02-08 12:06:12 -05:00
|
|
|
#endif
|
2012-01-24 09:37:16 -05:00
|
|
|
#define GMP_UI_MAX ((mpir_ui)(~(mpir_ui)0))
|
2011-12-16 14:47:56 -05:00
|
|
|
#define GMP_UI_HIBIT (GMP_UI_MAX ^ (GMP_UI_MAX >> 1))
|
2012-01-24 09:37:16 -05:00
|
|
|
#define GMP_SI_MAX ((mpir_si)(GMP_UI_MAX ^ GMP_UI_HIBIT))
|
|
|
|
#define GMP_SI_MIN ((mpir_si)GMP_UI_HIBIT)
|
2011-12-16 14:47:56 -05:00
|
|
|
#define __GMP_BITCNT_MAX (~(mp_bitcnt_t)0)
|
2010-02-08 12:06:12 -05:00
|
|
|
|
2008-04-17 17:03:07 -04:00
|
|
|
/* For reference, note that the name __mpz_struct gets into C++ mangled
|
|
|
|
function names, which means although the "__" suggests an internal, we
|
|
|
|
must leave this name for binary compatibility. */
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
int _mp_alloc; /* Number of *limbs* allocated and pointed
|
|
|
|
to by the _mp_d field. */
|
|
|
|
int _mp_size; /* abs(_mp_size) is the number of limbs the
|
|
|
|
last field points to. If _mp_size is
|
|
|
|
negative this is a negative number. */
|
|
|
|
mp_limb_t *_mp_d; /* Pointer to the limbs. */
|
|
|
|
} __mpz_struct;
|
|
|
|
|
|
|
|
#endif /* __GNU_MP__ */
|
|
|
|
|
|
|
|
typedef __mpz_struct mpz_t[1];
|
|
|
|
|
|
|
|
typedef mp_limb_t * mp_ptr;
|
|
|
|
typedef __gmp_const mp_limb_t * mp_srcptr;
|
2010-07-03 12:06:14 -04:00
|
|
|
#if defined( _WIN64)
|
2010-01-08 14:12:52 -05:00
|
|
|
#define __GMP_MP_SIZE_T_INT 0
|
|
|
|
typedef long long int mp_size_t;
|
|
|
|
typedef long int mp_exp_t;
|
2008-04-17 17:03:07 -04:00
|
|
|
#else
|
|
|
|
#define __GMP_MP_SIZE_T_INT 0
|
|
|
|
typedef long int mp_size_t;
|
|
|
|
typedef long int mp_exp_t;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
__mpz_struct _mp_num;
|
|
|
|
__mpz_struct _mp_den;
|
|
|
|
} __mpq_struct;
|
|
|
|
|
|
|
|
typedef __mpq_struct mpq_t[1];
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
int _mp_prec; /* Max precision, in number of `mp_limb_t's.
|
|
|
|
Set by mpf_init and modified by
|
|
|
|
mpf_set_prec. The area pointed to by the
|
|
|
|
_mp_d field contains `prec' + 1 limbs. */
|
|
|
|
int _mp_size; /* abs(_mp_size) is the number of limbs the
|
|
|
|
last field points to. If _mp_size is
|
|
|
|
negative this is a negative number. */
|
|
|
|
mp_exp_t _mp_exp; /* Exponent, in the base of `mp_limb_t'. */
|
|
|
|
mp_limb_t *_mp_d; /* Pointer to the limbs. */
|
|
|
|
} __mpf_struct;
|
|
|
|
|
|
|
|
typedef __mpf_struct mpf_t[1];
|
|
|
|
|
|
|
|
/* Available random number generation algorithms. */
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
GMP_RAND_ALG_DEFAULT = 0,
|
|
|
|
GMP_RAND_ALG_LC = GMP_RAND_ALG_DEFAULT /* Linear congruential. */
|
|
|
|
} gmp_randalg_t;
|
|
|
|
|
|
|
|
/* Random state struct. */
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
mpz_t _mp_seed; /* _mp_d member points to state of the generator. */
|
|
|
|
gmp_randalg_t _mp_alg; /* Currently unused. */
|
|
|
|
union {
|
|
|
|
void *_mp_lc; /* Pointer to function pointers structure. */
|
|
|
|
} _mp_algdata;
|
|
|
|
} __gmp_randstate_struct;
|
|
|
|
typedef __gmp_randstate_struct gmp_randstate_t[1];
|
|
|
|
|
|
|
|
/* Types for function declarations in gmp files. */
|
|
|
|
/* ??? Should not pollute user name space with these ??? */
|
|
|
|
typedef __gmp_const __mpz_struct *mpz_srcptr;
|
|
|
|
typedef __mpz_struct *mpz_ptr;
|
|
|
|
typedef __gmp_const __mpf_struct *mpf_srcptr;
|
|
|
|
typedef __mpf_struct *mpf_ptr;
|
|
|
|
typedef __gmp_const __mpq_struct *mpq_srcptr;
|
|
|
|
typedef __mpq_struct *mpq_ptr;
|
2018-09-16 11:48:56 -04:00
|
|
|
typedef __gmp_const __gmp_randstate_struct *randstate_srcptr;
|
|
|
|
typedef __gmp_randstate_struct *randstate_ptr;
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
|
|
|
|
#if __GMP_LIBGMP_DLL
|
|
|
|
#if __GMP_WITHIN_GMPXX
|
2009-02-12 07:25:23 -05:00
|
|
|
/* compiling to go into a DLL libmpirxx */
|
2008-04-17 17:03:07 -04:00
|
|
|
#define __GMP_DECLSPEC_XX __GMP_DECLSPEC_EXPORT
|
|
|
|
#else
|
2009-02-12 07:25:23 -05:00
|
|
|
/* compiling to go into a application which will link to a DLL libmpirxx */
|
2008-04-17 17:03:07 -04:00
|
|
|
#define __GMP_DECLSPEC_XX __GMP_DECLSPEC_IMPORT
|
|
|
|
#endif
|
|
|
|
#else
|
|
|
|
/* all other cases */
|
|
|
|
#define __GMP_DECLSPEC_XX
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef __MPN
|
|
|
|
#if __GMP_HAVE_TOKEN_PASTE
|
|
|
|
#define __MPN(x) __gmpn_##x
|
|
|
|
#else
|
|
|
|
#define __MPN(x) __gmpn_/**/x
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* For reference, "defined(EOF)" cannot be used here. In g++ 2.95.4,
|
|
|
|
<iostream> defines EOF but not FILE. */
|
|
|
|
#if defined (FILE) \
|
|
|
|
|| defined (H_STDIO) \
|
|
|
|
|| defined (_H_STDIO) /* AIX */ \
|
|
|
|
|| defined (_STDIO_H) /* glibc, Sun, SCO */ \
|
|
|
|
|| defined (_STDIO_H_) /* BSD, OSF */ \
|
|
|
|
|| defined (__STDIO_H) /* Borland */ \
|
|
|
|
|| defined (__STDIO_H__) /* IRIX */ \
|
|
|
|
|| defined (_STDIO_INCLUDED) /* HPUX */ \
|
|
|
|
|| defined (_FILE_DEFINED) /* Microsoft */ \
|
|
|
|
|| defined (__STDIO__) /* Apple MPW MrC */ \
|
|
|
|
|| defined (_MSL_STDIO_H) /* Metrowerks */ \
|
|
|
|
|| defined (_STDIO_H_INCLUDED) /* QNX4 */ \
|
|
|
|
|| defined (_ISO_STDIO_ISO_H) /* Sun C++ */
|
|
|
|
#define _GMP_H_HAVE_FILE 1
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* In ISO C, if a prototype involving "struct obstack *" is given without
|
|
|
|
that structure defined, then the struct is scoped down to just the
|
|
|
|
prototype, causing a conflict if it's subsequently defined for real. So
|
|
|
|
only give prototypes if we've got obstack.h. */
|
|
|
|
#if defined (_OBSTACK_H) /* glibc <obstack.h> */
|
|
|
|
#define _GMP_H_HAVE_OBSTACK 1
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* The prototypes for gmp_vprintf etc are provided only if va_list is
|
|
|
|
available, via an application having included <stdarg.h> or <varargs.h>.
|
|
|
|
Usually va_list is a typedef so can't be tested directly, but C99
|
|
|
|
specifies that va_start is a macro (and it was normally a macro on past
|
|
|
|
systems too), so look for that.
|
|
|
|
|
|
|
|
<stdio.h> will define some sort of va_list for vprintf and vfprintf, but
|
|
|
|
let's not bother trying to use that since it's not standard and since
|
|
|
|
application uses for gmp_vprintf etc will almost certainly require the
|
|
|
|
whole <stdarg.h> or <varargs.h> anyway. */
|
|
|
|
|
|
|
|
#ifdef va_start
|
|
|
|
#define _GMP_H_HAVE_VA_LIST 1
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Test for gcc >= maj.min, as per __GNUC_PREREQ in glibc */
|
|
|
|
#if defined (__GNUC__) && defined (__GNUC_MINOR__)
|
|
|
|
#define __GMP_GNUC_PREREQ(maj, min) \
|
|
|
|
((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
|
|
|
|
#else
|
|
|
|
#define __GMP_GNUC_PREREQ(maj, min) 0
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* "pure" is in gcc 2.96 and up, see "(gcc)Function Attributes". Basically
|
|
|
|
it means a function does nothing but examine its arguments and memory
|
|
|
|
(global or via arguments) to generate a return value, but changes nothing
|
|
|
|
and has no side-effects. __GMP_NO_ATTRIBUTE_CONST_PURE lets
|
|
|
|
tune/common.c etc turn this off when trying to write timing loops. */
|
|
|
|
#if __GMP_GNUC_PREREQ (2,96) && ! defined (__GMP_NO_ATTRIBUTE_CONST_PURE)
|
|
|
|
#define __GMP_ATTRIBUTE_PURE __attribute__ ((__pure__))
|
|
|
|
#else
|
|
|
|
#define __GMP_ATTRIBUTE_PURE
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
/* __GMP_CAST allows us to use static_cast in C++, so our macros are clean
|
|
|
|
to "g++ -Wold-style-cast".
|
|
|
|
|
|
|
|
Casts in "extern inline" code within an extern "C" block don't induce
|
|
|
|
these warnings, so __GMP_CAST only needs to be used on documented
|
|
|
|
macros. */
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
#define __GMP_CAST(type, expr) (static_cast<type> (expr))
|
|
|
|
#else
|
|
|
|
#define __GMP_CAST(type, expr) ((type) (expr))
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
/* An empty "throw ()" means the function doesn't throw any C++ exceptions,
|
|
|
|
this can save some stack frame info in applications.
|
|
|
|
|
|
|
|
Currently it's given only on functions which never divide-by-zero etc,
|
|
|
|
don't allocate memory, and are expected to never need to allocate memory.
|
|
|
|
This leaves open the possibility of a C++ throw from a future GMP
|
|
|
|
exceptions scheme.
|
|
|
|
|
|
|
|
mpz_set_ui etc are omitted to leave open the lazy allocation scheme
|
|
|
|
described in doc/tasks.html. mpz_get_d etc are omitted to leave open
|
|
|
|
exceptions for float overflows.
|
|
|
|
|
|
|
|
Note that __GMP_NOTHROW must be given on any inlines the same as on their
|
|
|
|
prototypes (for g++ at least, where they're used together). Note also
|
|
|
|
that g++ 3.0 demands that __GMP_NOTHROW is before other attributes like
|
|
|
|
__GMP_ATTRIBUTE_PURE. */
|
|
|
|
|
|
|
|
#if defined (__cplusplus)
|
|
|
|
#define __GMP_NOTHROW throw ()
|
|
|
|
#else
|
|
|
|
#define __GMP_NOTHROW
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* PORTME: What other compilers have a useful "extern inline"? "static
|
|
|
|
inline" would be an acceptable substitute if the compiler (or linker)
|
|
|
|
discards unused statics. */
|
|
|
|
|
|
|
|
/* gcc has __inline__ in all modes, including strict ansi. Give a prototype
|
|
|
|
for an inline too, so as to correctly specify "dllimport" on windows, in
|
|
|
|
case the function is called rather than inlined. */
|
2008-06-26 01:41:28 -04:00
|
|
|
|
2008-06-26 01:14:26 -04:00
|
|
|
#ifdef __GNUC__
|
2009-03-10 19:39:52 -04:00
|
|
|
#if defined(__APPLE_CC__) && (__APPLE_CC__ != 1) /* FSF GCC sets this flag to 1 on Apple machines */
|
2008-06-26 03:44:38 -04:00
|
|
|
|
|
|
|
#if ! (__APPLE_CC__ >= 5465 && __STDC_VERSION__ >= 199901L)
|
|
|
|
#define __GMP_EXTERN_INLINE extern __inline__
|
|
|
|
#define __GMP_INLINE_PROTOTYPES 1
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#else /*GNU CC*/
|
|
|
|
|
2009-05-12 15:37:47 -04:00
|
|
|
#if defined(__GNUC_STDC_INLINE__) || defined (__GNUC_GNU_INLINE__)
|
|
|
|
#define __GMP_EXTERN_INLINE extern __inline__ __attribute__((__gnu_inline__))
|
|
|
|
#else
|
2008-06-24 22:25:45 -04:00
|
|
|
#define __GMP_EXTERN_INLINE extern __inline__
|
|
|
|
#endif
|
2008-06-24 22:01:33 -04:00
|
|
|
#define __GMP_INLINE_PROTOTYPES 1
|
2008-04-17 17:03:07 -04:00
|
|
|
|
2008-06-26 03:44:38 -04:00
|
|
|
#endif
|
2008-06-26 01:41:28 -04:00
|
|
|
#endif
|
|
|
|
|
2008-04-17 17:03:07 -04:00
|
|
|
/* DEC C (eg. version 5.9) supports "static __inline foo()", even in -std1
|
|
|
|
strict ANSI mode. Inlining is done even when not optimizing (ie. -O0
|
|
|
|
mode, which is the default), but an unnecessary local copy of foo is
|
|
|
|
emitted unless -O is used. "extern __inline" is accepted, but the
|
|
|
|
"extern" appears to be ignored, ie. it becomes a plain global function
|
|
|
|
but which is inlined within its file. Don't know if all old versions of
|
|
|
|
DEC C supported __inline, but as a start let's do the right thing for
|
|
|
|
current versions. */
|
|
|
|
#ifdef __DECC
|
|
|
|
#define __GMP_EXTERN_INLINE static __inline
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* SCO OpenUNIX 8 cc supports "static inline foo()" but not in -Xc strict
|
|
|
|
ANSI mode (__STDC__ is 1 in that mode). Inlining only actually takes
|
|
|
|
place under -O. Without -O "foo" seems to be emitted whether it's used
|
|
|
|
or not, which is wasteful. "extern inline foo()" isn't useful, the
|
|
|
|
"extern" is apparently ignored, so foo is inlined if possible but also
|
|
|
|
emitted as a global, which causes multiple definition errors when
|
2009-02-12 07:25:23 -05:00
|
|
|
building a shared libmpir. */
|
2008-04-17 17:03:07 -04:00
|
|
|
#ifdef __SCO_VERSION__
|
|
|
|
#if __SCO_VERSION__ > 400000000 && __STDC__ != 1 \
|
|
|
|
&& ! defined (__GMP_EXTERN_INLINE)
|
|
|
|
#define __GMP_EXTERN_INLINE static inline
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2010-02-22 07:21:17 -05:00
|
|
|
#if defined _MSC_VER
|
2010-01-10 10:25:55 -05:00
|
|
|
#define __GMP_EXTERN_INLINE static __inline
|
|
|
|
#endif
|
|
|
|
|
2008-04-17 17:03:07 -04:00
|
|
|
/* C++ always has "inline" and since it's a normal feature the linker should
|
|
|
|
discard duplicate non-inlined copies, or if it doesn't then that's a
|
|
|
|
problem for everyone, not just GMP. */
|
|
|
|
#if defined (__cplusplus) && ! defined (__GMP_EXTERN_INLINE)
|
|
|
|
#define __GMP_EXTERN_INLINE inline
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Don't do any inlining within a configure run, since if the compiler ends
|
|
|
|
up emitting copies of the code into the object file it can end up
|
|
|
|
demanding the various support routines (like mpn_popcount) for linking,
|
|
|
|
making the "alloca" test and perhaps others fail. And on hppa ia64 a
|
|
|
|
pre-release gcc 3.2 was seen not respecting the "extern" in "extern
|
|
|
|
__inline__", triggering this problem too. */
|
|
|
|
#if defined (__GMP_WITHIN_CONFIGURE) && ! __GMP_WITHIN_CONFIGURE_INLINE
|
|
|
|
#undef __GMP_EXTERN_INLINE
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* By default, don't give a prototype when there's going to be an inline
|
|
|
|
version. Note in particular that Cray C++ objects to the combination of
|
|
|
|
prototype and inline. */
|
|
|
|
#ifdef __GMP_EXTERN_INLINE
|
2008-06-24 22:01:33 -04:00
|
|
|
#ifndef __GMP_INLINE_PROTOTYPES
|
|
|
|
#define __GMP_INLINE_PROTOTYPES 0
|
2008-04-17 17:03:07 -04:00
|
|
|
#endif
|
|
|
|
#else
|
2008-06-24 22:01:33 -04:00
|
|
|
#define __GMP_INLINE_PROTOTYPES 1
|
2008-04-17 17:03:07 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#define __GMP_ABS(x) ((x) >= 0 ? (x) : -(x))
|
|
|
|
#define __GMP_MAX(h,i) ((h) > (i) ? (h) : (i))
|
|
|
|
|
|
|
|
/* __GMP_USHRT_MAX is not "~ (unsigned short) 0" because short is promoted
|
|
|
|
to int by "~". */
|
|
|
|
#define __GMP_UINT_MAX (~ (unsigned) 0)
|
|
|
|
#define __GMP_ULONG_MAX (~ (unsigned long) 0)
|
|
|
|
#define __GMP_USHRT_MAX ((unsigned short) ~0)
|
|
|
|
|
|
|
|
|
|
|
|
/* __builtin_expect is in gcc 3.0, and not in 2.95. */
|
|
|
|
#if __GMP_GNUC_PREREQ (3,0)
|
|
|
|
#define __GMP_LIKELY(cond) __builtin_expect ((cond) != 0, 1)
|
|
|
|
#define __GMP_UNLIKELY(cond) __builtin_expect ((cond) != 0, 0)
|
|
|
|
#else
|
|
|
|
#define __GMP_LIKELY(cond) (cond)
|
|
|
|
#define __GMP_UNLIKELY(cond) (cond)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Allow direct user access to numerator and denominator of a mpq_t object. */
|
|
|
|
#define mpq_numref(Q) (&((Q)->_mp_num))
|
|
|
|
#define mpq_denref(Q) (&((Q)->_mp_den))
|
|
|
|
|
|
|
|
|
|
|
|
#if defined (__cplusplus)
|
|
|
|
extern "C" {
|
|
|
|
using std::FILE;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define mp_set_memory_functions __gmp_set_memory_functions
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mp_set_memory_functions(void *(*) (size_t),
|
2008-04-17 17:03:07 -04:00
|
|
|
void *(*) (void *, size_t, size_t),
|
2018-02-25 04:02:47 -05:00
|
|
|
void (*) (void *, size_t)) __GMP_NOTHROW;
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mp_get_memory_functions __gmp_get_memory_functions
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mp_get_memory_functions(void *(**) (size_t),
|
2008-04-17 17:03:07 -04:00
|
|
|
void *(**) (void *, size_t, size_t),
|
2018-02-25 04:02:47 -05:00
|
|
|
void (**) (void *, size_t)) __GMP_NOTHROW;
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mp_bits_per_limb __gmp_bits_per_limb
|
|
|
|
__GMP_DECLSPEC extern __gmp_const int mp_bits_per_limb;
|
|
|
|
|
2010-03-12 06:05:23 -05:00
|
|
|
#define gmp_errno __gmp_errno
|
|
|
|
__GMP_DECLSPEC extern int gmp_errno;
|
|
|
|
|
2008-04-17 17:03:07 -04:00
|
|
|
#define gmp_version __gmp_version
|
|
|
|
__GMP_DECLSPEC extern __gmp_const char * __gmp_const gmp_version;
|
|
|
|
|
2008-07-22 22:26:25 -04:00
|
|
|
#define mpir_version __mpir_version
|
|
|
|
__GMP_DECLSPEC extern __gmp_const char * __gmp_const mpir_version;
|
|
|
|
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
/**************** Random number routines. ****************/
|
|
|
|
|
|
|
|
#define gmp_randinit_default __gmp_randinit_default
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void gmp_randinit_default(gmp_randstate_t);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define gmp_randinit_lc_2exp __gmp_randinit_lc_2exp
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void gmp_randinit_lc_2exp(gmp_randstate_t,
|
2012-01-24 09:37:16 -05:00
|
|
|
mpz_srcptr, mpir_ui,
|
2018-02-25 04:02:47 -05:00
|
|
|
mp_bitcnt_t);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define gmp_randinit_lc_2exp_size __gmp_randinit_lc_2exp_size
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int gmp_randinit_lc_2exp_size(gmp_randstate_t, mp_bitcnt_t);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define gmp_randinit_mt __gmp_randinit_mt
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void gmp_randinit_mt(gmp_randstate_t);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define gmp_randinit_set __gmp_randinit_set
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void gmp_randinit_set(gmp_randstate_t, __gmp_const __gmp_randstate_struct *);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define gmp_randseed __gmp_randseed
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void gmp_randseed(gmp_randstate_t, mpz_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define gmp_randseed_ui __gmp_randseed_ui
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void gmp_randseed_ui(gmp_randstate_t, mpir_ui);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define gmp_randclear __gmp_randclear
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void gmp_randclear(gmp_randstate_t);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define gmp_urandomb_ui __gmp_urandomb_ui
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC mpir_ui gmp_urandomb_ui(gmp_randstate_t, mpir_ui);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define gmp_urandomm_ui __gmp_urandomm_ui
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC mpir_ui gmp_urandomm_ui(gmp_randstate_t, mpir_ui);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
|
|
|
|
/**************** Formatted output routines. ****************/
|
|
|
|
|
|
|
|
#define gmp_asprintf __gmp_asprintf
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int gmp_asprintf(char **, __gmp_const char *, ...);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define gmp_fprintf __gmp_fprintf
|
|
|
|
#ifdef _GMP_H_HAVE_FILE
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int gmp_fprintf(FILE *, __gmp_const char *, ...);
|
2008-04-17 17:03:07 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#define gmp_obstack_printf __gmp_obstack_printf
|
|
|
|
#if defined (_GMP_H_HAVE_OBSTACK)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int gmp_obstack_printf(struct obstack *, __gmp_const char *, ...);
|
2008-04-17 17:03:07 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#define gmp_obstack_vprintf __gmp_obstack_vprintf
|
|
|
|
#if defined (_GMP_H_HAVE_OBSTACK) && defined (_GMP_H_HAVE_VA_LIST)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int gmp_obstack_vprintf(struct obstack *, __gmp_const char *, va_list);
|
2008-04-17 17:03:07 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#define gmp_printf __gmp_printf
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int gmp_printf(__gmp_const char *, ...);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define gmp_snprintf __gmp_snprintf
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int gmp_snprintf(char *, size_t, __gmp_const char *, ...);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define gmp_sprintf __gmp_sprintf
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int gmp_sprintf(char *, __gmp_const char *, ...);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define gmp_vasprintf __gmp_vasprintf
|
|
|
|
#if defined (_GMP_H_HAVE_VA_LIST)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int gmp_vasprintf(char **, __gmp_const char *, va_list);
|
2008-04-17 17:03:07 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#define gmp_vfprintf __gmp_vfprintf
|
|
|
|
#if defined (_GMP_H_HAVE_FILE) && defined (_GMP_H_HAVE_VA_LIST)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int gmp_vfprintf(FILE *, __gmp_const char *, va_list);
|
2008-04-17 17:03:07 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#define gmp_vprintf __gmp_vprintf
|
|
|
|
#if defined (_GMP_H_HAVE_VA_LIST)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int gmp_vprintf(__gmp_const char *, va_list);
|
2008-04-17 17:03:07 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#define gmp_vsnprintf __gmp_vsnprintf
|
|
|
|
#if defined (_GMP_H_HAVE_VA_LIST)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int gmp_vsnprintf(char *, size_t, __gmp_const char *, va_list);
|
2008-04-17 17:03:07 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#define gmp_vsprintf __gmp_vsprintf
|
|
|
|
#if defined (_GMP_H_HAVE_VA_LIST)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int gmp_vsprintf(char *, __gmp_const char *, va_list);
|
2008-04-17 17:03:07 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
/**************** Formatted input routines. ****************/
|
|
|
|
|
|
|
|
#define gmp_fscanf __gmp_fscanf
|
|
|
|
#ifdef _GMP_H_HAVE_FILE
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int gmp_fscanf(FILE *, __gmp_const char *, ...);
|
2008-04-17 17:03:07 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#define gmp_scanf __gmp_scanf
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int gmp_scanf(__gmp_const char *, ...);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define gmp_sscanf __gmp_sscanf
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int gmp_sscanf(__gmp_const char *, __gmp_const char *, ...);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define gmp_vfscanf __gmp_vfscanf
|
|
|
|
#if defined (_GMP_H_HAVE_FILE) && defined (_GMP_H_HAVE_VA_LIST)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int gmp_vfscanf(FILE *, __gmp_const char *, va_list);
|
2008-04-17 17:03:07 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#define gmp_vscanf __gmp_vscanf
|
|
|
|
#if defined (_GMP_H_HAVE_VA_LIST)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int gmp_vscanf(__gmp_const char *, va_list);
|
2008-04-17 17:03:07 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#define gmp_vsscanf __gmp_vsscanf
|
|
|
|
#if defined (_GMP_H_HAVE_VA_LIST)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int gmp_vsscanf(__gmp_const char *, __gmp_const char *, va_list);
|
2008-04-17 17:03:07 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
/**************** Integer (i.e. Z) routines. ****************/
|
|
|
|
|
|
|
|
#define _mpz_realloc __gmpz_realloc
|
|
|
|
#define mpz_realloc __gmpz_realloc
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void *_mpz_realloc(mpz_ptr, mp_size_t);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_abs __gmpz_abs
|
2009-09-08 17:15:29 -04:00
|
|
|
#define __GMP_MPZ_ABS_MIN_ALLOC(x,y) (__GMP_ABS(y->_mp_size))
|
2008-06-24 22:01:33 -04:00
|
|
|
#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_abs)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_abs(mpz_ptr, mpz_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
#endif
|
|
|
|
|
2009-09-08 17:15:29 -04:00
|
|
|
#define __GMP_MPZ_ADD_MIN_ALLOC(x,y,z) (__GMP_MAX(__GMP_ABS(y->_mp_size),__GMP_ABS(z->_mp_size))+1)
|
2008-04-17 17:03:07 -04:00
|
|
|
#define mpz_add __gmpz_add
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_add(mpz_ptr, mpz_srcptr, mpz_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
2011-12-16 14:47:56 -05:00
|
|
|
#define __GMP_MPZ_ADD_UI_MIN_ALLOC(x,y,z) (__GMP_MAX(__GMP_ABS(y->_mp_size),1+(GMP_BITS_PER_UI-1)/GMP_NUMB_BITS)+1)
|
2008-04-17 17:03:07 -04:00
|
|
|
#define mpz_add_ui __gmpz_add_ui
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_add_ui(mpz_ptr, mpz_srcptr, mpir_ui);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_addmul __gmpz_addmul
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_addmul(mpz_ptr, mpz_srcptr, mpz_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_addmul_ui __gmpz_addmul_ui
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_addmul_ui(mpz_ptr, mpz_srcptr, mpir_ui);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_and __gmpz_and
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_and(mpz_ptr, mpz_srcptr, mpz_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_array_init __gmpz_array_init
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_array_init(mpz_ptr, mp_size_t, mp_size_t);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_bin_ui __gmpz_bin_ui
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_bin_ui(mpz_ptr, mpz_srcptr, mpir_ui);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_bin_uiui __gmpz_bin_uiui
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_bin_uiui(mpz_ptr, mpir_ui, mpir_ui);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_cdiv_q __gmpz_cdiv_q
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_cdiv_q(mpz_ptr, mpz_srcptr, mpz_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_cdiv_q_2exp __gmpz_cdiv_q_2exp
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_cdiv_q_2exp(mpz_ptr, mpz_srcptr, mp_bitcnt_t);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_cdiv_q_ui __gmpz_cdiv_q_ui
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC mpir_ui mpz_cdiv_q_ui(mpz_ptr, mpz_srcptr, mpir_ui);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_cdiv_qr __gmpz_cdiv_qr
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_cdiv_qr(mpz_ptr, mpz_ptr, mpz_srcptr, mpz_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_cdiv_qr_ui __gmpz_cdiv_qr_ui
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC mpir_ui mpz_cdiv_qr_ui(mpz_ptr, mpz_ptr, mpz_srcptr, mpir_ui);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_cdiv_r __gmpz_cdiv_r
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_cdiv_r(mpz_ptr, mpz_srcptr, mpz_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_cdiv_r_2exp __gmpz_cdiv_r_2exp
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_cdiv_r_2exp(mpz_ptr, mpz_srcptr, mp_bitcnt_t);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_cdiv_r_ui __gmpz_cdiv_r_ui
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC mpir_ui mpz_cdiv_r_ui(mpz_ptr, mpz_srcptr, mpir_ui);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_cdiv_ui __gmpz_cdiv_ui
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC mpir_ui mpz_cdiv_ui(mpz_srcptr, mpir_ui) __GMP_ATTRIBUTE_PURE;
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_clear __gmpz_clear
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_clear(mpz_ptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
2010-02-11 10:54:59 -05:00
|
|
|
#define mpz_clears __gmpz_clears
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_clears(mpz_ptr, ...);
|
2010-02-11 10:54:59 -05:00
|
|
|
|
2008-04-17 17:03:07 -04:00
|
|
|
#define mpz_clrbit __gmpz_clrbit
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_clrbit(mpz_ptr, mp_bitcnt_t);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_cmp __gmpz_cmp
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int mpz_cmp(mpz_srcptr, mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_cmp_d __gmpz_cmp_d
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int mpz_cmp_d(mpz_srcptr, double) __GMP_ATTRIBUTE_PURE;
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define _mpz_cmp_si __gmpz_cmp_si
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int _mpz_cmp_si(mpz_srcptr, mpir_si) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define _mpz_cmp_ui __gmpz_cmp_ui
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int _mpz_cmp_ui(mpz_srcptr, mpir_ui) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_cmpabs __gmpz_cmpabs
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int mpz_cmpabs(mpz_srcptr, mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_cmpabs_d __gmpz_cmpabs_d
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int mpz_cmpabs_d(mpz_srcptr, double) __GMP_ATTRIBUTE_PURE;
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_cmpabs_ui __gmpz_cmpabs_ui
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int mpz_cmpabs_ui(mpz_srcptr, mpir_ui) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_com __gmpz_com
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_com(mpz_ptr, mpz_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_combit __gmpz_combit
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_combit(mpz_ptr, mp_bitcnt_t);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_congruent_p __gmpz_congruent_p
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int mpz_congruent_p(mpz_srcptr, mpz_srcptr, mpz_srcptr) __GMP_ATTRIBUTE_PURE;
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_congruent_2exp_p __gmpz_congruent_2exp_p
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int mpz_congruent_2exp_p(mpz_srcptr, mpz_srcptr, mp_bitcnt_t) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_congruent_ui_p __gmpz_congruent_ui_p
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int mpz_congruent_ui_p(mpz_srcptr, mpir_ui, mpir_ui) __GMP_ATTRIBUTE_PURE;
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_divexact __gmpz_divexact
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_divexact(mpz_ptr, mpz_srcptr, mpz_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_divexact_ui __gmpz_divexact_ui
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_divexact_ui(mpz_ptr, mpz_srcptr, mpir_ui);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_divisible_p __gmpz_divisible_p
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int mpz_divisible_p(mpz_srcptr, mpz_srcptr) __GMP_ATTRIBUTE_PURE;
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_divisible_ui_p __gmpz_divisible_ui_p
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int mpz_divisible_ui_p(mpz_srcptr, mpir_ui) __GMP_ATTRIBUTE_PURE;
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_divisible_2exp_p __gmpz_divisible_2exp_p
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int mpz_divisible_2exp_p(mpz_srcptr, mp_bitcnt_t) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_dump __gmpz_dump
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_dump(mpz_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_export __gmpz_export
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void *mpz_export(void *, size_t *, int, size_t, int, size_t, mpz_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_fac_ui __gmpz_fac_ui
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_fac_ui(mpz_ptr, mpir_ui);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
2014-02-28 08:19:19 -05:00
|
|
|
#define mpz_2fac_ui __gmpz_2fac_ui
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_2fac_ui(mpz_ptr, mpir_ui);
|
2014-02-28 08:19:19 -05:00
|
|
|
|
2014-02-28 08:35:36 -05:00
|
|
|
#define mpz_mfac_uiui __gmpz_mfac_uiui
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_mfac_uiui(mpz_ptr, mpir_ui, mpir_ui);
|
2014-02-28 08:35:36 -05:00
|
|
|
|
2014-02-28 08:49:27 -05:00
|
|
|
#define mpz_primorial_ui __gmpz_primorial_ui
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_primorial_ui(mpz_ptr, mpir_ui);
|
2014-02-28 08:49:27 -05:00
|
|
|
|
2008-04-17 17:03:07 -04:00
|
|
|
#define mpz_fdiv_q __gmpz_fdiv_q
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_fdiv_q(mpz_ptr, mpz_srcptr, mpz_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_fdiv_q_2exp __gmpz_fdiv_q_2exp
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_fdiv_q_2exp(mpz_ptr, mpz_srcptr, mp_bitcnt_t);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_fdiv_q_ui __gmpz_fdiv_q_ui
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC mpir_ui mpz_fdiv_q_ui(mpz_ptr, mpz_srcptr, mpir_ui);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_fdiv_qr __gmpz_fdiv_qr
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_fdiv_qr(mpz_ptr, mpz_ptr, mpz_srcptr, mpz_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_fdiv_qr_ui __gmpz_fdiv_qr_ui
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC mpir_ui mpz_fdiv_qr_ui(mpz_ptr, mpz_ptr, mpz_srcptr, mpir_ui);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_fdiv_r __gmpz_fdiv_r
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_fdiv_r(mpz_ptr, mpz_srcptr, mpz_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_fdiv_r_2exp __gmpz_fdiv_r_2exp
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_fdiv_r_2exp(mpz_ptr, mpz_srcptr, mp_bitcnt_t);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_fdiv_r_ui __gmpz_fdiv_r_ui
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC mpir_ui mpz_fdiv_r_ui(mpz_ptr, mpz_srcptr, mpir_ui);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_fdiv_ui __gmpz_fdiv_ui
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC mpir_ui mpz_fdiv_ui(mpz_srcptr, mpir_ui) __GMP_ATTRIBUTE_PURE;
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_fib_ui __gmpz_fib_ui
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_fib_ui(mpz_ptr, mpir_ui);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_fib2_ui __gmpz_fib2_ui
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_fib2_ui(mpz_ptr, mpz_ptr, mpir_ui);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_fits_sint_p __gmpz_fits_sint_p
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int mpz_fits_sint_p(mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
|
2008-04-17 17:03:07 -04:00
|
|
|
|
2011-12-16 14:47:56 -05:00
|
|
|
#define mpz_fits_si_p __gmpz_fits_si_p
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int mpz_fits_si_p(mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
|
2011-12-16 14:47:56 -05:00
|
|
|
|
2008-04-17 17:03:07 -04:00
|
|
|
#define mpz_fits_slong_p __gmpz_fits_slong_p
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int mpz_fits_slong_p(mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_fits_sshort_p __gmpz_fits_sshort_p
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int mpz_fits_sshort_p(mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_fits_uint_p __gmpz_fits_uint_p
|
2008-06-24 22:01:33 -04:00
|
|
|
#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_fits_uint_p)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int mpz_fits_uint_p(mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
|
2008-04-17 17:03:07 -04:00
|
|
|
#endif
|
|
|
|
|
2011-12-16 14:47:56 -05:00
|
|
|
#define mpz_fits_ui_p __gmpz_fits_ui_p
|
|
|
|
#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_fits_ui_p)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int mpz_fits_ui_p(mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
|
2011-12-16 14:47:56 -05:00
|
|
|
#endif
|
|
|
|
|
2008-04-17 17:03:07 -04:00
|
|
|
#define mpz_fits_ulong_p __gmpz_fits_ulong_p
|
2008-06-24 22:01:33 -04:00
|
|
|
#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_fits_ulong_p)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int mpz_fits_ulong_p(mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
|
2008-04-17 17:03:07 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#define mpz_fits_ushort_p __gmpz_fits_ushort_p
|
2008-06-24 22:01:33 -04:00
|
|
|
#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_fits_ushort_p)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int mpz_fits_ushort_p(mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
|
2008-04-17 17:03:07 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#define mpz_gcd __gmpz_gcd
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_gcd(mpz_ptr, mpz_srcptr, mpz_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_gcd_ui __gmpz_gcd_ui
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC mpir_ui mpz_gcd_ui(mpz_ptr, mpz_srcptr, mpir_ui);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_gcdext __gmpz_gcdext
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_gcdext(mpz_ptr, mpz_ptr, mpz_ptr, mpz_srcptr, mpz_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_get_d __gmpz_get_d
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC double mpz_get_d(mpz_srcptr) __GMP_ATTRIBUTE_PURE;
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_get_d_2exp __gmpz_get_d_2exp
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC double mpz_get_d_2exp(signed long *, mpz_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
2018-02-27 05:00:55 -05:00
|
|
|
#ifdef _MSC_VER
|
2018-01-25 12:30:22 -05:00
|
|
|
#define mpz_get_2exp_d __gmpz_get_2exp_d
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC mpir_si mpz_get_2exp_d(double *, mpz_srcptr);
|
2018-02-27 05:00:55 -05:00
|
|
|
#endif
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_get_si __gmpz_get_si
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC /* signed */ mpir_si mpz_get_si(mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_get_str __gmpz_get_str
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC char *mpz_get_str(char *, int, mpz_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_get_ui __gmpz_get_ui
|
2008-06-24 22:01:33 -04:00
|
|
|
#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_get_ui)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC mpir_ui mpz_get_ui(mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
|
2008-04-17 17:03:07 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#define mpz_getlimbn __gmpz_getlimbn
|
2008-06-24 22:01:33 -04:00
|
|
|
#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_getlimbn)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC mp_limb_t mpz_getlimbn(mpz_srcptr, mp_size_t) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
|
2008-04-17 17:03:07 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#define mpz_hamdist __gmpz_hamdist
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC mp_bitcnt_t mpz_hamdist(mpz_srcptr, mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_import __gmpz_import
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_import(mpz_ptr, size_t, int, size_t, int, size_t, __gmp_const void *);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_init __gmpz_init
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_init(mpz_ptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_init2 __gmpz_init2
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_init2(mpz_ptr, mp_bitcnt_t);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
2010-02-11 10:54:59 -05:00
|
|
|
#define mpz_inits __gmpz_inits
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_inits(mpz_ptr, ...);
|
2010-02-11 10:54:59 -05:00
|
|
|
|
2008-04-17 17:03:07 -04:00
|
|
|
#define mpz_init_set __gmpz_init_set
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_init_set(mpz_ptr, mpz_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_init_set_d __gmpz_init_set_d
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_init_set_d(mpz_ptr, double);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_init_set_si __gmpz_init_set_si
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_init_set_si(mpz_ptr, mpir_si);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_init_set_str __gmpz_init_set_str
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int mpz_init_set_str(mpz_ptr, __gmp_const char *, int);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_init_set_ui __gmpz_init_set_ui
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_init_set_ui(mpz_ptr, mpir_ui);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_inp_raw __gmpz_inp_raw
|
|
|
|
#ifdef _GMP_H_HAVE_FILE
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC size_t mpz_inp_raw(mpz_ptr, FILE *);
|
2008-04-17 17:03:07 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#define mpz_inp_str __gmpz_inp_str
|
|
|
|
#ifdef _GMP_H_HAVE_FILE
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC size_t mpz_inp_str(mpz_ptr, FILE *, int);
|
2008-04-17 17:03:07 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#define mpz_invert __gmpz_invert
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int mpz_invert(mpz_ptr, mpz_srcptr, mpz_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_ior __gmpz_ior
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_ior(mpz_ptr, mpz_srcptr, mpz_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_jacobi __gmpz_jacobi
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int mpz_jacobi(mpz_srcptr, mpz_srcptr) __GMP_ATTRIBUTE_PURE;
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_kronecker mpz_jacobi /* alias */
|
|
|
|
|
|
|
|
#define mpz_kronecker_si __gmpz_kronecker_si
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int mpz_kronecker_si(mpz_srcptr, mpir_si) __GMP_ATTRIBUTE_PURE;
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_kronecker_ui __gmpz_kronecker_ui
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int mpz_kronecker_ui(mpz_srcptr, mpir_ui) __GMP_ATTRIBUTE_PURE;
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_si_kronecker __gmpz_si_kronecker
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int mpz_si_kronecker(mpir_si, mpz_srcptr) __GMP_ATTRIBUTE_PURE;
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_ui_kronecker __gmpz_ui_kronecker
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int mpz_ui_kronecker(mpir_ui, mpz_srcptr) __GMP_ATTRIBUTE_PURE;
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_lcm __gmpz_lcm
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_lcm(mpz_ptr, mpz_srcptr, mpz_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_lcm_ui __gmpz_lcm_ui
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_lcm_ui(mpz_ptr, mpz_srcptr, mpir_ui);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_legendre mpz_jacobi /* alias */
|
|
|
|
|
|
|
|
#define mpz_lucnum_ui __gmpz_lucnum_ui
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_lucnum_ui(mpz_ptr, mpir_ui);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_lucnum2_ui __gmpz_lucnum2_ui
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_lucnum2_ui(mpz_ptr, mpz_ptr, mpir_ui);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_millerrabin __gmpz_millerrabin
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int mpz_millerrabin(mpz_srcptr, int) __GMP_ATTRIBUTE_PURE;
|
2008-04-17 17:03:07 -04:00
|
|
|
|
2011-12-04 13:43:13 -05:00
|
|
|
#define mpz_miller_rabin __gmpz_miller_rabin
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int mpz_miller_rabin(mpz_srcptr, int, gmp_randstate_t) __GMP_ATTRIBUTE_PURE;
|
2011-12-04 13:43:13 -05:00
|
|
|
|
2008-04-17 17:03:07 -04:00
|
|
|
#define mpz_mod __gmpz_mod
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_mod(mpz_ptr, mpz_srcptr, mpz_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_mod_ui mpz_fdiv_r_ui /* same as fdiv_r because divisor unsigned */
|
|
|
|
|
2009-09-09 01:39:14 -04:00
|
|
|
#define __GMP_MPZ_MUL_MIN_ALLOC(x,y,z) (__GMP_ABS(y->_mp_size)+__GMP_ABS(z->_mp_size)+1)
|
2008-04-17 17:03:07 -04:00
|
|
|
#define mpz_mul __gmpz_mul
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_mul(mpz_ptr, mpz_srcptr, mpz_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_mul_2exp __gmpz_mul_2exp
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_mul_2exp(mpz_ptr, mpz_srcptr, mp_bitcnt_t);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
2011-12-16 14:47:56 -05:00
|
|
|
#define __GMP_MPZ_MUL_SI_MIN_ALLOC(x,y,z) (__GMP_ABS(y->_mp_size)+(GMP_BITS_PER_UI-1)/GMP_NUMB_BITS+1)
|
2008-04-17 17:03:07 -04:00
|
|
|
#define mpz_mul_si __gmpz_mul_si
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_mul_si(mpz_ptr, mpz_srcptr, mpir_si);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
2011-12-16 14:47:56 -05:00
|
|
|
#define __GMP_MPZ_MUL_UI_MIN_ALLOC(x,y,z) (__GMP_ABS(y->_mp_size)+(GMP_BITS_PER_UI-1)/GMP_NUMB_BITS+1)
|
2008-04-17 17:03:07 -04:00
|
|
|
#define mpz_mul_ui __gmpz_mul_ui
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_mul_ui(mpz_ptr, mpz_srcptr, mpir_ui);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_neg __gmpz_neg
|
2009-09-08 17:15:29 -04:00
|
|
|
#define __GMP_MPZ_NEG_MIN_ALLOC(x,y) (__GMP_ABS(y->_mp_size))
|
2008-06-24 22:01:33 -04:00
|
|
|
#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_neg)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_neg(mpz_ptr, mpz_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#define mpz_nextprime __gmpz_nextprime
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_nextprime(mpz_ptr, mpz_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
2013-09-02 10:10:16 -04:00
|
|
|
#define mpz_next_prime_candidate __gmpz_next_prime_candidate
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_next_prime_candidate(mpz_ptr, mpz_srcptr, gmp_randstate_t);
|
2009-08-17 05:03:35 -04:00
|
|
|
|
2008-04-17 17:03:07 -04:00
|
|
|
#define mpz_out_raw __gmpz_out_raw
|
|
|
|
#ifdef _GMP_H_HAVE_FILE
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC size_t mpz_out_raw(FILE *, mpz_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#define mpz_out_str __gmpz_out_str
|
|
|
|
#ifdef _GMP_H_HAVE_FILE
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC size_t mpz_out_str(FILE *, int, mpz_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#define mpz_perfect_power_p __gmpz_perfect_power_p
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int mpz_perfect_power_p(mpz_srcptr) __GMP_ATTRIBUTE_PURE;
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_perfect_square_p __gmpz_perfect_square_p
|
2008-06-24 22:01:33 -04:00
|
|
|
#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_perfect_square_p)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int mpz_perfect_square_p(mpz_srcptr) __GMP_ATTRIBUTE_PURE;
|
2008-04-17 17:03:07 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#define mpz_popcount __gmpz_popcount
|
2008-06-24 22:01:33 -04:00
|
|
|
#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_popcount)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC mp_bitcnt_t mpz_popcount(mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
|
2008-04-17 17:03:07 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#define mpz_pow_ui __gmpz_pow_ui
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_pow_ui(mpz_ptr, mpz_srcptr, mpir_ui);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_powm __gmpz_powm
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_powm(mpz_ptr, mpz_srcptr, mpz_srcptr, mpz_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_powm_ui __gmpz_powm_ui
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_powm_ui(mpz_ptr, mpz_srcptr, mpir_ui, mpz_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_probab_prime_p __gmpz_probab_prime_p
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int mpz_probab_prime_p(mpz_srcptr, int) __GMP_ATTRIBUTE_PURE;
|
2008-04-17 17:03:07 -04:00
|
|
|
|
2009-09-03 22:20:31 -04:00
|
|
|
#define mpz_probable_prime_p __gmpz_probable_prime_p
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int mpz_probable_prime_p(mpz_srcptr,gmp_randstate_t, int, mpir_ui);
|
2009-09-03 22:20:31 -04:00
|
|
|
|
2009-09-07 11:49:49 -04:00
|
|
|
#define mpz_likely_prime_p __gmpz_likely_prime_p
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int mpz_likely_prime_p(mpz_srcptr,gmp_randstate_t, mpir_ui);
|
2009-09-03 22:20:31 -04:00
|
|
|
|
2008-04-17 17:03:07 -04:00
|
|
|
#define mpz_realloc2 __gmpz_realloc2
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_realloc2(mpz_ptr, mp_bitcnt_t);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_remove __gmpz_remove
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC mp_bitcnt_t mpz_remove(mpz_ptr, mpz_srcptr, mpz_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_root __gmpz_root
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int mpz_root(mpz_ptr, mpz_srcptr, mpir_ui);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
2010-04-04 14:18:25 -04:00
|
|
|
#define mpz_nthroot __gmpz_nthroot
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_nthroot(mpz_ptr, mpz_srcptr, mpir_ui);
|
2010-04-04 14:18:25 -04:00
|
|
|
|
2008-04-17 17:03:07 -04:00
|
|
|
#define mpz_rootrem __gmpz_rootrem
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_rootrem(mpz_ptr,mpz_ptr, mpz_srcptr, mpir_ui);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_rrandomb __gmpz_rrandomb
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_rrandomb(mpz_ptr, gmp_randstate_t, mp_bitcnt_t);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_scan0 __gmpz_scan0
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC mp_bitcnt_t mpz_scan0(mpz_srcptr, mp_bitcnt_t) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_scan1 __gmpz_scan1
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC mp_bitcnt_t mpz_scan1(mpz_srcptr, mp_bitcnt_t) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
|
2008-04-17 17:03:07 -04:00
|
|
|
|
2009-09-09 01:39:14 -04:00
|
|
|
#define __GMP_MPZ_SET_MIN_ALLOC(x,y) __GMP_ABS(y->_mp_size)
|
2008-04-17 17:03:07 -04:00
|
|
|
#define mpz_set __gmpz_set
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_set(mpz_ptr, mpz_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_set_d __gmpz_set_d
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_set_d(mpz_ptr, double);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_set_f __gmpz_set_f
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_set_f(mpz_ptr, mpf_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_set_q __gmpz_set_q
|
2008-06-24 22:01:33 -04:00
|
|
|
#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_set_q)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_set_q(mpz_ptr, mpq_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
#endif
|
|
|
|
|
2011-12-16 14:47:56 -05:00
|
|
|
#define __GMP_MPZ_SET_SI_MIN_ALLOC(x,y) (1+(GMP_BITS_PER_UI-1)/GMP_NUMB_BITS)
|
2008-04-17 17:03:07 -04:00
|
|
|
#define mpz_set_si __gmpz_set_si
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_set_si(mpz_ptr, mpir_si);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_set_str __gmpz_set_str
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int mpz_set_str(mpz_ptr, __gmp_const char *, int);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
2011-12-16 14:47:56 -05:00
|
|
|
#define __GMP_MPZ_SET_UI_MIN_ALLOC(x,y) (1+(GMP_BITS_PER_UI-1)/GMP_NUMB_BITS)
|
2008-04-17 17:03:07 -04:00
|
|
|
#define mpz_set_ui __gmpz_set_ui
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_set_ui(mpz_ptr, mpir_ui);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_setbit __gmpz_setbit
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_setbit(mpz_ptr, mp_bitcnt_t);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_size __gmpz_size
|
2008-06-24 22:01:33 -04:00
|
|
|
#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_size)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC size_t mpz_size(mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
|
2008-04-17 17:03:07 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#define mpz_sizeinbase __gmpz_sizeinbase
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC size_t mpz_sizeinbase(mpz_srcptr, int) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_sqrt __gmpz_sqrt
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_sqrt(mpz_ptr, mpz_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_sqrtrem __gmpz_sqrtrem
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_sqrtrem(mpz_ptr, mpz_ptr, mpz_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
2009-09-08 17:15:29 -04:00
|
|
|
#define __GMP_MPZ_SUB_MIN_ALLOC(x,y,z) (__GMP_MAX(__GMP_ABS(y->_mp_size),__GMP_ABS(z->_mp_size))+1)
|
2008-04-17 17:03:07 -04:00
|
|
|
#define mpz_sub __gmpz_sub
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_sub(mpz_ptr, mpz_srcptr, mpz_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
2011-12-16 14:47:56 -05:00
|
|
|
#define __GMP_MPZ_SUB_UI_MIN_ALLOC(x,y,z) (__GMP_MAX(__GMP_ABS(y->_mp_size),1+(GMP_BITS_PER_UI-1)/GMP_NUMB_BITS)+1)
|
2008-04-17 17:03:07 -04:00
|
|
|
#define mpz_sub_ui __gmpz_sub_ui
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_sub_ui(mpz_ptr, mpz_srcptr, mpir_ui);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
2011-12-16 14:47:56 -05:00
|
|
|
#define __GMP_MPZ_UI_SUB_MIN_ALLOC(x,y,z) (__GMP_MAX(__GMP_ABS(z->_mp_size),1+(GMP_BITS_PER_UI-1)/GMP_NUMB_BITS)+1)
|
2008-04-17 17:03:07 -04:00
|
|
|
#define mpz_ui_sub __gmpz_ui_sub
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_ui_sub(mpz_ptr, mpir_ui, mpz_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_submul __gmpz_submul
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_submul(mpz_ptr, mpz_srcptr, mpz_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_submul_ui __gmpz_submul_ui
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_submul_ui(mpz_ptr, mpz_srcptr, mpir_ui);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_swap __gmpz_swap
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_swap(mpz_ptr, mpz_ptr) __GMP_NOTHROW;
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_tdiv_ui __gmpz_tdiv_ui
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC mpir_ui mpz_tdiv_ui(mpz_srcptr, mpir_ui) __GMP_ATTRIBUTE_PURE;
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_tdiv_q __gmpz_tdiv_q
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_tdiv_q(mpz_ptr, mpz_srcptr, mpz_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_tdiv_q_2exp __gmpz_tdiv_q_2exp
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_tdiv_q_2exp(mpz_ptr, mpz_srcptr, mp_bitcnt_t);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_tdiv_q_ui __gmpz_tdiv_q_ui
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC mpir_ui mpz_tdiv_q_ui(mpz_ptr, mpz_srcptr, mpir_ui);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_tdiv_qr __gmpz_tdiv_qr
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_tdiv_qr(mpz_ptr, mpz_ptr, mpz_srcptr, mpz_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_tdiv_qr_ui __gmpz_tdiv_qr_ui
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC mpir_ui mpz_tdiv_qr_ui(mpz_ptr, mpz_ptr, mpz_srcptr, mpir_ui);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_tdiv_r __gmpz_tdiv_r
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_tdiv_r(mpz_ptr, mpz_srcptr, mpz_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_tdiv_r_2exp __gmpz_tdiv_r_2exp
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_tdiv_r_2exp(mpz_ptr, mpz_srcptr, mp_bitcnt_t);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_tdiv_r_ui __gmpz_tdiv_r_ui
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC mpir_ui mpz_tdiv_r_ui(mpz_ptr, mpz_srcptr, mpir_ui);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_tstbit __gmpz_tstbit
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int mpz_tstbit(mpz_srcptr, mp_bitcnt_t) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_ui_pow_ui __gmpz_ui_pow_ui
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_ui_pow_ui(mpz_ptr, mpir_ui, mpir_ui);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_urandomb __gmpz_urandomb
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_urandomb(mpz_ptr, gmp_randstate_t, mp_bitcnt_t);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_urandomm __gmpz_urandomm
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_urandomm(mpz_ptr, gmp_randstate_t, mpz_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpz_xor __gmpz_xor
|
|
|
|
#define mpz_eor __gmpz_xor
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_xor(mpz_ptr, mpz_srcptr, mpz_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
2017-02-09 09:54:10 -05:00
|
|
|
#define mpz_limbs_read __gmpz_limbs_read
|
|
|
|
__GMP_DECLSPEC mp_srcptr mpz_limbs_read (mpz_srcptr);
|
|
|
|
|
|
|
|
#define mpz_limbs_write __gmpz_limbs_write
|
|
|
|
__GMP_DECLSPEC mp_ptr mpz_limbs_write (mpz_ptr, mp_size_t);
|
|
|
|
|
|
|
|
#define mpz_limbs_modify __gmpz_limbs_modify
|
|
|
|
__GMP_DECLSPEC mp_ptr mpz_limbs_modify (mpz_ptr, mp_size_t);
|
|
|
|
|
|
|
|
#define mpz_limbs_finish __gmpz_limbs_finish
|
|
|
|
__GMP_DECLSPEC void mpz_limbs_finish (mpz_ptr, mp_size_t);
|
|
|
|
|
|
|
|
#define mpz_roinit_n __gmpz_roinit_n
|
|
|
|
__GMP_DECLSPEC mpz_srcptr mpz_roinit_n (mpz_ptr, mp_srcptr, mp_size_t);
|
|
|
|
|
2015-11-02 10:11:55 -05:00
|
|
|
#define MPZ_ROINIT_N(xp, xs) {{0, (xs),(xp) }}
|
2008-04-17 17:03:07 -04:00
|
|
|
|
2011-03-14 11:51:54 -04:00
|
|
|
/****** Integer (i.e. Z) routines for intmaax_t/uintmax_t types ******/
|
|
|
|
|
2018-02-07 17:23:54 -05:00
|
|
|
/* if stdint.h is available -- n.b: we do NOT include stdint.h on old compilers */
|
|
|
|
/* we DO (safely) include stdint.h on modern compilers supporting __has_include() */
|
2015-06-13 14:39:18 -04:00
|
|
|
#if defined(INTMAX_MAX)
|
2011-03-14 11:51:54 -04:00
|
|
|
|
|
|
|
#define __GMP_BITS_PER_UINTMAX (8*sizeof(uintmax_t))
|
|
|
|
|
|
|
|
#define mpz_get_ux __gmpz_get_ux
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC uintmax_t mpz_get_ux(mpz_srcptr);
|
2011-03-14 11:51:54 -04:00
|
|
|
|
|
|
|
#define mpz_get_sx __gmpz_get_sx
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC intmax_t mpz_get_sx(mpz_srcptr);
|
2011-03-14 11:51:54 -04:00
|
|
|
|
|
|
|
#define mpz_set_ux __gmpz_set_ux
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_set_ux(mpz_ptr, uintmax_t);
|
2011-03-14 11:51:54 -04:00
|
|
|
|
|
|
|
#define mpz_set_sx __gmpz_set_sx
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_set_sx(mpz_ptr, intmax_t);
|
2011-03-14 11:51:54 -04:00
|
|
|
|
|
|
|
#define mpz_init_set_ux __gmpz_init_set_ux
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_init_set_ux(mpz_ptr, uintmax_t);
|
2011-03-14 11:51:54 -04:00
|
|
|
|
|
|
|
#define mpz_init_set_sx __gmpz_init_set_sx
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpz_init_set_sx(mpz_ptr, intmax_t);
|
2011-03-14 11:51:54 -04:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2008-04-17 17:03:07 -04:00
|
|
|
/**************** Rational (i.e. Q) routines. ****************/
|
|
|
|
|
|
|
|
#define mpq_abs __gmpq_abs
|
2008-06-24 22:01:33 -04:00
|
|
|
#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpq_abs)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpq_abs(mpq_ptr, mpq_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#define mpq_add __gmpq_add
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpq_add(mpq_ptr, mpq_srcptr, mpq_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpq_canonicalize __gmpq_canonicalize
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpq_canonicalize(mpq_ptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpq_clear __gmpq_clear
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpq_clear(mpq_ptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
2010-02-11 10:54:59 -05:00
|
|
|
#define mpq_clears __gmpq_clears
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpq_clears(mpq_ptr, ...);
|
2010-02-11 10:54:59 -05:00
|
|
|
|
2008-04-17 17:03:07 -04:00
|
|
|
#define mpq_cmp __gmpq_cmp
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int mpq_cmp(mpq_srcptr, mpq_srcptr) __GMP_ATTRIBUTE_PURE;
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define _mpq_cmp_si __gmpq_cmp_si
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int _mpq_cmp_si(mpq_srcptr, mpir_si, mpir_ui) __GMP_ATTRIBUTE_PURE;
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define _mpq_cmp_ui __gmpq_cmp_ui
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int _mpq_cmp_ui(mpq_srcptr, mpir_ui, mpir_ui) __GMP_ATTRIBUTE_PURE;
|
2008-04-17 17:03:07 -04:00
|
|
|
|
2015-11-02 10:11:55 -05:00
|
|
|
#define mpq_cmp_z __gmpq_cmp_z
|
|
|
|
__GMP_DECLSPEC int mpq_cmp_z (mpq_srcptr, mpz_srcptr) __GMP_ATTRIBUTE_PURE;
|
|
|
|
|
2008-04-17 17:03:07 -04:00
|
|
|
#define mpq_div __gmpq_div
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpq_div(mpq_ptr, mpq_srcptr, mpq_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpq_div_2exp __gmpq_div_2exp
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpq_div_2exp(mpq_ptr, mpq_srcptr, mp_bitcnt_t);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpq_equal __gmpq_equal
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int mpq_equal(mpq_srcptr, mpq_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpq_get_num __gmpq_get_num
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpq_get_num(mpz_ptr, mpq_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpq_get_den __gmpq_get_den
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpq_get_den(mpz_ptr, mpq_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpq_get_d __gmpq_get_d
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC double mpq_get_d(mpq_srcptr) __GMP_ATTRIBUTE_PURE;
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpq_get_str __gmpq_get_str
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC char *mpq_get_str(char *, int, mpq_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpq_init __gmpq_init
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpq_init(mpq_ptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
2010-02-11 10:54:59 -05:00
|
|
|
#define mpq_inits __gmpq_inits
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpq_inits(mpq_ptr, ...);
|
2010-02-11 10:54:59 -05:00
|
|
|
|
2008-04-17 17:03:07 -04:00
|
|
|
#define mpq_inp_str __gmpq_inp_str
|
|
|
|
#ifdef _GMP_H_HAVE_FILE
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC size_t mpq_inp_str(mpq_ptr, FILE *, int);
|
2008-04-17 17:03:07 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#define mpq_inv __gmpq_inv
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpq_inv(mpq_ptr, mpq_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpq_mul __gmpq_mul
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpq_mul(mpq_ptr, mpq_srcptr, mpq_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpq_mul_2exp __gmpq_mul_2exp
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpq_mul_2exp(mpq_ptr, mpq_srcptr, mp_bitcnt_t);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpq_neg __gmpq_neg
|
2008-06-24 22:01:33 -04:00
|
|
|
#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpq_neg)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpq_neg(mpq_ptr, mpq_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#define mpq_out_str __gmpq_out_str
|
|
|
|
#ifdef _GMP_H_HAVE_FILE
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC size_t mpq_out_str(FILE *, int, mpq_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#define mpq_set __gmpq_set
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpq_set(mpq_ptr, mpq_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpq_set_d __gmpq_set_d
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpq_set_d(mpq_ptr, double);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpq_set_den __gmpq_set_den
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpq_set_den(mpq_ptr, mpz_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpq_set_f __gmpq_set_f
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpq_set_f(mpq_ptr, mpf_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpq_set_num __gmpq_set_num
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpq_set_num(mpq_ptr, mpz_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpq_set_si __gmpq_set_si
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpq_set_si(mpq_ptr, mpir_si, mpir_ui);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpq_set_str __gmpq_set_str
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int mpq_set_str(mpq_ptr, __gmp_const char *, int);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpq_set_ui __gmpq_set_ui
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpq_set_ui(mpq_ptr, mpir_ui, mpir_ui);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpq_set_z __gmpq_set_z
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpq_set_z(mpq_ptr, mpz_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpq_sub __gmpq_sub
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpq_sub(mpq_ptr, mpq_srcptr, mpq_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpq_swap __gmpq_swap
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpq_swap(mpq_ptr, mpq_ptr) __GMP_NOTHROW;
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
|
|
|
|
/**************** Float (i.e. F) routines. ****************/
|
|
|
|
|
|
|
|
#define mpf_abs __gmpf_abs
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpf_abs(mpf_ptr, mpf_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpf_add __gmpf_add
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpf_add(mpf_ptr, mpf_srcptr, mpf_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpf_add_ui __gmpf_add_ui
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpf_add_ui(mpf_ptr, mpf_srcptr, mpir_ui);
|
2008-04-17 17:03:07 -04:00
|
|
|
#define mpf_ceil __gmpf_ceil
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpf_ceil(mpf_ptr, mpf_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpf_clear __gmpf_clear
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpf_clear(mpf_ptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
2010-02-11 10:54:59 -05:00
|
|
|
#define mpf_clears __gmpf_clears
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpf_clears(mpf_ptr, ...);
|
2010-02-11 10:54:59 -05:00
|
|
|
|
2008-04-17 17:03:07 -04:00
|
|
|
#define mpf_cmp __gmpf_cmp
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int mpf_cmp(mpf_srcptr, mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
|
2008-04-17 17:03:07 -04:00
|
|
|
|
2018-02-26 12:25:45 -05:00
|
|
|
#define mpf_cmp_z __gmpf_cmp_z
|
|
|
|
__GMP_DECLSPEC int mpf_cmp_z (mpf_srcptr, mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpf_cmp_d __gmpf_cmp_d
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int mpf_cmp_d(mpf_srcptr, double) __GMP_ATTRIBUTE_PURE;
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpf_cmp_si __gmpf_cmp_si
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int mpf_cmp_si(mpf_srcptr, mpir_si) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpf_cmp_ui __gmpf_cmp_ui
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int mpf_cmp_ui(mpf_srcptr, mpir_ui) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpf_div __gmpf_div
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpf_div(mpf_ptr, mpf_srcptr, mpf_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpf_div_2exp __gmpf_div_2exp
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpf_div_2exp(mpf_ptr, mpf_srcptr, mp_bitcnt_t);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpf_div_ui __gmpf_div_ui
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpf_div_ui(mpf_ptr, mpf_srcptr, mpir_ui);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpf_dump __gmpf_dump
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpf_dump(mpf_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpf_eq __gmpf_eq
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int mpf_eq(mpf_srcptr, mpf_srcptr, mp_bitcnt_t) __GMP_ATTRIBUTE_PURE;
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpf_fits_sint_p __gmpf_fits_sint_p
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int mpf_fits_sint_p(mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
|
2008-04-17 17:03:07 -04:00
|
|
|
|
2011-12-16 14:47:56 -05:00
|
|
|
#define mpf_fits_si_p __gmpf_fits_si_p
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int mpf_fits_si_p(mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
|
2011-12-16 14:47:56 -05:00
|
|
|
|
2008-04-17 17:03:07 -04:00
|
|
|
#define mpf_fits_slong_p __gmpf_fits_slong_p
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int mpf_fits_slong_p(mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpf_fits_sshort_p __gmpf_fits_sshort_p
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int mpf_fits_sshort_p(mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpf_fits_uint_p __gmpf_fits_uint_p
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int mpf_fits_uint_p(mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
|
2008-04-17 17:03:07 -04:00
|
|
|
|
2011-12-16 14:47:56 -05:00
|
|
|
#define mpf_fits_ui_p __gmpf_fits_ui_p
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int mpf_fits_ui_p(mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
|
2011-12-16 14:47:56 -05:00
|
|
|
|
2008-04-17 17:03:07 -04:00
|
|
|
#define mpf_fits_ulong_p __gmpf_fits_ulong_p
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int mpf_fits_ulong_p(mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpf_fits_ushort_p __gmpf_fits_ushort_p
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int mpf_fits_ushort_p(mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpf_floor __gmpf_floor
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpf_floor(mpf_ptr, mpf_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpf_get_d __gmpf_get_d
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC double mpf_get_d(mpf_srcptr) __GMP_ATTRIBUTE_PURE;
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpf_get_d_2exp __gmpf_get_d_2exp
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC double mpf_get_d_2exp(signed long *, mpf_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
2018-02-27 05:00:55 -05:00
|
|
|
#ifdef _MSC_VER
|
2018-01-25 12:30:22 -05:00
|
|
|
#define mpf_get_2exp_d __gmpf_get_2exp_d
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC mpir_si mpf_get_2exp_d(double *, mpf_srcptr);
|
2018-02-27 05:00:55 -05:00
|
|
|
#endif
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpf_get_default_prec __gmpf_get_default_prec
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC mp_bitcnt_t mpf_get_default_prec(void) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpf_get_prec __gmpf_get_prec
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC mp_bitcnt_t mpf_get_prec(mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpf_get_si __gmpf_get_si
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC mpir_si mpf_get_si(mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpf_get_str __gmpf_get_str
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC char *mpf_get_str(char *, mp_exp_t *, int, size_t, mpf_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpf_get_ui __gmpf_get_ui
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC mpir_ui mpf_get_ui(mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpf_init __gmpf_init
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpf_init(mpf_ptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpf_init2 __gmpf_init2
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpf_init2(mpf_ptr, mp_bitcnt_t);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
2010-02-11 10:54:59 -05:00
|
|
|
#define mpf_inits __gmpf_inits
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpf_inits(mpf_ptr, ...);
|
2010-02-11 10:54:59 -05:00
|
|
|
|
2008-04-17 17:03:07 -04:00
|
|
|
#define mpf_init_set __gmpf_init_set
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpf_init_set(mpf_ptr, mpf_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpf_init_set_d __gmpf_init_set_d
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpf_init_set_d(mpf_ptr, double);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpf_init_set_si __gmpf_init_set_si
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpf_init_set_si(mpf_ptr, mpir_si);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpf_init_set_str __gmpf_init_set_str
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int mpf_init_set_str(mpf_ptr, __gmp_const char *, int);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpf_init_set_ui __gmpf_init_set_ui
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpf_init_set_ui(mpf_ptr, mpir_ui);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpf_inp_str __gmpf_inp_str
|
|
|
|
#ifdef _GMP_H_HAVE_FILE
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC size_t mpf_inp_str(mpf_ptr, FILE *, int);
|
2008-04-17 17:03:07 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#define mpf_integer_p __gmpf_integer_p
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int mpf_integer_p(mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpf_mul __gmpf_mul
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpf_mul(mpf_ptr, mpf_srcptr, mpf_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpf_mul_2exp __gmpf_mul_2exp
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpf_mul_2exp(mpf_ptr, mpf_srcptr, mp_bitcnt_t);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpf_mul_ui __gmpf_mul_ui
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpf_mul_ui(mpf_ptr, mpf_srcptr, mpir_ui);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpf_neg __gmpf_neg
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpf_neg(mpf_ptr, mpf_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpf_out_str __gmpf_out_str
|
|
|
|
#ifdef _GMP_H_HAVE_FILE
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC size_t mpf_out_str(FILE *, int, size_t, mpf_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#define mpf_pow_ui __gmpf_pow_ui
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpf_pow_ui(mpf_ptr, mpf_srcptr, mpir_ui);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpf_random2 __gmpf_random2
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpf_random2(mpf_ptr, mp_size_t, mp_exp_t);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
2009-09-14 10:28:27 -04:00
|
|
|
#define mpf_rrandomb __gmpf_rrandomb
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpf_rrandomb(mpf_ptr, gmp_randstate_t, mp_size_t, mp_exp_t);
|
2009-09-14 10:28:27 -04:00
|
|
|
|
2008-04-17 17:03:07 -04:00
|
|
|
#define mpf_reldiff __gmpf_reldiff
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpf_reldiff(mpf_ptr, mpf_srcptr, mpf_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpf_set __gmpf_set
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpf_set(mpf_ptr, mpf_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpf_set_d __gmpf_set_d
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpf_set_d(mpf_ptr, double);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpf_set_default_prec __gmpf_set_default_prec
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpf_set_default_prec(mp_bitcnt_t) __GMP_NOTHROW;
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpf_set_prec __gmpf_set_prec
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpf_set_prec(mpf_ptr, mp_bitcnt_t);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpf_set_prec_raw __gmpf_set_prec_raw
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpf_set_prec_raw(mpf_ptr, mp_bitcnt_t) __GMP_NOTHROW;
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpf_set_q __gmpf_set_q
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpf_set_q(mpf_ptr, mpq_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpf_set_si __gmpf_set_si
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpf_set_si(mpf_ptr, mpir_si);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpf_set_str __gmpf_set_str
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int mpf_set_str(mpf_ptr, __gmp_const char *, int);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpf_set_ui __gmpf_set_ui
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpf_set_ui(mpf_ptr, mpir_ui);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpf_set_z __gmpf_set_z
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpf_set_z(mpf_ptr, mpz_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpf_size __gmpf_size
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC size_t mpf_size(mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpf_sqrt __gmpf_sqrt
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpf_sqrt(mpf_ptr, mpf_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpf_sqrt_ui __gmpf_sqrt_ui
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpf_sqrt_ui(mpf_ptr, mpir_ui);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpf_sub __gmpf_sub
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpf_sub(mpf_ptr, mpf_srcptr, mpf_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpf_sub_ui __gmpf_sub_ui
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpf_sub_ui(mpf_ptr, mpf_srcptr, mpir_ui);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpf_swap __gmpf_swap
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpf_swap(mpf_ptr, mpf_ptr) __GMP_NOTHROW;
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpf_trunc __gmpf_trunc
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpf_trunc(mpf_ptr, mpf_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpf_ui_div __gmpf_ui_div
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpf_ui_div(mpf_ptr, mpir_ui, mpf_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpf_ui_sub __gmpf_ui_sub
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpf_ui_sub(mpf_ptr, mpir_ui, mpf_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpf_urandomb __gmpf_urandomb
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpf_urandomb(mpf_t, gmp_randstate_t, mp_bitcnt_t);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
|
|
|
|
/************ Low level positive-integer (i.e. N) routines. ************/
|
|
|
|
|
|
|
|
/* This is ugly, but we need to make user calls reach the prefixed function. */
|
|
|
|
|
|
|
|
#define mpn_add __MPN(add)
|
2008-06-24 22:01:33 -04:00
|
|
|
#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpn_add)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC mp_limb_t mpn_add(mp_ptr, mp_srcptr, mp_size_t, mp_srcptr,mp_size_t);
|
2008-04-17 17:03:07 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#define mpn_add_1 __MPN(add_1)
|
2008-06-24 22:01:33 -04:00
|
|
|
#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpn_add_1)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC mp_limb_t mpn_add_1(mp_ptr, mp_srcptr, mp_size_t, mp_limb_t) __GMP_NOTHROW;
|
2008-04-17 17:03:07 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#define mpn_add_n __MPN(add_n)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC mp_limb_t mpn_add_n(mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpn_addmul_1 __MPN(addmul_1)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC mp_limb_t mpn_addmul_1(mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpn_bdivmod __MPN(bdivmod)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC mp_limb_t mpn_bdivmod(mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mpir_ui);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
2009-09-08 22:07:02 -04:00
|
|
|
#define mpn_divrem __MPN(divrem)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC mp_limb_t mpn_divrem(mp_ptr, mp_size_t, mp_ptr, mp_size_t, mp_srcptr, mp_size_t);
|
2009-09-08 22:07:02 -04:00
|
|
|
|
2012-10-29 10:15:11 -04:00
|
|
|
#define mpn_mulmod_Bexpp1 __MPN(mulmod_Bexpp1)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int mpn_mulmod_Bexpp1(mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_ptr);
|
2009-09-08 23:41:37 -04:00
|
|
|
|
2012-10-29 10:15:11 -04:00
|
|
|
#define mpn_mulmod_2expp1 __MPN(mulmod_2expp1_basecase)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int mpn_mulmod_2expp1(mp_ptr, mp_srcptr, mp_srcptr,int,mpir_ui, mp_ptr);
|
2012-10-29 10:15:11 -04:00
|
|
|
|
2009-09-08 23:41:37 -04:00
|
|
|
#define mpn_mulmod_2expm1 __MPN(mulmod_2expm1)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpn_mulmod_2expm1(mp_ptr, mp_ptr, mp_ptr, mpir_ui, mp_ptr);
|
2009-09-08 23:41:37 -04:00
|
|
|
|
2008-04-17 17:03:07 -04:00
|
|
|
#define mpn_cmp __MPN(cmp)
|
2008-06-24 22:01:33 -04:00
|
|
|
#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpn_cmp)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int mpn_cmp(mp_srcptr, mp_srcptr, mp_size_t) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
|
2008-04-17 17:03:07 -04:00
|
|
|
#endif
|
|
|
|
|
2010-12-15 21:32:35 -05:00
|
|
|
#define mpn_redc_1 __MPN(redc_1)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpn_redc_1(mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
|
2010-12-15 21:32:35 -05:00
|
|
|
|
2012-03-10 04:38:09 -05:00
|
|
|
#define mpn_redc_2 __MPN(redc_2)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpn_redc_2(mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_srcptr);
|
2014-04-30 10:14:11 -04:00
|
|
|
|
2018-02-26 12:25:45 -05:00
|
|
|
#define mpn_zero_p __MPN(zero_p)
|
|
|
|
#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpn_zero_p)
|
|
|
|
__GMP_DECLSPEC int mpn_zero_p (mp_srcptr, mp_size_t) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
|
|
|
|
#endif
|
2014-04-30 10:14:11 -04:00
|
|
|
|
2018-02-26 12:25:45 -05:00
|
|
|
#define mpn_divexact_1 __MPN(divexact_1)
|
|
|
|
__GMP_DECLSPEC void mpn_divexact_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
|
2012-03-10 04:38:09 -05:00
|
|
|
#define mpn_redc_n __MPN(redc_n)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpn_redc_n(mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_srcptr);
|
2012-03-10 04:38:09 -05:00
|
|
|
|
2008-04-17 17:03:07 -04:00
|
|
|
#define mpn_divexact_by3(dst,src,size) \
|
|
|
|
mpn_divexact_by3c (dst, src, size, __GMP_CAST (mp_limb_t, 0))
|
|
|
|
|
|
|
|
#define mpn_divexact_by3c __MPN(divexact_by3c)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC mp_limb_t mpn_divexact_by3c(mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpn_divmod_1(qp,np,nsize,dlimb) \
|
|
|
|
mpn_divrem_1 (qp, __GMP_CAST (mp_size_t, 0), np, nsize, dlimb)
|
|
|
|
|
2018-02-26 12:25:45 -05:00
|
|
|
#define mpn_divrem __MPN(divrem)
|
|
|
|
__GMP_DECLSPEC mp_limb_t mpn_divrem (mp_ptr, mp_size_t, mp_ptr, mp_size_t, mp_srcptr, mp_size_t);
|
|
|
|
|
2008-04-17 17:03:07 -04:00
|
|
|
#define mpn_divrem_1 __MPN(divrem_1)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC mp_limb_t mpn_divrem_1(mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpn_divrem_2 __MPN(divrem_2)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC mp_limb_t mpn_divrem_2(mp_ptr, mp_size_t, mp_ptr, mp_size_t, mp_srcptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
2009-09-29 18:55:10 -04:00
|
|
|
#define mpn_invert __MPN(invert)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpn_invert(mp_ptr xp, mp_srcptr ap, mp_size_t n);
|
2009-09-29 18:55:10 -04:00
|
|
|
|
|
|
|
#define mpn_sb_divappr_q __MPN(sb_divappr_q)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC mp_limb_t mpn_sb_divappr_q(mp_ptr qp, mp_ptr np, mp_size_t nn,
|
|
|
|
mp_srcptr dp, mp_size_t dn, mp_limb_t dip);
|
2009-09-29 18:55:10 -04:00
|
|
|
|
2010-03-02 13:53:21 -05:00
|
|
|
#define mpn_dc_bdiv_q_n __MPN(dc_bdiv_q_n)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpn_dc_bdiv_q_n(mp_ptr qp, mp_ptr wp, mp_ptr np, mp_srcptr dp, mp_size_t n,
|
|
|
|
mp_limb_t dinv, mp_ptr scratch);
|
2010-03-02 13:53:21 -05:00
|
|
|
|
2010-02-11 11:39:41 -05:00
|
|
|
#define mpn_inv_divappr_q_n __MPN(inv_divappr_q_n)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC mp_limb_t mpn_inv_divappr_q_n(mp_ptr qp, mp_ptr np, mp_srcptr dp, mp_size_t n,
|
|
|
|
mp_srcptr dip);
|
2010-02-11 11:39:41 -05:00
|
|
|
|
2010-02-09 16:19:08 -05:00
|
|
|
#define mpn_dc_divappr_q __MPN(dc_divappr_q)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC mp_limb_t mpn_dc_divappr_q(mp_ptr qp, mp_ptr np, mp_size_t nn, mp_srcptr dp,
|
|
|
|
mp_size_t n, mp_limb_t dinv);
|
2010-02-09 16:19:08 -05:00
|
|
|
|
|
|
|
#define mpn_dc_div_q __MPN(dc_div_q)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC mp_limb_t mpn_dc_div_q(mp_ptr qp, mp_ptr np, mp_size_t nn,
|
|
|
|
mp_srcptr dp, mp_size_t dn, mp_limb_t dinv);
|
2010-02-09 16:19:08 -05:00
|
|
|
|
2010-02-11 11:39:41 -05:00
|
|
|
#define mpn_inv_divappr_q __MPN(inv_divappr_q)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC mp_limb_t mpn_inv_divappr_q(mp_ptr qp, mp_ptr np, mp_size_t nn, mp_srcptr dp, mp_size_t n,
|
|
|
|
mp_srcptr dinv);
|
2010-02-11 11:39:41 -05:00
|
|
|
|
|
|
|
#define mpn_inv_div_q __MPN(inv_div_q)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC mp_limb_t mpn_inv_div_q(mp_ptr qp, mp_ptr np, mp_size_t nn,
|
|
|
|
mp_srcptr dp, mp_size_t dn, mp_srcptr dinv);
|
2010-02-13 12:58:56 -05:00
|
|
|
|
|
|
|
#define mpn_inv_div_qr __MPN(inv_div_qr)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC mp_limb_t mpn_inv_div_qr(mp_ptr qp, mp_ptr np, mp_size_t nn,
|
|
|
|
mp_srcptr dp, mp_size_t dn, mp_srcptr dinv);
|
2010-02-13 12:58:56 -05:00
|
|
|
|
|
|
|
#define mpn_inv_div_qr_n __MPN(inv_div_qr_n)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC mp_limb_t mpn_inv_div_qr_n(mp_ptr qp, mp_ptr np,
|
|
|
|
mp_srcptr dp, mp_size_t dn, mp_srcptr dinv);
|
2010-02-11 11:39:41 -05:00
|
|
|
|
2010-02-10 17:51:06 -05:00
|
|
|
#define mpn_dc_div_qr __MPN(dc_div_qr)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC mp_limb_t mpn_dc_div_qr(mp_ptr qp, mp_ptr np, mp_size_t nn,
|
|
|
|
mp_srcptr dp, mp_size_t dn, mp_limb_t dinv);
|
2010-02-10 17:51:06 -05:00
|
|
|
|
|
|
|
#define mpn_dc_div_qr_n __MPN(dc_div_qr_n)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC mp_limb_t mpn_dc_div_qr_n(mp_ptr qp, mp_ptr np, mp_srcptr dp, mp_size_t n,
|
|
|
|
mp_limb_t dinv, mp_ptr tp);
|
2010-02-10 17:51:06 -05:00
|
|
|
|
2010-02-09 21:09:24 -05:00
|
|
|
#define mpn_sb_div_q __MPN(sb_div_q)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC mp_limb_t mpn_sb_div_q(mp_ptr qp, mp_ptr np, mp_size_t nn,
|
|
|
|
mp_srcptr dp, mp_size_t dn, mp_limb_t dinv);
|
2010-02-10 17:51:06 -05:00
|
|
|
|
2010-03-01 16:44:41 -05:00
|
|
|
#define mpn_sb_bdiv_q __MPN(sb_bdiv_q)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpn_sb_bdiv_q(mp_ptr qp, mp_ptr wp, mp_ptr np, mp_size_t nn,
|
|
|
|
mp_srcptr dp, mp_size_t dn, mp_limb_t dinv);
|
2010-03-01 16:44:41 -05:00
|
|
|
|
2010-03-02 16:29:35 -05:00
|
|
|
#define mpn_dc_bdiv_q __MPN(dc_bdiv_q)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpn_dc_bdiv_q(mp_ptr qp, mp_ptr np, mp_size_t nn,
|
|
|
|
mp_srcptr dp, mp_size_t dn, mp_limb_t dinv);
|
2010-03-02 16:29:35 -05:00
|
|
|
|
|
|
|
#define mpn_dc_bdiv_qr __MPN(dc_bdiv_qr)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC mp_limb_t mpn_dc_bdiv_qr(mp_ptr qp, mp_ptr np, mp_size_t nn,
|
|
|
|
mp_srcptr dp, mp_size_t dn, mp_limb_t dinv);
|
2010-03-02 16:29:35 -05:00
|
|
|
|
2010-03-02 19:03:03 -05:00
|
|
|
#define mpn_dc_bdiv_qr_n __MPN(dc_bdiv_qr_n)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC mp_limb_t mpn_dc_bdiv_qr_n(mp_ptr qp, mp_ptr np,
|
|
|
|
mp_srcptr dp, mp_size_t n, mp_limb_t dinv, mp_ptr tp);
|
2010-03-02 19:03:03 -05:00
|
|
|
|
2010-02-10 17:51:06 -05:00
|
|
|
#define mpn_sb_div_qr __MPN(sb_div_qr)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC mp_limb_t mpn_sb_div_qr(mp_ptr qp, mp_ptr np, mp_size_t nn,
|
|
|
|
mp_srcptr dp, mp_size_t dn, mp_limb_t dinv);
|
2010-02-10 17:51:06 -05:00
|
|
|
|
2010-03-01 16:44:41 -05:00
|
|
|
#define mpn_sb_bdiv_qr __MPN(sb_bdiv_qr)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC mp_limb_t mpn_sb_bdiv_qr(mp_ptr qp, mp_ptr np, mp_size_t nn,
|
|
|
|
mp_srcptr dp, mp_size_t dn, mp_limb_t dinv);
|
2010-03-01 16:44:41 -05:00
|
|
|
|
2009-10-07 06:25:23 -04:00
|
|
|
#define mpn_tdiv_q __MPN(tdiv_q)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpn_tdiv_q(mp_ptr qp, mp_srcptr np, mp_size_t nn,
|
|
|
|
mp_srcptr dp, mp_size_t dn);
|
2009-10-07 06:25:23 -04:00
|
|
|
|
2010-03-04 11:59:38 -05:00
|
|
|
#define mpn_divexact __MPN(divexact)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpn_divexact(mp_ptr qp,
|
|
|
|
mp_srcptr np, mp_size_t nn, mp_srcptr dp, mp_size_t dn);
|
2010-03-04 11:59:38 -05:00
|
|
|
|
2008-04-17 17:03:07 -04:00
|
|
|
#define mpn_gcd __MPN(gcd)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC mp_size_t mpn_gcd(mp_ptr, mp_ptr, mp_size_t, mp_ptr, mp_size_t);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpn_gcd_1 __MPN(gcd_1)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC mp_limb_t mpn_gcd_1(mp_srcptr, mp_size_t, mp_limb_t) __GMP_ATTRIBUTE_PURE;
|
2008-04-17 17:03:07 -04:00
|
|
|
|
2011-10-14 07:22:46 -04:00
|
|
|
#define mpn_gcdext_1 __MPN(gcdext_1)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC mp_limb_t mpn_gcdext_1(mp_limb_signed_t *, mp_limb_signed_t *, mp_limb_t, mp_limb_t);
|
2011-10-14 07:22:46 -04:00
|
|
|
|
2008-04-17 17:03:07 -04:00
|
|
|
#define mpn_gcdext __MPN(gcdext)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC mp_size_t mpn_gcdext(mp_ptr, mp_ptr, mp_size_t *, mp_ptr, mp_size_t, mp_ptr, mp_size_t);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpn_get_str __MPN(get_str)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC size_t mpn_get_str(unsigned char *, int, mp_ptr, mp_size_t);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpn_hamdist __MPN(hamdist)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC mp_bitcnt_t mpn_hamdist(mp_srcptr, mp_srcptr, mp_size_t) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpn_lshift __MPN(lshift)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC mp_limb_t mpn_lshift(mp_ptr, mp_srcptr, mp_size_t, unsigned int);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpn_mod_1 __MPN(mod_1)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC mp_limb_t mpn_mod_1(mp_srcptr, mp_size_t, mp_limb_t) __GMP_ATTRIBUTE_PURE;
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpn_mul __MPN(mul)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC mp_limb_t mpn_mul(mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpn_mul_1 __MPN(mul_1)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC mp_limb_t mpn_mul_1(mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpn_mul_n __MPN(mul_n)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpn_mul_n(mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
2010-05-22 18:21:47 -04:00
|
|
|
#define mpn_sqr __MPN(sqr)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpn_sqr(mp_ptr, mp_srcptr, mp_size_t);
|
2010-02-22 07:21:17 -05:00
|
|
|
|
|
|
|
#define mpn_neg_n __MPN(neg_n)
|
|
|
|
#define mpn_neg __MPN(neg_n)
|
2018-02-26 12:25:45 -05:00
|
|
|
#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpn_neg)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC mp_limb_t mpn_neg_n(mp_ptr, mp_srcptr, mp_size_t);
|
2018-02-26 12:25:45 -05:00
|
|
|
#endif
|
2010-02-22 07:21:17 -05:00
|
|
|
#define mpn_com_n __MPN(com_n)
|
|
|
|
#define mpn_com __MPN(com_n)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpn_com_n(mp_ptr, mp_srcptr, mp_size_t);
|
2010-02-22 07:21:17 -05:00
|
|
|
|
2008-04-17 17:03:07 -04:00
|
|
|
#define mpn_perfect_square_p __MPN(perfect_square_p)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int mpn_perfect_square_p(mp_srcptr, mp_size_t) __GMP_ATTRIBUTE_PURE;
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpn_popcount __MPN(popcount)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC mp_bitcnt_t mpn_popcount(mp_srcptr, mp_size_t) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpn_pow_1 __MPN(pow_1)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC mp_size_t mpn_pow_1(mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_ptr);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
/* undocumented now, but retained here for upward compatibility */
|
|
|
|
#define mpn_preinv_mod_1 __MPN(preinv_mod_1)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC mp_limb_t mpn_preinv_mod_1(mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t) __GMP_ATTRIBUTE_PURE;
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpn_random __MPN(random)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpn_random(mp_ptr, mp_size_t);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpn_random2 __MPN(random2)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpn_random2(mp_ptr, mp_size_t);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
2009-09-14 10:28:27 -04:00
|
|
|
#define mpn_urandomb __MPN(urandomb)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpn_urandomb(mp_ptr, gmp_randstate_t, mpir_ui);
|
2009-09-14 10:28:27 -04:00
|
|
|
|
|
|
|
#define mpn_urandomm __MPN(urandomm)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpn_urandomm(mp_ptr, gmp_randstate_t, mp_srcptr, mp_size_t);
|
2009-09-14 10:28:27 -04:00
|
|
|
|
|
|
|
#define mpn_randomb __MPN(randomb)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpn_randomb(mp_ptr, gmp_randstate_t, mp_size_t);
|
2009-09-14 10:28:27 -04:00
|
|
|
|
|
|
|
#define mpn_rrandom __MPN(rrandom)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpn_rrandom(mp_ptr, gmp_randstate_t, mp_size_t);
|
2009-09-14 10:28:27 -04:00
|
|
|
|
2008-04-17 17:03:07 -04:00
|
|
|
#define mpn_rshift __MPN(rshift)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC mp_limb_t mpn_rshift(mp_ptr, mp_srcptr, mp_size_t, unsigned int);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpn_scan0 __MPN(scan0)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC mp_bitcnt_t mpn_scan0(mp_srcptr, mp_bitcnt_t) __GMP_ATTRIBUTE_PURE;
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpn_scan1 __MPN(scan1)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC mp_bitcnt_t mpn_scan1(mp_srcptr, mp_bitcnt_t) __GMP_ATTRIBUTE_PURE;
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpn_set_str __MPN(set_str)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC mp_size_t mpn_set_str(mp_ptr, __gmp_const unsigned char *, size_t, int);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
2017-02-09 12:27:01 -05:00
|
|
|
#define mpn_sizeinbase __MPN(sizeinbase)
|
|
|
|
__GMP_DECLSPEC size_t mpn_sizeinbase (mp_srcptr, mp_size_t, int);
|
|
|
|
|
2008-04-17 17:03:07 -04:00
|
|
|
#define mpn_sqrtrem __MPN(sqrtrem)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC mp_size_t mpn_sqrtrem(mp_ptr, mp_ptr, mp_srcptr, mp_size_t);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpn_sub __MPN(sub)
|
2008-06-24 22:01:33 -04:00
|
|
|
#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpn_sub)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC mp_limb_t mpn_sub(mp_ptr, mp_srcptr, mp_size_t, mp_srcptr,mp_size_t);
|
2008-04-17 17:03:07 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#define mpn_sub_1 __MPN(sub_1)
|
2008-06-24 22:01:33 -04:00
|
|
|
#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpn_sub_1)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC mp_limb_t mpn_sub_1(mp_ptr, mp_srcptr, mp_size_t, mp_limb_t) __GMP_NOTHROW;
|
2008-04-17 17:03:07 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#define mpn_sub_n __MPN(sub_n)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC mp_limb_t mpn_sub_n(mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpn_submul_1 __MPN(submul_1)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC mp_limb_t mpn_submul_1(mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
#define mpn_tdiv_qr __MPN(tdiv_qr)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpn_tdiv_qr(mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
2010-02-08 12:06:12 -05:00
|
|
|
#define mpn_and_n __MPN(and_n)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpn_and_n(mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
|
2010-02-08 12:06:12 -05:00
|
|
|
#define mpn_andn_n __MPN(andn_n)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpn_andn_n(mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
|
2010-02-08 12:06:12 -05:00
|
|
|
#define mpn_nand_n __MPN(nand_n)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpn_nand_n(mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
|
2010-02-08 12:06:12 -05:00
|
|
|
#define mpn_ior_n __MPN(ior_n)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpn_ior_n(mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
|
2010-02-08 12:06:12 -05:00
|
|
|
#define mpn_iorn_n __MPN(iorn_n)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpn_iorn_n(mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
|
2010-02-08 12:06:12 -05:00
|
|
|
#define mpn_nior_n __MPN(nior_n)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpn_nior_n(mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
|
2010-02-08 12:06:12 -05:00
|
|
|
#define mpn_xor_n __MPN(xor_n)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpn_xor_n(mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
|
2010-02-08 12:06:12 -05:00
|
|
|
#define mpn_xnor_n __MPN(xnor_n)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpn_xnor_n(mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
|
2010-02-08 12:06:12 -05:00
|
|
|
|
|
|
|
#define mpn_copyi __MPN(copyi)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpn_copyi(mp_ptr, mp_srcptr, mp_size_t);
|
2010-02-08 12:06:12 -05:00
|
|
|
#define mpn_copyd __MPN(copyd)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpn_copyd(mp_ptr, mp_srcptr, mp_size_t);
|
2010-02-08 12:06:12 -05:00
|
|
|
#define mpn_zero __MPN(zero)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpn_zero(mp_ptr, mp_size_t);
|
2008-04-17 17:03:07 -04:00
|
|
|
|
2012-10-23 11:37:39 -04:00
|
|
|
#ifndef mpn_sumdiff_n /* if not done with cpuvec in a fat binary of in gmp-impl.h*/
|
|
|
|
#define mpn_sumdiff_n __MPN(sumdiff_n)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC mp_limb_t mpn_sumdiff_n(mp_ptr, mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
|
2012-10-23 11:37:39 -04:00
|
|
|
#endif
|
|
|
|
|
2017-01-21 16:59:20 -05:00
|
|
|
#ifndef mpn_nsumdiff_n /* if not done with cpuvec in a fat binary of in gmp-impl.h*/
|
|
|
|
#define mpn_nsumdiff_n __MPN(nsumdiff_n)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC mp_limb_t mpn_nsumdiff_n(mp_ptr, mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
|
2017-01-21 16:59:20 -05:00
|
|
|
#endif
|
|
|
|
|
2012-01-07 09:36:54 -05:00
|
|
|
/**************** MPN API for FFT ****************/
|
|
|
|
|
|
|
|
#define mpn_mul_fft_main __MPN(mul_fft_main)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC void mpn_mul_fft_main(mp_ptr r1, mp_srcptr i1, mp_size_t n1, mp_srcptr i2, mp_size_t n2);
|
2012-01-07 09:36:54 -05:00
|
|
|
|
2014-06-12 09:34:20 -04:00
|
|
|
#define mpn_mul_fft __MPN(mul_fft)
|
2018-02-25 04:02:47 -05:00
|
|
|
__GMP_DECLSPEC int mpn_mul_fft(mp_ptr rp, mp_size_t rn, mp_srcptr ap, mp_size_t an, mp_srcptr bp, mp_size_t bn, int k);
|
2014-06-12 09:34:20 -04:00
|
|
|
|
2008-04-17 17:03:07 -04:00
|
|
|
/**************** mpz inlines ****************/
|
|
|
|
|
|
|
|
/* The following are provided as inlines where possible, but always exist as
|
|
|
|
library functions too, for binary compatibility.
|
|
|
|
|
|
|
|
Within gmp itself this inlining generally isn't relied on, since it
|
|
|
|
doesn't get done for all compilers, whereas if something is worth
|
|
|
|
inlining then it's worth arranging always.
|
|
|
|
|
|
|
|
There are two styles of inlining here. When the same bit of code is
|
|
|
|
wanted for the inline as for the library version, then __GMP_FORCE_foo
|
|
|
|
arranges for that code to be emitted and the __GMP_EXTERN_INLINE
|
|
|
|
directive suppressed, eg. mpz_fits_uint_p. When a different bit of code
|
|
|
|
is wanted for the inline than for the library version, then
|
|
|
|
__GMP_FORCE_foo arranges the inline to be suppressed, eg. mpz_abs. */
|
|
|
|
|
|
|
|
#if defined (__GMP_EXTERN_INLINE) && ! defined (__GMP_FORCE_mpz_abs)
|
|
|
|
__GMP_EXTERN_INLINE void
|
|
|
|
mpz_abs (mpz_ptr __gmp_w, mpz_srcptr __gmp_u)
|
|
|
|
{
|
|
|
|
if (__gmp_w != __gmp_u)
|
|
|
|
mpz_set (__gmp_w, __gmp_u);
|
|
|
|
__gmp_w->_mp_size = __GMP_ABS (__gmp_w->_mp_size);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if GMP_NAIL_BITS == 0
|
|
|
|
#define __GMPZ_FITS_UTYPE_P(z,maxval) \
|
|
|
|
mp_size_t __gmp_n = z->_mp_size; \
|
|
|
|
mp_ptr __gmp_p = z->_mp_d; \
|
|
|
|
return (__gmp_n == 0 || (__gmp_n == 1 && __gmp_p[0] <= maxval));
|
|
|
|
#else
|
|
|
|
#define __GMPZ_FITS_UTYPE_P(z,maxval) \
|
|
|
|
mp_size_t __gmp_n = z->_mp_size; \
|
|
|
|
mp_ptr __gmp_p = z->_mp_d; \
|
|
|
|
return (__gmp_n == 0 || (__gmp_n == 1 && __gmp_p[0] <= maxval) \
|
|
|
|
|| (__gmp_n == 2 && __gmp_p[1] <= ((mp_limb_t) maxval >> GMP_NUMB_BITS)));
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpz_fits_uint_p)
|
|
|
|
#if ! defined (__GMP_FORCE_mpz_fits_uint_p)
|
|
|
|
__GMP_EXTERN_INLINE
|
|
|
|
#endif
|
|
|
|
int
|
|
|
|
mpz_fits_uint_p (mpz_srcptr __gmp_z) __GMP_NOTHROW
|
|
|
|
{
|
|
|
|
__GMPZ_FITS_UTYPE_P (__gmp_z, __GMP_UINT_MAX);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2011-12-16 14:47:56 -05:00
|
|
|
#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpz_fits_ui_p)
|
|
|
|
#if ! defined (__GMP_FORCE_mpz_fits_ui_p)
|
|
|
|
__GMP_EXTERN_INLINE
|
|
|
|
#endif
|
|
|
|
int
|
|
|
|
mpz_fits_ui_p (mpz_srcptr __gmp_z) __GMP_NOTHROW
|
|
|
|
{
|
|
|
|
__GMPZ_FITS_UTYPE_P (__gmp_z, GMP_UI_MAX);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2008-04-17 17:03:07 -04:00
|
|
|
#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpz_fits_ulong_p)
|
|
|
|
#if ! defined (__GMP_FORCE_mpz_fits_ulong_p)
|
|
|
|
__GMP_EXTERN_INLINE
|
|
|
|
#endif
|
|
|
|
int
|
|
|
|
mpz_fits_ulong_p (mpz_srcptr __gmp_z) __GMP_NOTHROW
|
|
|
|
{
|
|
|
|
__GMPZ_FITS_UTYPE_P (__gmp_z, __GMP_ULONG_MAX);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpz_fits_ushort_p)
|
|
|
|
#if ! defined (__GMP_FORCE_mpz_fits_ushort_p)
|
|
|
|
__GMP_EXTERN_INLINE
|
|
|
|
#endif
|
|
|
|
int
|
|
|
|
mpz_fits_ushort_p (mpz_srcptr __gmp_z) __GMP_NOTHROW
|
|
|
|
{
|
|
|
|
__GMPZ_FITS_UTYPE_P (__gmp_z, __GMP_USHRT_MAX);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpz_get_ui)
|
|
|
|
#if ! defined (__GMP_FORCE_mpz_get_ui)
|
|
|
|
__GMP_EXTERN_INLINE
|
|
|
|
#endif
|
2012-01-24 09:37:16 -05:00
|
|
|
mpir_ui
|
2008-04-17 17:03:07 -04:00
|
|
|
mpz_get_ui (mpz_srcptr __gmp_z) __GMP_NOTHROW
|
|
|
|
{
|
|
|
|
mp_ptr __gmp_p = __gmp_z->_mp_d;
|
|
|
|
mp_size_t __gmp_n = __gmp_z->_mp_size;
|
|
|
|
mp_limb_t __gmp_l = __gmp_p[0];
|
|
|
|
/* This is a "#if" rather than a plain "if" so as to avoid gcc warnings
|
|
|
|
about "<< GMP_NUMB_BITS" exceeding the type size, and to avoid Borland
|
|
|
|
C++ 6.0 warnings about condition always true for something like
|
|
|
|
"__GMP_ULONG_MAX < GMP_NUMB_MASK". */
|
|
|
|
#if GMP_NAIL_BITS == 0 || defined (_LONG_LONG_LIMB)
|
|
|
|
/* limb==long and no nails, or limb==longlong, one limb is enough */
|
2012-01-24 09:37:16 -05:00
|
|
|
return (mpir_ui)(__gmp_n != 0 ? __gmp_l : 0);
|
2008-04-17 17:03:07 -04:00
|
|
|
#else
|
|
|
|
/* limb==long and nails, need two limbs when available */
|
|
|
|
__gmp_n = __GMP_ABS (__gmp_n);
|
|
|
|
if (__gmp_n <= 1)
|
2012-01-24 09:37:16 -05:00
|
|
|
return (mpir_ui)(__gmp_n != 0 ? __gmp_l : 0);
|
2008-04-17 17:03:07 -04:00
|
|
|
else
|
2012-01-24 09:37:16 -05:00
|
|
|
return (mpir_ui)(__gmp_l + (__gmp_p[1] << GMP_NUMB_BITS));
|
2008-04-17 17:03:07 -04:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpz_getlimbn)
|
|
|
|
#if ! defined (__GMP_FORCE_mpz_getlimbn)
|
|
|
|
__GMP_EXTERN_INLINE
|
|
|
|
#endif
|
|
|
|
mp_limb_t
|
|
|
|
mpz_getlimbn (mpz_srcptr __gmp_z, mp_size_t __gmp_n) __GMP_NOTHROW
|
|
|
|
{
|
|
|
|
mp_limb_t __gmp_result = 0;
|
|
|
|
if (__GMP_LIKELY (__gmp_n >= 0 && __gmp_n < __GMP_ABS (__gmp_z->_mp_size)))
|
|
|
|
__gmp_result = __gmp_z->_mp_d[__gmp_n];
|
|
|
|
return __gmp_result;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined (__GMP_EXTERN_INLINE) && ! defined (__GMP_FORCE_mpz_neg)
|
|
|
|
__GMP_EXTERN_INLINE void
|
|
|
|
mpz_neg (mpz_ptr __gmp_w, mpz_srcptr __gmp_u)
|
|
|
|
{
|
|
|
|
if (__gmp_w != __gmp_u)
|
|
|
|
mpz_set (__gmp_w, __gmp_u);
|
|
|
|
__gmp_w->_mp_size = - __gmp_w->_mp_size;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpz_perfect_square_p)
|
|
|
|
#if ! defined (__GMP_FORCE_mpz_perfect_square_p)
|
|
|
|
__GMP_EXTERN_INLINE
|
|
|
|
#endif
|
|
|
|
int
|
|
|
|
mpz_perfect_square_p (mpz_srcptr __gmp_a)
|
|
|
|
{
|
|
|
|
mp_size_t __gmp_asize;
|
|
|
|
int __gmp_result;
|
|
|
|
|
|
|
|
__gmp_asize = __gmp_a->_mp_size;
|
|
|
|
__gmp_result = (__gmp_asize >= 0); /* zero is a square, negatives are not */
|
|
|
|
if (__GMP_LIKELY (__gmp_asize > 0))
|
|
|
|
__gmp_result = mpn_perfect_square_p (__gmp_a->_mp_d, __gmp_asize);
|
|
|
|
return __gmp_result;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpz_popcount)
|
|
|
|
#if ! defined (__GMP_FORCE_mpz_popcount)
|
|
|
|
__GMP_EXTERN_INLINE
|
|
|
|
#endif
|
2010-02-08 12:06:12 -05:00
|
|
|
mp_bitcnt_t
|
2008-04-17 17:03:07 -04:00
|
|
|
mpz_popcount (mpz_srcptr __gmp_u) __GMP_NOTHROW
|
|
|
|
{
|
|
|
|
mp_size_t __gmp_usize;
|
2010-02-08 12:06:12 -05:00
|
|
|
mp_bitcnt_t __gmp_result;
|
2008-04-17 17:03:07 -04:00
|
|
|
|
|
|
|
__gmp_usize = __gmp_u->_mp_size;
|
2011-05-04 05:37:29 -04:00
|
|
|
__gmp_result = (__gmp_usize < 0 ? __GMP_BITCNT_MAX : 0);
|
2008-04-17 17:03:07 -04:00
|
|
|
if (__GMP_LIKELY (__gmp_usize > 0))
|
|
|
|
__gmp_result = mpn_popcount (__gmp_u->_mp_d, __gmp_usize);
|
|
|
|
return __gmp_result;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpz_set_q)
|
|
|
|
#if ! defined (__GMP_FORCE_mpz_set_q)
|
|
|
|
__GMP_EXTERN_INLINE
|
|
|
|
#endif
|
|
|
|
void
|
|
|
|
mpz_set_q (mpz_ptr __gmp_w, mpq_srcptr __gmp_u)
|
|
|
|
{
|
|
|
|
mpz_tdiv_q (__gmp_w, mpq_numref (__gmp_u), mpq_denref (__gmp_u));
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpz_size)
|
|
|
|
#if ! defined (__GMP_FORCE_mpz_size)
|
|
|
|
__GMP_EXTERN_INLINE
|
|
|
|
#endif
|
|
|
|
size_t
|
|
|
|
mpz_size (mpz_srcptr __gmp_z) __GMP_NOTHROW
|
|
|
|
{
|
|
|
|
return __GMP_ABS (__gmp_z->_mp_size);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
/**************** mpq inlines ****************/
|
|
|
|
|
|
|
|
#if defined (__GMP_EXTERN_INLINE) && ! defined (__GMP_FORCE_mpq_abs)
|
|
|
|
__GMP_EXTERN_INLINE void
|
|
|
|
mpq_abs (mpq_ptr __gmp_w, mpq_srcptr __gmp_u)
|
|
|
|
{
|
|
|
|
if (__gmp_w != __gmp_u)
|
|
|
|
mpq_set (__gmp_w, __gmp_u);
|
|
|
|
__gmp_w->_mp_num._mp_size = __GMP_ABS (__gmp_w->_mp_num._mp_size);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined (__GMP_EXTERN_INLINE) && ! defined (__GMP_FORCE_mpq_neg)
|
|
|
|
__GMP_EXTERN_INLINE void
|
|
|
|
mpq_neg (mpq_ptr __gmp_w, mpq_srcptr __gmp_u)
|
|
|
|
{
|
|
|
|
if (__gmp_w != __gmp_u)
|
|
|
|
mpq_set (__gmp_w, __gmp_u);
|
|
|
|
__gmp_w->_mp_num._mp_size = - __gmp_w->_mp_num._mp_size;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
/**************** mpn inlines ****************/
|
|
|
|
|
|
|
|
/* The comments with __GMPN_ADD_1 below apply here too.
|
|
|
|
|
|
|
|
The test for FUNCTION returning 0 should predict well. If it's assumed
|
|
|
|
{yp,ysize} will usually have a random number of bits then the high limb
|
|
|
|
won't be full and a carry out will occur a good deal less than 50% of the
|
|
|
|
time.
|
|
|
|
|
|
|
|
ysize==0 isn't a documented feature, but is used internally in a few
|
|
|
|
places.
|
|
|
|
|
|
|
|
Producing cout last stops it using up a register during the main part of
|
|
|
|
the calculation, though gcc (as of 3.0) on an "if (mpn_add (...))"
|
|
|
|
doesn't seem able to move the true and false legs of the conditional up
|
|
|
|
to the two places cout is generated. */
|
|
|
|
|
|
|
|
#define __GMPN_AORS(cout, wp, xp, xsize, yp, ysize, FUNCTION, TEST) \
|
|
|
|
do { \
|
|
|
|
mp_size_t __gmp_i; \
|
|
|
|
mp_limb_t __gmp_x; \
|
|
|
|
\
|
|
|
|
/* ASSERT ((ysize) >= 0); */ \
|
|
|
|
/* ASSERT ((xsize) >= (ysize)); */ \
|
|
|
|
/* ASSERT (MPN_SAME_OR_SEPARATE2_P (wp, xsize, xp, xsize)); */ \
|
|
|
|
/* ASSERT (MPN_SAME_OR_SEPARATE2_P (wp, xsize, yp, ysize)); */ \
|
|
|
|
\
|
|
|
|
__gmp_i = (ysize); \
|
|
|
|
if (__gmp_i != 0) \
|
|
|
|
{ \
|
|
|
|
if (FUNCTION (wp, xp, yp, __gmp_i)) \
|
|
|
|
{ \
|
|
|
|
do \
|
|
|
|
{ \
|
|
|
|
if (__gmp_i >= (xsize)) \
|
|
|
|
{ \
|
|
|
|
(cout) = 1; \
|
|
|
|
goto __gmp_done; \
|
|
|
|
} \
|
|
|
|
__gmp_x = (xp)[__gmp_i]; \
|
|
|
|
} \
|
|
|
|
while (TEST); \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
if ((wp) != (xp)) \
|
|
|
|
__GMPN_COPY_REST (wp, xp, xsize, __gmp_i); \
|
|
|
|
(cout) = 0; \
|
|
|
|
__gmp_done: \
|
|
|
|
; \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
#define __GMPN_ADD(cout, wp, xp, xsize, yp, ysize) \
|
|
|
|
__GMPN_AORS (cout, wp, xp, xsize, yp, ysize, mpn_add_n, \
|
|
|
|
(((wp)[__gmp_i++] = (__gmp_x + 1) & GMP_NUMB_MASK) == 0))
|
|
|
|
#define __GMPN_SUB(cout, wp, xp, xsize, yp, ysize) \
|
|
|
|
__GMPN_AORS (cout, wp, xp, xsize, yp, ysize, mpn_sub_n, \
|
|
|
|
(((wp)[__gmp_i++] = (__gmp_x - 1) & GMP_NUMB_MASK), __gmp_x == 0))
|
|
|
|
|
|
|
|
|
|
|
|
/* The use of __gmp_i indexing is designed to ensure a compile time src==dst
|
|
|
|
remains nice and clear to the compiler, so that __GMPN_COPY_REST can
|
|
|
|
disappear, and the load/add/store gets a chance to become a
|
|
|
|
read-modify-write on CISC CPUs.
|
|
|
|
|
|
|
|
Alternatives:
|
|
|
|
|
|
|
|
Using a pair of pointers instead of indexing would be possible, but gcc
|
|
|
|
isn't able to recognise compile-time src==dst in that case, even when the
|
|
|
|
pointers are incremented more or less together. Other compilers would
|
|
|
|
very likely have similar difficulty.
|
|
|
|
|
|
|
|
gcc could use "if (__builtin_constant_p(src==dst) && src==dst)" or
|
|
|
|
similar to detect a compile-time src==dst. This works nicely on gcc
|
|
|
|
2.95.x, it's not good on gcc 3.0 where __builtin_constant_p(p==p) seems
|
|
|
|
to be always false, for a pointer p. But the current code form seems
|
|
|
|
good enough for src==dst anyway.
|
|
|
|
|
|
|
|
gcc on x86 as usual doesn't give particularly good flags handling for the
|
|
|
|
carry/borrow detection. It's tempting to want some multi instruction asm
|
|
|
|
blocks to help it, and this was tried, but in truth there's only a few
|
|
|
|
instructions to save and any gain is all too easily lost by register
|
|
|
|
juggling setting up for the asm. */
|
|
|
|
|
|
|
|
#if GMP_NAIL_BITS == 0
|
|
|
|
#define __GMPN_AORS_1(cout, dst, src, n, v, OP, CB) \
|
|
|
|
do { \
|
|
|
|
mp_size_t __gmp_i; \
|
|
|
|
mp_limb_t __gmp_x, __gmp_r; \
|
|
|
|
\
|
|
|
|
/* ASSERT ((n) >= 1); */ \
|
|
|
|
/* ASSERT (MPN_SAME_OR_SEPARATE_P (dst, src, n)); */ \
|
|
|
|
\
|
|
|
|
__gmp_x = (src)[0]; \
|
|
|
|
__gmp_r = __gmp_x OP (v); \
|
|
|
|
(dst)[0] = __gmp_r; \
|
|
|
|
if (CB (__gmp_r, __gmp_x, (v))) \
|
|
|
|
{ \
|
|
|
|
(cout) = 1; \
|
|
|
|
for (__gmp_i = 1; __gmp_i < (n);) \
|
|
|
|
{ \
|
|
|
|
__gmp_x = (src)[__gmp_i]; \
|
|
|
|
__gmp_r = __gmp_x OP 1; \
|
|
|
|
(dst)[__gmp_i] = __gmp_r; \
|
|
|
|
++__gmp_i; \
|
|
|
|
if (!CB (__gmp_r, __gmp_x, 1)) \
|
|
|
|
{ \
|
|
|
|
if ((src) != (dst)) \
|
|
|
|
__GMPN_COPY_REST (dst, src, n, __gmp_i); \
|
|
|
|
(cout) = 0; \
|
|
|
|
break; \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
else \
|
|
|
|
{ \
|
|
|
|
if ((src) != (dst)) \
|
|
|
|
__GMPN_COPY_REST (dst, src, n, 1); \
|
|
|
|
(cout) = 0; \
|
|
|
|
} \
|
|
|
|
} while (0)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if GMP_NAIL_BITS >= 1
|
|
|
|
#define __GMPN_AORS_1(cout, dst, src, n, v, OP, CB) \
|
|
|
|
do { \
|
|
|
|
mp_size_t __gmp_i; \
|
|
|
|
mp_limb_t __gmp_x, __gmp_r; \
|
|
|
|
\
|
|
|
|
/* ASSERT ((n) >= 1); */ \
|
|
|
|
/* ASSERT (MPN_SAME_OR_SEPARATE_P (dst, src, n)); */ \
|
|
|
|
\
|
|
|
|
__gmp_x = (src)[0]; \
|
|
|
|
__gmp_r = __gmp_x OP (v); \
|
|
|
|
(dst)[0] = __gmp_r & GMP_NUMB_MASK; \
|
|
|
|
if (__gmp_r >> GMP_NUMB_BITS != 0) \
|
|
|
|
{ \
|
|
|
|
(cout) = 1; \
|
|
|
|
for (__gmp_i = 1; __gmp_i < (n);) \
|
|
|
|
{ \
|
|
|
|
__gmp_x = (src)[__gmp_i]; \
|
|
|
|
__gmp_r = __gmp_x OP 1; \
|
|
|
|
(dst)[__gmp_i] = __gmp_r & GMP_NUMB_MASK; \
|
|
|
|
++__gmp_i; \
|
|
|
|
if (__gmp_r >> GMP_NUMB_BITS == 0) \
|
|
|
|
{ \
|
|
|
|
if ((src) != (dst)) \
|
|
|
|
__GMPN_COPY_REST (dst, src, n, __gmp_i); \
|
|
|
|
(cout) = 0; \
|
|
|
|
break; \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
else \
|
|
|
|
{ \
|
|
|
|
if ((src) != (dst)) \
|
|
|
|
__GMPN_COPY_REST (dst, src, n, 1); \
|
|
|
|
(cout) = 0; \
|
|
|
|
} \
|
|
|
|
} while (0)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define __GMPN_ADDCB(r,x,y) ((r) < (y))
|
|
|
|
#define __GMPN_SUBCB(r,x,y) ((x) < (y))
|
|
|
|
|
|
|
|
#define __GMPN_ADD_1(cout, dst, src, n, v) \
|
|
|
|
__GMPN_AORS_1(cout, dst, src, n, v, +, __GMPN_ADDCB)
|
|
|
|
#define __GMPN_SUB_1(cout, dst, src, n, v) \
|
|
|
|
__GMPN_AORS_1(cout, dst, src, n, v, -, __GMPN_SUBCB)
|
|
|
|
|
|
|
|
|
|
|
|
/* Compare {xp,size} and {yp,size}, setting "result" to positive, zero or
|
|
|
|
negative. size==0 is allowed. On random data usually only one limb will
|
|
|
|
need to be examined to get a result, so it's worth having it inline. */
|
|
|
|
#define __GMPN_CMP(result, xp, yp, size) \
|
|
|
|
do { \
|
|
|
|
mp_size_t __gmp_i; \
|
|
|
|
mp_limb_t __gmp_x, __gmp_y; \
|
|
|
|
\
|
|
|
|
/* ASSERT ((size) >= 0); */ \
|
|
|
|
\
|
|
|
|
(result) = 0; \
|
|
|
|
__gmp_i = (size); \
|
|
|
|
while (--__gmp_i >= 0) \
|
|
|
|
{ \
|
|
|
|
__gmp_x = (xp)[__gmp_i]; \
|
|
|
|
__gmp_y = (yp)[__gmp_i]; \
|
|
|
|
if (__gmp_x != __gmp_y) \
|
|
|
|
{ \
|
|
|
|
/* Cannot use __gmp_x - __gmp_y, may overflow an "int" */ \
|
|
|
|
(result) = (__gmp_x > __gmp_y ? 1 : -1); \
|
|
|
|
break; \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
|
|
|
|
#if defined (__GMPN_COPY) && ! defined (__GMPN_COPY_REST)
|
|
|
|
#define __GMPN_COPY_REST(dst, src, size, start) \
|
|
|
|
do { \
|
|
|
|
/* ASSERT ((start) >= 0); */ \
|
|
|
|
/* ASSERT ((start) <= (size)); */ \
|
|
|
|
__GMPN_COPY ((dst)+(start), (src)+(start), (size)-(start)); \
|
|
|
|
} while (0)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Copy {src,size} to {dst,size}, starting at "start". This is designed to
|
|
|
|
keep the indexing dst[j] and src[j] nice and simple for __GMPN_ADD_1,
|
|
|
|
__GMPN_ADD, etc. */
|
|
|
|
#if ! defined (__GMPN_COPY_REST)
|
|
|
|
#define __GMPN_COPY_REST(dst, src, size, start) \
|
|
|
|
do { \
|
|
|
|
mp_size_t __gmp_j; \
|
|
|
|
/* ASSERT ((size) >= 0); */ \
|
|
|
|
/* ASSERT ((start) >= 0); */ \
|
|
|
|
/* ASSERT ((start) <= (size)); */ \
|
|
|
|
/* ASSERT (MPN_SAME_OR_SEPARATE_P (dst, src, size)); */ \
|
|
|
|
for (__gmp_j = (start); __gmp_j < (size); __gmp_j++) \
|
|
|
|
(dst)[__gmp_j] = (src)[__gmp_j]; \
|
|
|
|
} while (0)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Enhancement: Use some of the smarter code from gmp-impl.h. Maybe use
|
|
|
|
mpn_copyi if there's a native version, and if we don't mind demanding
|
|
|
|
binary compatibility for it (on targets which use it). */
|
|
|
|
|
|
|
|
#if ! defined (__GMPN_COPY)
|
|
|
|
#define __GMPN_COPY(dst, src, size) __GMPN_COPY_REST (dst, src, size, 0)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpn_add)
|
|
|
|
#if ! defined (__GMP_FORCE_mpn_add)
|
|
|
|
__GMP_EXTERN_INLINE
|
|
|
|
#endif
|
|
|
|
mp_limb_t
|
|
|
|
mpn_add (mp_ptr __gmp_wp, mp_srcptr __gmp_xp, mp_size_t __gmp_xsize, mp_srcptr __gmp_yp, mp_size_t __gmp_ysize)
|
|
|
|
{
|
|
|
|
mp_limb_t __gmp_c;
|
|
|
|
__GMPN_ADD (__gmp_c, __gmp_wp, __gmp_xp, __gmp_xsize, __gmp_yp, __gmp_ysize);
|
|
|
|
return __gmp_c;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpn_add_1)
|
|
|
|
#if ! defined (__GMP_FORCE_mpn_add_1)
|
|
|
|
__GMP_EXTERN_INLINE
|
|
|
|
#endif
|
|
|
|
mp_limb_t
|
|
|
|
mpn_add_1 (mp_ptr __gmp_dst, mp_srcptr __gmp_src, mp_size_t __gmp_size, mp_limb_t __gmp_n) __GMP_NOTHROW
|
|
|
|
{
|
|
|
|
mp_limb_t __gmp_c;
|
|
|
|
__GMPN_ADD_1 (__gmp_c, __gmp_dst, __gmp_src, __gmp_size, __gmp_n);
|
|
|
|
return __gmp_c;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpn_cmp)
|
|
|
|
#if ! defined (__GMP_FORCE_mpn_cmp)
|
|
|
|
__GMP_EXTERN_INLINE
|
|
|
|
#endif
|
|
|
|
int
|
|
|
|
mpn_cmp (mp_srcptr __gmp_xp, mp_srcptr __gmp_yp, mp_size_t __gmp_size) __GMP_NOTHROW
|
|
|
|
{
|
|
|
|
int __gmp_result;
|
|
|
|
__GMPN_CMP (__gmp_result, __gmp_xp, __gmp_yp, __gmp_size);
|
|
|
|
return __gmp_result;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2018-02-26 12:25:45 -05:00
|
|
|
#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpn_zero_p)
|
|
|
|
#if ! defined (__GMP_FORCE_mpn_zero_p)
|
|
|
|
__GMP_EXTERN_INLINE
|
|
|
|
#endif
|
|
|
|
int
|
|
|
|
mpn_zero_p (mp_srcptr __gmp_p, mp_size_t __gmp_n) __GMP_NOTHROW
|
|
|
|
{
|
|
|
|
/* if (__GMP_LIKELY (__gmp_n > 0)) */
|
|
|
|
do {
|
|
|
|
if (__gmp_p[--__gmp_n] != 0)
|
|
|
|
return 0;
|
|
|
|
} while (__gmp_n != 0);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2008-04-17 17:03:07 -04:00
|
|
|
#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpn_sub)
|
|
|
|
#if ! defined (__GMP_FORCE_mpn_sub)
|
|
|
|
__GMP_EXTERN_INLINE
|
|
|
|
#endif
|
|
|
|
mp_limb_t
|
|
|
|
mpn_sub (mp_ptr __gmp_wp, mp_srcptr __gmp_xp, mp_size_t __gmp_xsize, mp_srcptr __gmp_yp, mp_size_t __gmp_ysize)
|
|
|
|
{
|
|
|
|
mp_limb_t __gmp_c;
|
|
|
|
__GMPN_SUB (__gmp_c, __gmp_wp, __gmp_xp, __gmp_xsize, __gmp_yp, __gmp_ysize);
|
|
|
|
return __gmp_c;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpn_sub_1)
|
|
|
|
#if ! defined (__GMP_FORCE_mpn_sub_1)
|
|
|
|
__GMP_EXTERN_INLINE
|
|
|
|
#endif
|
|
|
|
mp_limb_t
|
|
|
|
mpn_sub_1 (mp_ptr __gmp_dst, mp_srcptr __gmp_src, mp_size_t __gmp_size, mp_limb_t __gmp_n) __GMP_NOTHROW
|
|
|
|
{
|
|
|
|
mp_limb_t __gmp_c;
|
|
|
|
__GMPN_SUB_1 (__gmp_c, __gmp_dst, __gmp_src, __gmp_size, __gmp_n);
|
|
|
|
return __gmp_c;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2018-02-26 12:25:45 -05:00
|
|
|
#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpn_neg_n)
|
2018-02-27 02:59:40 -05:00
|
|
|
#if ! defined (__GMP_FORCE_mpn_neg_n)
|
2018-02-26 12:25:45 -05:00
|
|
|
__GMP_EXTERN_INLINE
|
|
|
|
#endif
|
|
|
|
mp_limb_t
|
|
|
|
mpn_neg_n (mp_ptr __gmp_rp, mp_srcptr __gmp_up, mp_size_t __gmp_n)
|
|
|
|
{
|
|
|
|
while (*__gmp_up == 0) /* Low zero limbs are unchanged by negation. */
|
|
|
|
{
|
|
|
|
*__gmp_rp = 0;
|
|
|
|
if (!--__gmp_n) /* All zero */
|
|
|
|
return 0;
|
|
|
|
++__gmp_up; ++__gmp_rp;
|
|
|
|
}
|
|
|
|
|
2018-04-17 11:16:13 -04:00
|
|
|
*__gmp_rp = (- *(mp_limb_signed_t*)__gmp_up) & GMP_NUMB_MASK;
|
2018-02-26 12:25:45 -05:00
|
|
|
|
|
|
|
if (--__gmp_n) /* Higher limbs get complemented. */
|
|
|
|
mpn_com (++__gmp_rp, ++__gmp_up, __gmp_n);
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2008-04-17 17:03:07 -04:00
|
|
|
#if defined (__cplusplus)
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
/* Allow faster testing for negative, zero, and positive. */
|
|
|
|
#define mpz_sgn(Z) ((Z)->_mp_size < 0 ? -1 : (Z)->_mp_size > 0)
|
|
|
|
#define mpf_sgn(F) ((F)->_mp_size < 0 ? -1 : (F)->_mp_size > 0)
|
|
|
|
#define mpq_sgn(Q) ((Q)->_mp_num._mp_size < 0 ? -1 : (Q)->_mp_num._mp_size > 0)
|
|
|
|
|
|
|
|
/* When using GCC, optimize certain common comparisons. */
|
|
|
|
#if defined (__GNUC__)
|
|
|
|
#define mpz_cmp_ui(Z,UI) \
|
|
|
|
(__builtin_constant_p (UI) && (UI) == 0 \
|
|
|
|
? mpz_sgn (Z) : _mpz_cmp_ui (Z,UI))
|
|
|
|
#define mpz_cmp_si(Z,SI) \
|
|
|
|
(__builtin_constant_p (SI) && (SI) == 0 ? mpz_sgn (Z) \
|
|
|
|
: __builtin_constant_p (SI) && (SI) > 0 \
|
|
|
|
? _mpz_cmp_ui (Z, __GMP_CAST (unsigned long int, SI)) \
|
|
|
|
: _mpz_cmp_si (Z,SI))
|
|
|
|
#define mpq_cmp_ui(Q,NUI,DUI) \
|
|
|
|
(__builtin_constant_p (NUI) && (NUI) == 0 \
|
|
|
|
? mpq_sgn (Q) : _mpq_cmp_ui (Q,NUI,DUI))
|
|
|
|
#define mpq_cmp_si(q,n,d) \
|
|
|
|
(__builtin_constant_p ((n) >= 0) && (n) >= 0 \
|
|
|
|
? mpq_cmp_ui (q, __GMP_CAST (unsigned long, n), d) \
|
|
|
|
: _mpq_cmp_si (q, n, d))
|
|
|
|
#else
|
|
|
|
#define mpz_cmp_ui(Z,UI) _mpz_cmp_ui (Z,UI)
|
|
|
|
#define mpz_cmp_si(Z,UI) _mpz_cmp_si (Z,UI)
|
|
|
|
#define mpq_cmp_ui(Q,NUI,DUI) _mpq_cmp_ui (Q,NUI,DUI)
|
|
|
|
#define mpq_cmp_si(q,n,d) _mpq_cmp_si(q,n,d)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
/* Using "&" rather than "&&" means these can come out branch-free. Every
|
|
|
|
mpz_t has at least one limb allocated, so fetching the low limb is always
|
|
|
|
allowed. */
|
|
|
|
#define mpz_odd_p(z) (((z)->_mp_size != 0) & __GMP_CAST (int, (z)->_mp_d[0]))
|
|
|
|
#define mpz_even_p(z) (! mpz_odd_p (z))
|
|
|
|
|
|
|
|
|
|
|
|
/**************** C++ routines ****************/
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
__GMP_DECLSPEC_XX std::ostream& operator<< (std::ostream &, mpz_srcptr);
|
|
|
|
__GMP_DECLSPEC_XX std::ostream& operator<< (std::ostream &, mpq_srcptr);
|
|
|
|
__GMP_DECLSPEC_XX std::ostream& operator<< (std::ostream &, mpf_srcptr);
|
|
|
|
__GMP_DECLSPEC_XX std::istream& operator>> (std::istream &, mpz_ptr);
|
|
|
|
__GMP_DECLSPEC_XX std::istream& operator>> (std::istream &, mpq_ptr);
|
|
|
|
__GMP_DECLSPEC_XX std::istream& operator>> (std::istream &, mpf_ptr);
|
|
|
|
#endif
|
|
|
|
|
2010-04-08 18:58:35 -04:00
|
|
|
/* Source-level compatibility with GMP 1. */
|
|
|
|
#define mpz_mdiv mpz_fdiv_q
|
|
|
|
#define mpz_mdivmod mpz_fdiv_qr
|
|
|
|
#define mpz_mmod mpz_fdiv_r
|
|
|
|
#define mpz_mdiv_ui mpz_fdiv_q_ui
|
|
|
|
#define mpz_mdivmod_ui(q,r,n,d) \
|
|
|
|
(((r) == 0) ? mpz_fdiv_q_ui (q,n,d) : mpz_fdiv_qr_ui (q,r,n,d))
|
|
|
|
#define mpz_mmod_ui(r,n,d) \
|
|
|
|
(((r) == 0) ? mpz_fdiv_ui (n,d) : mpz_fdiv_r_ui (r,n,d))
|
|
|
|
|
2010-04-08 19:33:02 -04:00
|
|
|
#define gmp_randinit(x,y,z) gmp_randinit_lc_2exp_size(x,z)
|
|
|
|
|
|
|
|
typedef __mpz_struct MP_INT; /* gmp 1 source compatibility */
|
|
|
|
typedef __mpq_struct MP_RAT; /* gmp 1 source compatibility */
|
2010-04-08 18:58:35 -04:00
|
|
|
|
2010-03-12 06:05:23 -05:00
|
|
|
#define mpz_div mpz_fdiv_q
|
|
|
|
#define mpz_divmod mpz_fdiv_qr
|
|
|
|
#define mpz_div_ui mpz_fdiv_q_ui
|
|
|
|
#define mpz_divmod_ui mpz_fdiv_qr_ui
|
|
|
|
#define mpz_div_2exp mpz_fdiv_q_2exp
|
|
|
|
#define mpz_mod_2exp mpz_fdiv_r_2exp
|
|
|
|
|
2008-04-17 17:03:07 -04:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
GMP_ERROR_NONE = 0,
|
|
|
|
GMP_ERROR_UNSUPPORTED_ARGUMENT = 1,
|
|
|
|
GMP_ERROR_DIVISION_BY_ZERO = 2,
|
|
|
|
GMP_ERROR_SQRT_OF_NEGATIVE = 4,
|
|
|
|
GMP_ERROR_INVALID_ARGUMENT = 8
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Major version number is the value of __GNU_MP__ too, above and in mp.h. */
|
2017-02-13 10:42:13 -05:00
|
|
|
#define __GNU_MP_VERSION 6
|
|
|
|
#define __GNU_MP_VERSION_MINOR 0
|
|
|
|
#define __GNU_MP_VERSION_PATCHLEVEL 0
|
|
|
|
#define GMP_VERSION "6.0.0"
|
2012-09-01 03:13:16 -04:00
|
|
|
#define __GNU_MP_RELEASE (__GNU_MP_VERSION * 10000 + __GNU_MP_VERSION_MINOR * 100 + __GNU_MP_VERSION_PATCHLEVEL)
|
2008-07-22 22:26:25 -04:00
|
|
|
|
2017-02-14 05:05:01 -05:00
|
|
|
#define __MPIR_VERSION 3
|
|
|
|
#define __MPIR_VERSION_MINOR 0
|
|
|
|
#define __MPIR_VERSION_PATCHLEVEL 0
|
2010-04-06 05:57:32 -04:00
|
|
|
#if defined( _MSC_VER )
|
2017-02-14 05:05:01 -05:00
|
|
|
#define _MSC_MPIR_VERSION "3.0.0"
|
2010-04-06 05:57:32 -04:00
|
|
|
#endif
|
2012-09-01 03:13:16 -04:00
|
|
|
#define __MPIR_RELEASE (__MPIR_VERSION * 10000 + __MPIR_VERSION_MINOR * 100 + __MPIR_VERSION_PATCHLEVEL)
|
2008-04-17 17:03:07 -04:00
|
|
|
|
2009-04-11 06:04:45 -04:00
|
|
|
/* These are for programs like MPFR to use the same CC and CFLAGS as MPIR */
|
|
|
|
|
|
|
|
#if ! defined (__GMP_WITHIN_CONFIGURE)
|
|
|
|
@GMP_CC@
|
|
|
|
@GMP_CFLAGS@
|
|
|
|
#define __MPIR_CC "@CC@"
|
|
|
|
#define __MPIR_CFLAGS "@CFLAGS@"
|
|
|
|
#endif
|
|
|
|
|
2008-04-17 17:03:07 -04:00
|
|
|
#define __GMP_H__
|
|
|
|
#endif /* __GMP_H__ */
|