changed gmp.h to mpir.h for a few odd cases left
This commit is contained in:
parent
c6bffec6ad
commit
a6ab0a96b3
10
Makefile.am
10
Makefile.am
@ -101,25 +101,25 @@ GMPXX_HEADERS_OPTION = gmpxx.h
|
||||
endif
|
||||
EXTRA_DIST += gmpxx.h
|
||||
|
||||
# gmp.h and mp.h are architecture dependent, mainly since they encode the
|
||||
# mpir.h and mp.h are architecture dependent, mainly since they encode the
|
||||
# limb size used in libgmp. For that reason they belong under $exec_prefix
|
||||
# not $prefix, strictly speaking.
|
||||
#
|
||||
# $exec_prefix/include is not in the default include path for gcc built to
|
||||
# the same $prefix and $exec_prefix, which might mean gmp.h is not found,
|
||||
# the same $prefix and $exec_prefix, which might mean mpir.h is not found,
|
||||
# but anyone knowledgable enough to be playing with exec_prefix will be able
|
||||
# to address that.
|
||||
#
|
||||
includeexecdir = $(exec_prefix)/include
|
||||
include_HEADERS = $(GMPXX_HEADERS_OPTION)
|
||||
nodist_includeexec_HEADERS = gmp.h $(MPBSD_HEADERS_OPTION)
|
||||
nodist_includeexec_HEADERS = mpir.h $(MPBSD_HEADERS_OPTION)
|
||||
lib_LTLIBRARIES = libgmp.la $(GMPXX_LTLIBRARIES_OPTION) $(MPBSD_LTLIBRARIES_OPTION)
|
||||
|
||||
BUILT_SOURCES = gmp.h
|
||||
BUILT_SOURCES = mpir.h
|
||||
|
||||
DISTCLEANFILES = $(BUILT_SOURCES) config.m4 @gmp_srclinks@
|
||||
|
||||
# Tell gmp.h it's building gmp, not an application, used by windows DLL stuff.
|
||||
# Tell mpir.h it's building gmp, not an application, used by windows DLL stuff.
|
||||
INCLUDES=-D__GMP_WITHIN_GMP
|
||||
|
||||
|
||||
|
18
acinclude.m4
18
acinclude.m4
@ -111,11 +111,11 @@ done
|
||||
dnl GMP_INCLUDE_GMP_H
|
||||
dnl -----------------
|
||||
dnl Expand to the right way to #include gmp-h.in. This must be used
|
||||
dnl instead of gmp.h, since that file isn't generated until the end of the
|
||||
dnl instead of mpir.h, since that file isn't generated until the end of the
|
||||
dnl configure.
|
||||
dnl
|
||||
dnl Dummy values for __GMP_BITS_PER_MP_LIMB and GMP_LIMB_BITS are enough
|
||||
dnl for all current configure-time uses of gmp.h.
|
||||
dnl for all current configure-time uses of mpir.h.
|
||||
|
||||
define(GMP_INCLUDE_GMP_H,
|
||||
[[#define __GMP_WITHIN_CONFIGURE 1 /* ignore template stuff */
|
||||
@ -3311,7 +3311,7 @@ dnl HAVE_STDARG_H which could arise from AC_CHECK_HEADERS.
|
||||
dnl
|
||||
dnl This test might be slight overkill, after all there's really only going
|
||||
dnl to be ANSI or K&R and the two can be differentiated by AC_PROG_CC_STDC
|
||||
dnl or very likely by the setups for _PROTO in gmp.h. On the other hand
|
||||
dnl or very likely by the setups for _PROTO in mpir.h. On the other hand
|
||||
dnl this test is nice and direct, being what we're going to actually use.
|
||||
|
||||
AC_DEFUN([GMP_C_STDARG],
|
||||
@ -3565,7 +3565,7 @@ fi
|
||||
|
||||
dnl GMP_H_ANSI
|
||||
dnl ----------
|
||||
dnl Check whether gmp.h recognises the compiler as ANSI capable.
|
||||
dnl Check whether mpir.h recognises the compiler as ANSI capable.
|
||||
|
||||
AC_DEFUN([GMP_H_ANSI],
|
||||
[AC_REQUIRE([AC_PROG_CC_STDC])
|
||||
@ -3579,7 +3579,7 @@ GMP_INCLUDE_GMP_H
|
||||
die die die
|
||||
#endif
|
||||
],,,
|
||||
[AC_MSG_WARN([gmp.h doesnt recognise compiler as ANSI, prototypes and "const" will be unavailable])])
|
||||
[AC_MSG_WARN([mpir.h doesnt recognise compiler as ANSI, prototypes and "const" will be unavailable])])
|
||||
;;
|
||||
esac
|
||||
])
|
||||
@ -3588,7 +3588,7 @@ esac
|
||||
dnl GMP_H_EXTERN_INLINE
|
||||
dnl -------------------
|
||||
dnl If the compiler has an "inline" of some sort, check whether the
|
||||
dnl #ifdef's in gmp.h recognise it.
|
||||
dnl #ifdef's in mpir.h recognise it.
|
||||
|
||||
AC_DEFUN([GMP_H_EXTERN_INLINE],
|
||||
[AC_REQUIRE([AC_C_INLINE])
|
||||
@ -3606,7 +3606,7 @@ die die die
|
||||
yes) tmp_inline=inline ;;
|
||||
*) tmp_inline=$ac_cv_c_inline ;;
|
||||
esac
|
||||
AC_MSG_WARN([gmp.h doesnt recognise compiler "$tmp_inline", inlines will be unavailable])])
|
||||
AC_MSG_WARN([mpir.h doesnt recognise compiler "$tmp_inline", inlines will be unavailable])])
|
||||
;;
|
||||
esac
|
||||
])
|
||||
@ -3614,7 +3614,7 @@ esac
|
||||
|
||||
dnl GMP_H_HAVE_FILE
|
||||
dnl ---------------
|
||||
dnl Check whether the #ifdef's in gmp.h recognise when stdio.h has been
|
||||
dnl Check whether the #ifdef's in mpir.h recognise when stdio.h has been
|
||||
dnl included to get FILE.
|
||||
|
||||
AC_DEFUN([GMP_H_HAVE_FILE],
|
||||
@ -3625,7 +3625,7 @@ GMP_INCLUDE_GMP_H
|
||||
die die die
|
||||
#endif
|
||||
],,,
|
||||
[AC_MSG_WARN([gmp.h doesnt recognise <stdio.h>, FILE prototypes will be unavailable])])
|
||||
[AC_MSG_WARN([mpir.h doesnt recognise <stdio.h>, FILE prototypes will be unavailable])])
|
||||
])
|
||||
|
||||
|
||||
|
10
configure.in
10
configure.in
@ -56,7 +56,7 @@ GMP_INIT(config.m4)
|
||||
AC_CANONICAL_HOST
|
||||
|
||||
dnl Automake "no-dependencies" is used because include file dependencies
|
||||
dnl are not useful to us. Pretty much everything depends just on gmp.h,
|
||||
dnl are not useful to us. Pretty much everything depends just on mpir.h,
|
||||
dnl gmp-impl.h and longlong.h, and yet only rarely does everything need to
|
||||
dnl be rebuilt for changes to those files.
|
||||
dnl
|
||||
@ -342,7 +342,7 @@ AH_VERBATIM([HAVE_HOST_CPU_1],
|
||||
#
|
||||
# limb=longlong (or limb_aa=longlong) applies to all compilers within that
|
||||
# ABI. It won't work to have some needing long long and some not, since a
|
||||
# single instantiated gmp.h will be used by both.
|
||||
# single instantiated mpir.h will be used by both.
|
||||
#
|
||||
# SPEED_CYCLECOUNTER, cyclecounter_size and CALLING_CONVENTIONS_OBJS are
|
||||
# also set here, with an ABI suffix.
|
||||
@ -1925,7 +1925,7 @@ else
|
||||
fi
|
||||
|
||||
|
||||
# Long long limb setup for gmp.h.
|
||||
# Long long limb setup for mpir.h.
|
||||
case $limb_chosen in
|
||||
longlong) DEFN_LONG_LONG_LIMB="#define _LONG_LONG_LIMB 1" ;;
|
||||
*) DEFN_LONG_LONG_LIMB="/* #undef _LONG_LONG_LIMB */" ;;
|
||||
@ -2130,7 +2130,7 @@ case $host in
|
||||
fi
|
||||
# Don't allow both static and DLL.
|
||||
if test "$enable_shared" != no && test "$enable_static" != no; then
|
||||
AC_MSG_ERROR([cannot build both static and DLL, since gmp.h is different for each.
|
||||
AC_MSG_ERROR([cannot build both static and DLL, since mpir.h is different for each.
|
||||
Use "--disable-static --enable-shared" to build just a DLL.])
|
||||
fi
|
||||
|
||||
@ -3281,4 +3281,4 @@ GMP_FINISH
|
||||
# FIXME: Upcoming version of autoconf/automake don't like broken lines.
|
||||
# Right now automake isn't accepting the new AC_CONFIG_FILES scheme.
|
||||
|
||||
AC_OUTPUT(Makefile mpbsd/Makefile mpf/Makefile mpn/Makefile mpq/Makefile mpz/Makefile printf/Makefile scanf/Makefile cxx/Makefile tests/Makefile tests/devel/Makefile tests/mpbsd/Makefile tests/mpf/Makefile tests/mpn/Makefile tests/mpq/Makefile tests/mpz/Makefile tests/rand/Makefile tests/misc/Makefile tests/cxx/Makefile doc/Makefile tune/Makefile demos/Makefile demos/calc/Makefile demos/expr/Makefile gmp.h:gmp-h.in mp.h:mp-h.in)
|
||||
AC_OUTPUT(Makefile mpbsd/Makefile mpf/Makefile mpn/Makefile mpq/Makefile mpz/Makefile printf/Makefile scanf/Makefile cxx/Makefile tests/Makefile tests/devel/Makefile tests/mpbsd/Makefile tests/mpf/Makefile tests/mpn/Makefile tests/mpq/Makefile tests/mpz/Makefile tests/rand/Makefile tests/misc/Makefile tests/cxx/Makefile doc/Makefile tune/Makefile demos/Makefile demos/calc/Makefile demos/expr/Makefile mpir.h:gmp-h.in mp.h:mp-h.in)
|
||||
|
@ -47,7 +47,7 @@ Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "gmp.h"
|
||||
#include "mpir.h"
|
||||
#define NO_CALC_H /* because it conflicts with normal calc.c stuff */
|
||||
#include "calc-common.h"
|
||||
|
||||
|
@ -20,7 +20,7 @@ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
MA 02110-1301, USA. */
|
||||
|
||||
|
||||
/* Same tests as gmp.h. */
|
||||
/* Same tests as mpir.h. */
|
||||
#if defined (__STDC__) \
|
||||
|| defined (__cplusplus) \
|
||||
|| defined (_AIX) \
|
||||
|
@ -76,7 +76,7 @@ MA 02110-1301, USA. */
|
||||
#include "XSUB.h"
|
||||
#include "patchlevel.h"
|
||||
|
||||
#include "gmp.h"
|
||||
#include "mpir.h"
|
||||
|
||||
|
||||
/* Perl 5.005 doesn't have SvIsUV, only 5.6 and up.
|
||||
|
@ -42,7 +42,7 @@ gen-bases.c - auto generates some hard coded macros for base conversion
|
||||
gen-facui.c - generates data tables for factorials, e.g. all factorials which fit in a limb
|
||||
gen-fib.c - generate data for Fibonnacci number tables
|
||||
gen-psqr.c - generates data for perfect square testing
|
||||
gmp-h.in - gmp.h with some platform dependent stuff not yet inserted (gmp.h is included by
|
||||
gmp-h.in - mpir.h with some platform dependent stuff not yet inserted (mpir.h is included by
|
||||
programs using MPIR and by code within MPIR)
|
||||
gmp-impl.h - internal include file containing all the macros used MPIR wide
|
||||
gmpxx.h - C++ class wrapper for MPIR types
|
||||
|
@ -301,7 +301,7 @@ At build time:
|
||||
*/Makefile.in \ configure / */Makefile
|
||||
config.in | -------------> | config.h
|
||||
gmp-h.in | | config.m4
|
||||
mp-h.in / | gmp.h
|
||||
mp-h.in / | mpir.h
|
||||
| mp.h
|
||||
\ fat.h (fat binary build only)
|
||||
|
||||
|
@ -24,7 +24,7 @@ Some compilers with hacks:
|
||||
- SCO OpenUNIX 8 cc
|
||||
- __cplusplus
|
||||
|
||||
Useful/undocumented macros in gmp.h:
|
||||
Useful/undocumented macros in mpir.h:
|
||||
====================================
|
||||
__GMPN_ABS(x) - absolute value
|
||||
__GMPN_MAX(h, i) - max of h and i
|
||||
@ -49,7 +49,7 @@ gmp_errno - integer corresponding to a GMP error condition:
|
||||
4 sqrt of negative
|
||||
8 invalid argument
|
||||
|
||||
Undocumented mpn functions prototyped in gmp.h:
|
||||
Undocumented mpn functions prototyped in mpir.h:
|
||||
===============================================
|
||||
mp_limb_t mpn_preinv_mod_1(mp_srcptr sp, mp_size_t sn, mp_limb_t x, mp_limb_t xinv) -
|
||||
compute {sp, sn} mod x given a precomputed inverse xinv of x
|
||||
|
@ -44,7 +44,7 @@ MA 02110-1301, USA.
|
||||
|
||||
<h4>Correctness and Completeness</h4>
|
||||
<ul>
|
||||
<li> <code>_LONG_LONG_LIMB</code> in gmp.h is not namespace clean. Reported
|
||||
<li> <code>_LONG_LONG_LIMB</code> in mpir.h is not namespace clean. Reported
|
||||
by Patrick Pelissier.
|
||||
<br>
|
||||
We sort of mentioned <code>_LONG_LONG_LIMB</code> in past releases, so
|
||||
@ -161,7 +161,7 @@ MA 02110-1301, USA.
|
||||
<code>mpn_mod_1</code> (not sure currently whether all the risc chips
|
||||
provoke the right exception there if using mul-by-inverse).
|
||||
<li> Consider inlining: <code>mpz_fits_s*_p</code>. The setups for
|
||||
<code>LONG_MAX</code> etc would need to go into gmp.h, and on Cray it
|
||||
<code>LONG_MAX</code> etc would need to go into mpir.h, and on Cray it
|
||||
might, unfortunately, be necessary to forcibly include <limits.h>
|
||||
since there's no apparent way to get <code>SHRT_MAX</code> with an
|
||||
expression (since <code>short</code> and <code>unsigned short</code> can
|
||||
@ -230,7 +230,7 @@ MA 02110-1301, USA.
|
||||
<li> <code>mpn_add_1</code>, <code>mpn_sub_1</code>, <code>mpn_add</code>,
|
||||
<code>mpn_sub</code>: Internally use <code>__GMPN_ADD_1</code> etc
|
||||
instead of the functions, so they get inlined on all compilers, not just
|
||||
gcc and others with <code>inline</code> recognised in gmp.h.
|
||||
gcc and others with <code>inline</code> recognised in mpir.h.
|
||||
<code>__GMPN_ADD_1</code> etc are meant mostly to support application
|
||||
inline <code>mpn_add_1</code> etc and if they don't come out good for
|
||||
internal uses then special forms can be introduced, for instance many
|
||||
@ -521,9 +521,9 @@ MA 02110-1301, USA.
|
||||
little-endian and big-endian machines. A format which MPFR can use too
|
||||
would be good.
|
||||
<li> <code>mpn_and_n</code> ... <code>mpn_copyd</code>: Perhaps make the mpn
|
||||
logops and copys available in gmp.h, either as library functions or
|
||||
logops and copys available in mpir.h, either as library functions or
|
||||
inlines, with the availability of library functions instantiated in the
|
||||
generated gmp.h at build time.
|
||||
generated mpir.h at build time.
|
||||
<li> <code>mpz_set_str</code> etc variants taking string lengths rather than
|
||||
null-terminators.
|
||||
<li> <code>mpz_andn</code>, <code>mpz_iorn</code>, <code>mpz_nand</code>,
|
||||
@ -538,7 +538,7 @@ MA 02110-1301, USA.
|
||||
Eg. 0xFFAA@0x5A. A leading "0" for octal would match the integers, but
|
||||
probably something like "0.123" ought not mean octal.
|
||||
<li> <code>GMP_LONG_LONG_LIMB</code> or some such could become a documented
|
||||
feature of gmp.h, so applications could know whether to
|
||||
feature of mpir.h, so applications could know whether to
|
||||
<code>printf</code> a limb using <code>%lu</code> or <code>%Lu</code>.
|
||||
<li> <code>GMP_PRIdMP_LIMB</code> and similar defines following C99
|
||||
<inttypes.h> might be of use to applications printing limbs. But
|
||||
@ -599,7 +599,7 @@ MA 02110-1301, USA.
|
||||
libgmp.a would be
|
||||
<ul>
|
||||
<li> Library contents vary according to the build compiler.
|
||||
<li> gmp.h would need an ugly <code>#ifdef</code> block to decide if the
|
||||
<li> mpir.h would need an ugly <code>#ifdef</code> block to decide if the
|
||||
application compiler could take the <code>long long</code>
|
||||
prototypes.
|
||||
<li> Some sort of <code>LIBGMP_HAS_LONGLONG</code> might be wanted to
|
||||
|
38
doc/gmp.texi
38
doc/gmp.texi
@ -618,7 +618,7 @@ install under a particular tree. The default is @samp{/usr/local}.
|
||||
@option{--exec-prefix} can be used to direct architecture-dependent files like
|
||||
@file{libgmp.a}/@file{libmpir.a} to a different location. This can be used to share
|
||||
architecture-independent parts like the documentation, but separate the
|
||||
dependent parts. Note however that @file{gmp.h}/@file{mpir.h} and @file{mp.h} are
|
||||
dependent parts. Note however that @file{mpir.h} and @file{mp.h} are
|
||||
architecture-dependent since they encode certain aspects of @file{libgmp}/@file{libmpir}, so
|
||||
it will be necessary to ensure both @file{$prefix/include} and
|
||||
@file{$exec_prefix/include} are available to the compiler.
|
||||
@ -1121,9 +1121,9 @@ In all cases it's vital that all object code used in a given program is
|
||||
compiled for the same ABI.
|
||||
|
||||
Usually a limb is implemented as a @code{long}. When a @code{long long} limb
|
||||
is used this is encoded in the generated @file{gmp.h}/@file{mpir.h}. This is convenient for
|
||||
applications, but it does mean that @file{gmp.h}/@file{mpir.h} will vary, and can't be just
|
||||
copied around. @file{gmp.h}/@file{mpir.h} remains compiler independent though, since all
|
||||
is used this is encoded in the generated @file{mpir.h}. This is convenient for
|
||||
applications, but it does mean that @file{mpir.h} will vary, and can't be just
|
||||
copied around. @file{mpir.h} remains compiler independent though, since all
|
||||
compilers for a particular ABI will be expected to use the same limb type.
|
||||
|
||||
Currently no attempt is made to follow whatever conventions a system has for
|
||||
@ -1441,12 +1441,12 @@ conventions for install locations that vary with ABI, such as
|
||||
@samp{ABI=32}. A package build can override @samp{libdir} and other standard
|
||||
variables as necessary.
|
||||
|
||||
Note that @file{gmp.h}/@file{mpir.h} is a generated file, and will be architecture and ABI
|
||||
Note that @file{mpir.h} is a generated file, and will be architecture and ABI
|
||||
dependent. When attempting to install two ABIs simultaneously it will be
|
||||
important that an application compile gets the correct @file{gmp.h}/@file{mpir.h} for its
|
||||
important that an application compile gets the correct @file{mpir.h} for its
|
||||
desired ABI@. If compiler include paths don't vary with ABI options then it
|
||||
might be necessary to create a @file{/usr/include/gmp.h} or @file{/usr/include/mpir.h} which tests
|
||||
preprocessor symbols and chooses the correct actual @file{gmp.h}/@file{mpir.h}.
|
||||
might be necessary to create a @file{/usr/include/mpir.h} which tests
|
||||
preprocessor symbols and chooses the correct actual @file{mpir.h}.
|
||||
|
||||
|
||||
@need 2000
|
||||
@ -1545,7 +1545,7 @@ default MPIR builds only a static library, but a DLL can be built instead using
|
||||
@end example
|
||||
|
||||
Static and DLL libraries can't both be built, since certain export directives
|
||||
in @file{gmp.h}/@file{mpir.h} must be different.
|
||||
in @file{mpir.h} must be different.
|
||||
|
||||
A MINGW DLL build of MPIR can be used with Microsoft C@. Libtool doesn't
|
||||
install a @file{.lib} format import library, but it can be created with MS
|
||||
@ -1811,11 +1811,11 @@ to be incompatible with future versions of MPIR.}
|
||||
@section Headers and Libraries
|
||||
@cindex Headers
|
||||
|
||||
@cindex @file{gmp.h}/@file{mpir.h}
|
||||
@cindex @file{mpir.h}
|
||||
@cindex Include files
|
||||
@cindex @code{#include}
|
||||
All declarations needed to use MPIR are collected in the include file
|
||||
@file{gmp.h}/@file{mpir.h}. It is designed to work with both C and C++ compilers.
|
||||
@file{mpir.h}. It is designed to work with both C and C++ compilers.
|
||||
|
||||
@example
|
||||
#include <mpir.h>
|
||||
@ -2803,7 +2803,7 @@ AC_CHECK_LIB(mpir, __gmpz_mul_si, ,
|
||||
[GMP/MPIR not found, or not GMP 3.1 or up or MPIR 1.0 or up, see http://www.mpir.org/])])
|
||||
@end example
|
||||
|
||||
An alternative would be to test the version number in @file{gmp.h}/@file{mpir.h} using say
|
||||
An alternative would be to test the version number in @file{mpir.h} using say
|
||||
@code{AC_EGREP_CPP}. That would make it possible to test the exact version,
|
||||
if some particular sub-minor release is known to be necessary.
|
||||
|
||||
@ -3770,7 +3770,7 @@ these functions will make them read from @code{stdin} and write to
|
||||
@code{stdout}, respectively.
|
||||
|
||||
When using any of these functions, it is a good idea to include @file{stdio.h}
|
||||
before @file{gmp.h}/@file{mpir.h}, since that will allow @file{gmp.h}/@file{mpir.h} to define prototypes
|
||||
before @file{mpir.h}, since that will allow @file{mpir.h} to define prototypes
|
||||
for these functions.
|
||||
|
||||
@deftypefun size_t mpz_out_str (FILE *@var{stream}, int @var{base}, mpz_t @var{op})
|
||||
@ -4374,7 +4374,7 @@ recommended instead of these functions.
|
||||
@cindex I/O functions
|
||||
|
||||
When using any of these functions, it's a good idea to include @file{stdio.h}
|
||||
before @file{gmp.h}/@file{mpir.h}, since that will allow @file{gmp.h}/@file{mpir.h} to define prototypes
|
||||
before @file{mpir.h}, since that will allow @file{mpir.h} to define prototypes
|
||||
for these functions.
|
||||
|
||||
Passing a @code{NULL} pointer for a @var{stream} argument to any of these
|
||||
@ -4860,7 +4860,7 @@ any of these functions will make them read from @code{stdin} and write to
|
||||
@code{stdout}, respectively.
|
||||
|
||||
When using any of these functions, it is a good idea to include @file{stdio.h}
|
||||
before @file{gmp.h}/@file{mpir.h}, since that will allow @file{gmp.h}/@file{mpir.h} to define prototypes
|
||||
before @file{mpir.h}, since that will allow @file{mpir.h} to define prototypes
|
||||
for these functions.
|
||||
|
||||
@deftypefun size_t mpf_out_str (FILE *@var{stream}, int @var{base}, size_t @var{n_digits}, mpf_t @var{op})
|
||||
@ -5889,7 +5889,7 @@ Obstacks, libc, The GNU C Library Reference Manual}.
|
||||
|
||||
The following functions are provided in @file{libgmpxx}/@file{libmpirxx} (@pxref{Headers and
|
||||
Libraries}), which is built if C++ support is enabled (@pxref{Build Options}).
|
||||
Prototypes are available from @code{<gmp.h>} or @code{<mpir.h>}.
|
||||
Prototypes are available from @code{<mpir.h>}.
|
||||
|
||||
@deftypefun ostream& operator<< (ostream& @var{stream}, mpz_t @var{op})
|
||||
Print @var{op} to @var{stream}, using its @code{ios} formatting settings.
|
||||
@ -6178,7 +6178,7 @@ way C99 @code{sscanf} is the same as @code{fscanf}.
|
||||
|
||||
The following functions are provided in @file{libgmpxx}/@file{libmpirxx} (@pxref{Headers and
|
||||
Libraries}), which is built only if C++ support is enabled (@pxref{Build
|
||||
Options}). Prototypes are available from @code{<gmp.h>} or @code{<mpir.h>}.
|
||||
Options}). Prototypes are available from @code{<mpir.h>}.
|
||||
|
||||
@deftypefun istream& operator>> (istream& @var{stream}, mpz_t @var{rop})
|
||||
Read @var{rop} from @var{stream}, using its @code{ios} formatting settings.
|
||||
@ -6230,7 +6230,7 @@ results. For classes with overloading, see @ref{C++ Class Interface}.
|
||||
This chapter describes the C++ class based interface to MPIR.
|
||||
|
||||
All MPIR C language types and functions can be used in C++ programs, since
|
||||
@file{gmp.h}/@file{mpir.h} has @code{extern "C"} qualifiers, but the class interface offers
|
||||
@file{mpir.h} has @code{extern "C"} qualifiers, but the class interface offers
|
||||
overloaded functions and operators which may be more convenient.
|
||||
|
||||
Due to the implementation of this interface, a reasonably recent C++ compiler
|
||||
@ -6349,7 +6349,7 @@ y = mpz_class (z);
|
||||
@end example
|
||||
|
||||
There are no namespace setups in @file{gmpxx.h}, all types and functions are
|
||||
simply put into the global namespace. This is what @file{gmp.h}/@file{mpir.h} has done in
|
||||
simply put into the global namespace. This is what @file{mpir.h} has done in
|
||||
the past, and continues to do for compatibility. The extras provided by
|
||||
@file{gmpxx.h} follow MPIR naming conventions and are unlikely to clash with
|
||||
anything.
|
||||
|
2
dumbmp.c
2
dumbmp.c
@ -25,7 +25,7 @@ MA 02110-1301, USA. */
|
||||
will be slow, but highly portable.
|
||||
|
||||
None of the normal GMP configure things are used, nor any of the normal
|
||||
gmp.h or gmp-impl.h. To use this file in a program just #include
|
||||
mpir.h or gmp-impl.h. To use this file in a program just #include
|
||||
"dumbmp.c".
|
||||
|
||||
ANSI function definitions can be used here, since ansi2knr is run if
|
||||
|
@ -107,7 +107,7 @@ table (int limb_bits, int nail_bits)
|
||||
|
||||
printf ("/* This file generated by gen-bases.c - DO NOT EDIT. */\n");
|
||||
printf ("\n");
|
||||
printf ("#include \"gmp.h\"\n");
|
||||
printf ("#include \"mpir.h\"\n");
|
||||
printf ("#include \"gmp-impl.h\"\n");
|
||||
printf ("\n");
|
||||
printf ("#if GMP_NUMB_BITS != %d\n", numb_bits);
|
||||
|
@ -88,7 +88,7 @@ table (int numb_bits)
|
||||
|
||||
printf ("/* This file generated by gen-fib.c - DO NOT EDIT. */\n");
|
||||
printf ("\n");
|
||||
printf ("#include \"gmp.h\"\n");
|
||||
printf ("#include \"mpir.h\"\n");
|
||||
printf ("#include \"gmp-impl.h\"\n");
|
||||
printf ("\n");
|
||||
printf ("#if GMP_NUMB_BITS != %d\n", numb_bits);
|
||||
|
@ -70,7 +70,7 @@ MA 02110-1301, USA. */
|
||||
bother figuring out if it works, but using it with f_cmp_divisor and
|
||||
f_cmp_fraction avoids warnings from the qsort calls. */
|
||||
|
||||
/* Same tests as gmp.h. */
|
||||
/* Same tests as mpir.h. */
|
||||
#if defined (__STDC__) \
|
||||
|| defined (__cplusplus) \
|
||||
|| defined (_AIX) \
|
||||
|
2
gmp-h.in
2
gmp-h.in
@ -45,7 +45,7 @@ MA 02110-1301, USA. */
|
||||
|
||||
|
||||
/* The following (everything under ifndef __GNU_MP__) must be identical in
|
||||
gmp.h and mp.h to allow both to be included in an application or during
|
||||
mpir.h and mp.h to allow both to be included in an application or during
|
||||
the library build. */
|
||||
#ifndef __GNU_MP__
|
||||
#define __GNU_MP__ 4
|
||||
|
@ -151,7 +151,7 @@ MA 02110-1301, USA. */
|
||||
The autoconf manual says this pragma needs to be at the start of a C
|
||||
file, apart from comments and preprocessor directives. Is that true?
|
||||
xlc on aix 4.xxx doesn't seem to mind it being after prototypes etc
|
||||
from gmp.h.
|
||||
from mpir.h.
|
||||
*/
|
||||
|
||||
#ifndef alloca
|
||||
@ -208,7 +208,7 @@ typedef unsigned long gmp_uint_least32_t;
|
||||
|
||||
|
||||
/* const and signed must match __gmp_const and __gmp_signed, so follow the
|
||||
decision made for those in gmp.h. */
|
||||
decision made for those in mpir.h. */
|
||||
#if ! __GMP_HAVE_CONST
|
||||
#define const /* empty */
|
||||
#define signed /* empty */
|
||||
@ -466,7 +466,7 @@ void __gmp_tmp_debug_free _PROTO ((const char *, int, int,
|
||||
} while (0)
|
||||
|
||||
|
||||
/* From gmp.h, nicer names for internal use. */
|
||||
/* From mpir.h, nicer names for internal use. */
|
||||
#define CRAY_Pragma(str) __GMP_CRAY_Pragma(str)
|
||||
#define MPN_CMP(result, xp, yp, size) __GMPN_CMP(result, xp, yp, size)
|
||||
#define LIKELY(cond) __GMP_LIKELY(cond)
|
||||
@ -1204,7 +1204,7 @@ __GMP_DECLSPEC void mpn_copyd _PROTO ((mp_ptr, mp_srcptr, mp_size_t));
|
||||
gcc 2.95.x (for powerpc64 -maix64, or powerpc32) doesn't recognise the
|
||||
"for" loop in the generic code below can become stu/bdnz. The do/while
|
||||
here helps it get to that. The same caveat about plain -mpowerpc64 mode
|
||||
applies here as to __GMPN_COPY_INCR in gmp.h.
|
||||
applies here as to __GMPN_COPY_INCR in mpir.h.
|
||||
|
||||
xlc 3.1 already generates stu/bdnz from the generic C, and does so from
|
||||
this loop too.
|
||||
|
2
gmpxx.h
2
gmpxx.h
@ -41,7 +41,7 @@ MA 02110-1301, USA. */
|
||||
#include <cstring> /* for strlen */
|
||||
#include <string>
|
||||
#include <stdexcept>
|
||||
#include <gmp.h>
|
||||
#include <mpir.h>
|
||||
|
||||
/**************** Function objects ****************/
|
||||
/* Any evaluation of a __gmp_expr ends up calling one of these functions
|
||||
|
2
mp-h.in
2
mp-h.in
@ -25,7 +25,7 @@ MA 02110-1301, USA. */
|
||||
|
||||
|
||||
/* The following (everything under ifndef __GNU_MP__) must be identical in
|
||||
gmp.h and mp.h to allow both to be included in an application or during
|
||||
mpir.h and mp.h to allow both to be included in an application or during
|
||||
the library build. Use the t-gmp-mp-h.pl script to check. */
|
||||
#ifndef __GNU_MP__
|
||||
#define __GNU_MP__ 4
|
||||
|
@ -1293,7 +1293,7 @@ m4_assert_numargs(1)
|
||||
|
||||
dnl Usage: mpn_add_n, etc
|
||||
dnl
|
||||
dnl Convenience definitions using MPN(), like the #defines in gmp.h. Each
|
||||
dnl Convenience definitions using MPN(), like the #defines in mpir.h. Each
|
||||
dnl function that might be implemented in assembler is here.
|
||||
|
||||
define(define_mpn,
|
||||
|
@ -70,7 +70,7 @@ could be optimized substantially. For example,
|
||||
One novel idea for 68000 would be to use a 16-bit limb instead of 32-bits.
|
||||
This would suit the native 16x16 multiply, but might make it difficult to
|
||||
get full value from the native 32x32 add/sub/etc. This would be an ABI
|
||||
option, and would select "__GMP_SHORT_LIMB" in gmp.h.
|
||||
option, and would select "__GMP_SHORT_LIMB" in mpir.h.
|
||||
|
||||
Naturally an entirely new set of asm subroutines would be needed for a
|
||||
16-bit limb. Also there's various places in the C code assuming limb>=long,
|
||||
|
@ -1293,7 +1293,7 @@ m4_assert_numargs(1)
|
||||
|
||||
dnl Usage: mpn_add_n, etc
|
||||
dnl
|
||||
dnl Convenience definitions using MPN(), like the #defines in gmp.h. Each
|
||||
dnl Convenience definitions using MPN(), like the #defines in mpir.h. Each
|
||||
dnl function that might be implemented in assembler is here.
|
||||
|
||||
define(define_mpn,
|
||||
|
@ -118,7 +118,7 @@ MA 02110-1301, USA. */
|
||||
Right now there's no way for an application to know whether types like
|
||||
intmax_t are supported here. If configure is doing its job and the same
|
||||
compiler is used for gmp as for the application then there shouldn't be
|
||||
any problem, but perhaps gmp.h should have some preprocessor symbols to
|
||||
any problem, but perhaps mpir.h should have some preprocessor symbols to
|
||||
say what libgmp can do. */
|
||||
|
||||
|
||||
|
@ -21,7 +21,7 @@ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
/* This file requires the following header files: gmp.h */
|
||||
/* This file requires the following header files: mpir.h */
|
||||
|
||||
#ifndef __GMPSTAT_H__
|
||||
#define __GMPSTAT_H__
|
||||
|
@ -309,7 +309,7 @@ main (int argc, char *argv[])
|
||||
int bits;
|
||||
|
||||
printf ("\n");
|
||||
printf ("After gmp.h,\n");
|
||||
printf ("After mpir.h,\n");
|
||||
printf (" ULONG_MAX %s\n", ulong_max_def);
|
||||
printf (" LONG_MAX %s\n", long_max_def);
|
||||
printf (" UINT_MAX %s\n", uint_max_def);
|
||||
|
@ -25,7 +25,7 @@ MA 02110-1301, USA. */
|
||||
#include "mpir.h"
|
||||
|
||||
|
||||
/* __GMP_UINT_MAX etc are generated with expressions in gmp.h since we don't
|
||||
/* __GMP_UINT_MAX etc are generated with expressions in mpir.h since we don't
|
||||
want to demand <limits.h> or forcibly include it. Check the expressions
|
||||
come out the same as <limits.h>. */
|
||||
|
||||
|
@ -1090,7 +1090,7 @@ foreach my $file_full (@files) {
|
||||
print TMP_C
|
||||
"/* tmp-$objbase.c generated by many.pl - DO NOT EDIT, CHANGES WILL BE LOST */
|
||||
|
||||
#include \"gmp.h\"
|
||||
#include \"mpir.h\"
|
||||
#include \"gmp-impl.h\"
|
||||
#include \"longlong.h\"
|
||||
#include \"speed.h\"
|
||||
|
@ -523,7 +523,7 @@ int speed_routine_count_zeros_setup _PROTO ((struct speed_params *s,
|
||||
function pointer variable works, but stands a real risk of a
|
||||
non-optimizing compiler generating unnecessary overheads in the call.
|
||||
Currently the best idea is not to use those attributes for a timing
|
||||
program build. __GMP_NO_ATTRIBUTE_CONST_PURE will tell gmp.h and
|
||||
program build. __GMP_NO_ATTRIBUTE_CONST_PURE will tell mpir.h and
|
||||
gmp-impl.h to omit them from routines there. */
|
||||
|
||||
#define SPEED_RESTRICT_COND(cond) if (!(cond)) return -1.0;
|
||||
|
Loading…
Reference in New Issue
Block a user