summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTorbjorn Granlund <tege@gmplib.org>2010-11-12 22:06:32 +0100
committerTorbjorn Granlund <tege@gmplib.org>2010-11-12 22:06:32 +0100
commit3ee827409bd3a6f64b96e9fe082205da88128206 (patch)
treeb314b9ff7aca8da5ae4c704af97c9c8ac79ec73b
parent9aa234de37f83e6d150afd8504d2c726c86d7b38 (diff)
downloadgmp-3ee827409bd3a6f64b96e9fe082205da88128206.tar.gz
Purge BSD mp compatible functions.
-rw-r--r--ChangeLog11
-rw-r--r--Makefile.am35
-rw-r--r--configure.in29
-rw-r--r--doc/configuration10
-rw-r--r--doc/gmp.texi147
-rw-r--r--libmp.sym18
-rw-r--r--mpbsd/Makefile.am37
-rw-r--r--mpbsd/itom.c47
-rw-r--r--mpbsd/mfree.c29
-rw-r--r--mpbsd/min.c88
-rw-r--r--mpbsd/mout.c92
-rw-r--r--mpbsd/mtox.c61
-rw-r--r--mpbsd/rpow.c32
-rw-r--r--mpbsd/sdiv.c67
-rw-r--r--mpbsd/xtom.c87
-rw-r--r--tests/Makefile.am2
-rw-r--r--tests/mpbsd/Makefile.am35
-rw-r--r--tests/mpbsd/allfuns.c56
-rw-r--r--tests/mpbsd/t-itom.c74
-rw-r--r--tests/mpbsd/t-mtox.c86
20 files changed, 20 insertions, 1023 deletions
diff --git a/ChangeLog b/ChangeLog
index 3858a4716..a10935884 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2010-11-12 Torbjorn Granlund <tege@gmplib.org>
+
+ * Makefile.am: Remove mpbsd.
+ * configure.in: Remove mpbsd.
+ * doc/configuration: Remove mpbsd mentions.
+ * doc/gmp.texi: Remove mpbsd docs.
+ * tests/Makefile.am: Remove mpbsd.
+ * libmp.sym: Remove.
+ * mpbsd: Remove directory and files.
+ * tests/mpbsd: Remove directory and files.
+
2010-11-11 Torbjorn Granlund <tege@gmplib.org>
* mpn/x86_64/atom/aors_n.asm: Don't rely on ZF after 'bt' insn.
diff --git a/Makefile.am b/Makefile.am
index e70e98812..c259c2ca1 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -92,7 +92,7 @@ LIBMP_LT_REVISION = 21
LIBMP_LT_AGE = 1
-SUBDIRS = tests mpn mpz mpq mpf printf scanf rand cxx mpbsd demos tune doc
+SUBDIRS = tests mpn mpz mpq mpf printf scanf rand cxx demos tune doc
EXTRA_DIST = configfsf.guess configfsf.sub .gdbinit INSTALL.autoconf
@@ -112,8 +112,8 @@ EXTRA_DIST += gmpxx.h
#
includeexecdir = $(exec_prefix)/include
include_HEADERS = $(GMPXX_HEADERS_OPTION)
-nodist_includeexec_HEADERS = gmp.h $(MPBSD_HEADERS_OPTION)
-lib_LTLIBRARIES = libgmp.la $(GMPXX_LTLIBRARIES_OPTION) $(MPBSD_LTLIBRARIES_OPTION)
+nodist_includeexec_HEADERS = gmp.h
+lib_LTLIBRARIES = libgmp.la $(GMPXX_LTLIBRARIES_OPTION)
BUILT_SOURCES = gmp.h
@@ -233,13 +233,6 @@ CXX_OBJECTS = \
cxx/osdoprnti.lo cxx/osfuns.lo \
cxx/osmpf.lo cxx/osmpq.lo cxx/osmpz.lo
-MPBSD_OBJECTS = mpbsd/add$U.lo mpbsd/tdiv_qr$U.lo mpbsd/set$U.lo \
- mpbsd/powm$U.lo mpbsd/sub$U.lo mpbsd/cmp$U.lo mpbsd/mfree$U.lo \
- mpbsd/mtox$U.lo mpbsd/realloc$U.lo mpbsd/gcd$U.lo mpbsd/itom$U.lo \
- mpbsd/min$U.lo mpbsd/mul$U.lo mpbsd/mout$U.lo mpbsd/rpow$U.lo \
- mpbsd/sdiv$U.lo mpbsd/sqrtrem$U.lo mpbsd/xtom$U.lo
-
-
# In libtool 1.5 it doesn't work to build libgmp.la from the convenience
# libraries like mpz/libmpz.la. Or rather it works, but it ends up putting
# PIC objects into libgmp.a if shared and static are both built. (The PIC
@@ -282,28 +275,6 @@ libgmpxx_la_LDFLAGS = $(GMP_LDFLAGS) $(LIBGMPXX_LDFLAGS) \
-version-info $(LIBGMPXX_LT_CURRENT):$(LIBGMPXX_LT_REVISION):$(LIBGMPXX_LT_AGE)
-# The selected mpz objects here support mpz/powm.c (built as mpbsd/powm.lo)
-# and can probably be removed when that switches to an mpn implementation.
-# (Apart from mpz/n_pow_ui$U.lo, which supports mpbsd/rpow.c)
-
-if WANT_MPBSD
-MPBSD_HEADERS_OPTION = mp.h
-MPBSD_LTLIBRARIES_OPTION = libmp.la
-endif
-BUILT_SOURCES += mp.h
-libmp_la_SOURCES = assert.c errno.c memory.c mp_bpl.c mp_clz_tab.c \
- mp_dv_tab.c mp_minv_tab.c mp_get_fns.c mp_set_fns.c nextprime.c
-libmp_la_DEPENDENCIES = $(srcdir)/libmp.sym \
- @TAL_OBJECT@ $(MPBSD_OBJECTS) $(MPN_OBJECTS) @mpn_objs_in_libmp@ \
- mpz/add$U.lo mpz/gcdext$U.lo mpz/invert$U.lo mpz/mul$U.lo \
- mpz/n_pow_ui$U.lo mpz/realloc$U.lo mpz/set$U.lo mpz/sub$U.lo \
- mpz/tdiv_q$U.lo
-libmp_la_LIBADD = $(libmp_la_DEPENDENCIES)
-libmp_la_LDFLAGS = $(GMP_LDFLAGS) \
- -version-info $(LIBMP_LT_CURRENT):$(LIBMP_LT_REVISION):$(LIBMP_LT_AGE) \
- -export-symbols $(srcdir)/libmp.sym
-EXTRA_DIST += libmp.sym
-
install-data-hook:
@echo ''
diff --git a/configure.in b/configure.in
index a1ce848c7..1a98d2b26 100644
--- a/configure.in
+++ b/configure.in
@@ -150,17 +150,6 @@ if test "$enable_old_fft_full" = "yes"; then
fi
-AC_ARG_ENABLE(mpbsd,
-AC_HELP_STRING([--enable-mpbsd],
- [build Berkeley MP compatibility library [[default=no]]]),
-[case $enableval in
-yes|no) ;;
-*) AC_MSG_ERROR([bad value $enableval for --enable-mpbsd, need yes or no]) ;;
-esac],
-[enable_mpbsd=no])
-AM_CONDITIONAL(WANT_MPBSD, test "$enable_mpbsd" = "yes")
-
-
AC_ARG_ENABLE(nails,
AC_HELP_STRING([--enable-nails],[use nails on limbs [[default=no]]]),
[case $enableval in
@@ -3270,20 +3259,6 @@ GMP_DEFINE_RAW(["define(<GMP_NAIL_BITS>,$GMP_NAIL_BITS)"])
GMP_DEFINE_RAW(["define(<GMP_NUMB_BITS>,eval(GMP_LIMB_BITS-GMP_NAIL_BITS))"])
-# Exclude the mpn random functions from mpbsd since that would drag in the
-# top-level rand things, all of which are unnecessary for libmp. There's
-# other unnecessary objects too actually, if we could be bothered figuring
-# out exactly which they are.
-#
-mpn_objs_in_libmp=
-for i in $mpn_objs_in_libgmp; do
- case $i in
- *random*) ;;
- *) mpn_objs_in_libmp="$mpn_objs_in_libmp $i" ;;
- esac
-done
-AC_SUBST(mpn_objs_in_libmp)
-
AC_SUBST(mpn_objects)
AC_SUBST(mpn_objs_in_libgmp)
AC_SUBST(gmp_srclinks)
@@ -3390,9 +3365,9 @@ GMP_FINISH
# Right now automake isn't accepting the new AC_CONFIG_FILES scheme.
AC_OUTPUT(Makefile \
- mpbsd/Makefile mpf/Makefile mpn/Makefile mpq/Makefile \
+ mpf/Makefile mpn/Makefile mpq/Makefile \
mpz/Makefile printf/Makefile scanf/Makefile rand/Makefile cxx/Makefile \
- tests/Makefile tests/devel/Makefile tests/mpbsd/Makefile \
+ tests/Makefile tests/devel/Makefile \
tests/mpf/Makefile tests/mpn/Makefile tests/mpq/Makefile \
tests/mpz/Makefile tests/rand/Makefile tests/misc/Makefile \
tests/cxx/Makefile \
diff --git a/doc/configuration b/doc/configuration
index 77dc73f3c..903067cc5 100644
--- a/doc/configuration
+++ b/doc/configuration
@@ -323,10 +323,6 @@ errors rather than mysterious failures from a mismatch.
--disable-shared will make builds go much faster, though of course
shared or shared+static should be tested too.
---enable-mpbsd grabs various bits of mpz, which might need to be
-adjusted if things in those routines are changed. Building mpbsd all
-the time doesn't cost much.
-
--prefix to a dummy directory followed by "make install" will show
what's installed.
@@ -370,12 +366,6 @@ struct __mpz_struct etc - this must be retained for C++ compatibility.
will get this in the mangled name because C++ "sees though" the
typedef mpz_t to the underlying struct.
- Incidentally, this probably means for C++ that our mp.h is not
- compatible with an original BSD mp.h, since we use struct
- __mpz_struct for MINT in ours. Maybe we could change to whatever
- the original did, but it seems unlikely anyone would be using C++
- with mp.h.
-
__gmpn - note that glibc defines some __mpn symbols, old versions of
some mpn routines, which it uses for floating point printfs.
diff --git a/doc/gmp.texi b/doc/gmp.texi
index c3174f019..ff8e71d91 100644
--- a/doc/gmp.texi
+++ b/doc/gmp.texi
@@ -136,7 +136,6 @@ How to install and use the GNU multiple precision arithmetic library, version @v
* Formatted Output:: @code{printf} style output.
* Formatted Input:: @code{scanf} style input.
* C++ Class Interface:: Class wrappers around GMP types.
-* BSD Compatible Functions:: All functions found in BSD MP.
* Custom Allocation:: How to customize the internal allocation.
* Language Bindings:: Using GMP from other languages.
* Algorithms:: What happens behind the scenes.
@@ -1042,14 +1041,6 @@ By default multiplications are done using Karatsuba, 3-way Toom, and
Fermat FFT@. The FFT is only used on large to very large operands and can be
disabled to save code size if desired.
-@item Berkeley MP, @option{--enable-mpbsd}
-@cindex Berkeley MP compatible functions
-@cindex BSD MP compatible functions
-@cindex @code{--enable-mpbsd}
-The Berkeley MP compatibility library (@file{libmp}) and header file
-(@file{mp.h}) are built and installed only if @option{--enable-mpbsd} is used.
-@xref{BSD Compatible Functions}.
-
@item Assertion Checking, @option{--enable-assert}
@cindex Assertion checking
@cindex @code{--enable-assert}
@@ -1981,8 +1972,7 @@ functions is this class. (@pxref{Floating-point Functions})
@item
Functions compatible with Berkeley MP, such as @code{itom}, @code{madd}, and
-@code{mult}. The associated type is @code{MINT}. (@pxref{BSD Compatible
-Functions})
+@code{mult}. The associated type is @code{MINT}.
@item
Fast low-level functions that operate on natural numbers. These are used by
@@ -2241,10 +2231,6 @@ There are a number of compatibility issues between GMP 1 and GMP 2 that of
course also apply when porting applications from GMP 1 to GMP 4. Please
see the GMP 2 manual for details.
-The Berkeley MP compatibility library (@pxref{BSD Compatible Functions}) is
-source and binary compatible with the standard @file{libmp}.
-
-@c @enumerate
@c @item Integer division functions round the result differently. The obsolete
@c functions (@code{mpz_div}, @code{mpz_divmod}, @code{mpz_mdiv},
@c @code{mpz_mdivmod}, etc) now all use floor rounding (i.e., they round the
@@ -6367,7 +6353,7 @@ results. For classes with overloading, see @ref{C++ Class Interface}.
-@node C++ Class Interface, BSD Compatible Functions, Formatted Input, Top
+@node C++ Class Interface, Custom Allocation, Formatted Input, Top
@chapter C++ Class Interface
@cindex C++ interface
@@ -6938,131 +6924,7 @@ void fun (T f, T g)
@end table
-@node BSD Compatible Functions, Custom Allocation, C++ Class Interface, Top
-@comment node-name, next, previous, up
-@chapter Berkeley MP Compatible Functions
-@cindex Berkeley MP compatible functions
-@cindex BSD MP compatible functions
-
-These functions are intended to be fully compatible with the Berkeley MP
-library which is available on many BSD derived U*ix systems. The
-@samp{--enable-mpbsd} option must be used when building GNU MP to make these
-available (@pxref{Installing GMP}).
-
-The original Berkeley MP library has a usage restriction: you cannot use the
-same variable as both source and destination in a single function call. The
-compatible functions in GNU MP do not share this restriction---inputs and
-outputs may overlap.
-
-It is not recommended that new programs are written using these functions.
-Apart from the incomplete set of functions, the interface for initializing
-@code{MINT} objects is more error prone, and the @code{pow} function collides
-with @code{pow} in @file{libm.a}.
-
-@cindex @code{mp.h}
-@tindex MINT
-Include the header @file{mp.h} to get the definition of the necessary types and
-functions. If you are on a BSD derived system, make sure to include GNU
-@file{mp.h} if you are going to link the GNU @file{libmp.a} to your program.
-This means that you probably need to give the @samp{-I<dir>} option to the
-compiler, where @samp{<dir>} is the directory where you have GNU @file{mp.h}.
-
-@deftypefun {MINT *} itom (signed short int @var{initial_value})
-Allocate an integer consisting of a @code{MINT} object and dynamic limb space.
-Initialize the integer to @var{initial_value}. Return a pointer to the
-@code{MINT} object.
-@end deftypefun
-
-@deftypefun {MINT *} xtom (char *@var{initial_value})
-Allocate an integer consisting of a @code{MINT} object and dynamic limb space.
-Initialize the integer from @var{initial_value}, a hexadecimal,
-null-terminated C string. Return a pointer to the @code{MINT} object.
-@end deftypefun
-
-@deftypefun void move (MINT *@var{src}, MINT *@var{dest})
-Set @var{dest} to @var{src} by copying. Both variables must be previously
-initialized.
-@end deftypefun
-
-@deftypefun void madd (MINT *@var{src_1}, MINT *@var{src_2}, MINT *@var{destination})
-Add @var{src_1} and @var{src_2} and put the sum in @var{destination}.
-@end deftypefun
-
-@deftypefun void msub (MINT *@var{src_1}, MINT *@var{src_2}, MINT *@var{destination})
-Subtract @var{src_2} from @var{src_1} and put the difference in
-@var{destination}.
-@end deftypefun
-
-@deftypefun void mult (MINT *@var{src_1}, MINT *@var{src_2}, MINT *@var{destination})
-Multiply @var{src_1} and @var{src_2} and put the product in @var{destination}.
-@end deftypefun
-
-@deftypefun void mdiv (MINT *@var{dividend}, MINT *@var{divisor}, MINT *@var{quotient}, MINT *@var{remainder})
-@deftypefunx void sdiv (MINT *@var{dividend}, signed short int @var{divisor}, MINT *@var{quotient}, signed short int *@var{remainder})
-Set @var{quotient} to @var{dividend}/@var{divisor}, and @var{remainder} to
-@var{dividend} mod @var{divisor}. The quotient is rounded towards zero; the
-remainder has the same sign as the dividend unless it is zero.
-
-Some implementations of these functions work differently---or not at all---for
-negative arguments.
-@end deftypefun
-
-@deftypefun void msqrt (MINT *@var{op}, MINT *@var{root}, MINT *@var{remainder})
-Set @var{root} to @m{\lfloor\sqrt{@var{op}}\rfloor, the truncated integer part
-of the square root of @var{op}}, like @code{mpz_sqrt}. Set @var{remainder} to
-@m{(@var{op} - @var{root}^2), @var{op}@minus{}@var{root}*@var{root}}, i.e.
-zero if @var{op} is a perfect square.
-
-If @var{root} and @var{remainder} are the same variable, the results are
-undefined.
-@end deftypefun
-
-@deftypefun void pow (MINT *@var{base}, MINT *@var{exp}, MINT *@var{mod}, MINT *@var{dest})
-Set @var{dest} to (@var{base} raised to @var{exp}) modulo @var{mod}.
-
-Note that the name @code{pow} clashes with @code{pow} from the standard C math
-library (@pxref{Exponents and Logarithms,, Exponentiation and Logarithms,
-libc, The GNU C Library Reference Manual}). An application will only be able
-to use one or the other.
-@end deftypefun
-
-@deftypefun void rpow (MINT *@var{base}, signed short int @var{exp}, MINT *@var{dest})
-Set @var{dest} to @var{base} raised to @var{exp}.
-@end deftypefun
-
-@deftypefun void gcd (MINT *@var{op1}, MINT *@var{op2}, MINT *@var{res})
-Set @var{res} to the greatest common divisor of @var{op1} and @var{op2}.
-@end deftypefun
-
-@deftypefun int mcmp (MINT *@var{op1}, MINT *@var{op2})
-Compare @var{op1} and @var{op2}. Return a positive value if @var{op1} >
-@var{op2}, zero if @var{op1} = @var{op2}, and a negative value if @var{op1} <
-@var{op2}.
-@end deftypefun
-
-@deftypefun void min (MINT *@var{dest})
-Input a decimal string from @code{stdin}, and put the read integer in
-@var{dest}. SPC and TAB are allowed in the number string, and are ignored.
-@end deftypefun
-
-@deftypefun void mout (MINT *@var{src})
-Output @var{src} to @code{stdout}, as a decimal string. Also output a newline.
-@end deftypefun
-
-@deftypefun {char *} mtox (MINT *@var{op})
-Convert @var{op} to a hexadecimal string, and return a pointer to the string.
-The returned string is allocated using the default memory allocation function,
-@code{malloc} by default. It will be @code{strlen(str)+1} bytes, that being
-exactly enough for the string and null-terminator.
-@end deftypefun
-
-@deftypefun void mfree (MINT *@var{op})
-De-allocate, the space used by @var{op}. @strong{This function should only be
-passed a value returned by @code{itom} or @code{xtom}.}
-@end deftypefun
-
-
-@node Custom Allocation, Language Bindings, BSD Compatible Functions, Top
+@node Custom Allocation, Language Bindings, C++ Class Interface, Top
@comment node-name, next, previous, up
@chapter Custom Allocation
@cindex Custom allocation
@@ -7076,9 +6938,6 @@ and terminates the program.
Alternate functions can be specified, to allocate memory in a different way or
to have a different error action on running out of memory.
-This feature is available in the Berkeley compatibility library (@pxref{BSD
-Compatible Functions}) as well as the main GMP library.
-
@deftypefun void mp_set_memory_functions (@* void *(*@var{alloc_func_ptr}) (size_t), @* void *(*@var{realloc_func_ptr}) (void *, size_t, size_t), @* void (*@var{free_func_ptr}) (void *, size_t))
Replace the current allocation functions from the arguments. If an argument
is @code{NULL}, the corresponding default function is used.
diff --git a/libmp.sym b/libmp.sym
deleted file mode 100644
index f36d5c0ac..000000000
--- a/libmp.sym
+++ /dev/null
@@ -1,18 +0,0 @@
-itom
-xtom
-move
-madd
-msub
-mult
-mdiv
-sdiv
-msqrt
-pow
-rpow
-gcd
-mcmp
-min
-mout
-mtox
-mfree
-__gmp_set_memory_functions
diff --git a/mpbsd/Makefile.am b/mpbsd/Makefile.am
deleted file mode 100644
index 4272bbf97..000000000
--- a/mpbsd/Makefile.am
+++ /dev/null
@@ -1,37 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-# Copyright 1996, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
-#
-# This file is part of the GNU MP Library.
-#
-# The GNU MP Library is free software; you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or (at your
-# option) any later version.
-#
-# The GNU MP Library is distributed in the hope that it will be useful, but
-# 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
-# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
-
-
-# -I$(top_srcdir)/mpz is for #includes done by mpz .c files. Perhaps most
-# compilers are smart enough to look in the same directory as the .c file
-# already, but lets make absolutely sure.
-#
-INCLUDES = -DBERKELEY_MP -D__GMP_WITHIN_GMP -D__gmpz_realloc=_mp_realloc \
- -I$(top_srcdir) -I$(top_srcdir)/mpz
-
-# The mpz sources here all know to look for -DBERKELEY_MP to compile to in
-# mpbsd form.
-#
-libmpbsd_la_SOURCES = itom.c mfree.c min.c mout.c mtox.c rpow.c sdiv.c xtom.c \
- ../mpz/add.c ../mpz/cmp.c ../mpz/gcd.c ../mpz/mul.c ../mpz/powm.c \
- ../mpz/realloc.c ../mpz/set.c ../mpz/sqrtrem.c ../mpz/sub.c ../mpz/tdiv_qr.c
-
-if WANT_MPBSD
-noinst_LTLIBRARIES = libmpbsd.la
-endif
diff --git a/mpbsd/itom.c b/mpbsd/itom.c
deleted file mode 100644
index 6f0e31c01..000000000
--- a/mpbsd/itom.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/* itom -- BSD compatible allocate and initiate a MINT.
-
-Copyright 1991, 1994, 1995, 2000, 2001 Free Software Foundation, Inc.
-
-This file is part of the GNU MP Library.
-
-The GNU MP Library is free software; you can redistribute it and/or modify
-it under the terms of the GNU Lesser General Public License as published by
-the Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-The GNU MP Library is distributed in the hope that it will be useful, but
-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
-along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
-
-#include "mp.h"
-#include "gmp.h"
-#include "gmp-impl.h"
-
-MINT *
-itom (signed short int n)
-{
- MINT *x;
- mp_ptr xp;
-
- x = (MINT *) (*__gmp_allocate_func) (sizeof (MINT));
- x->_mp_alloc = 1;
- x->_mp_d = xp = (mp_ptr) (*__gmp_allocate_func) (BYTES_PER_MP_LIMB);
- if (n > 0)
- {
- x->_mp_size = 1;
- xp[0] = n;
- }
- else if (n < 0)
- {
- x->_mp_size = -1;
- xp[0] = (unsigned short) -n;
- }
- else
- x->_mp_size = 0;
-
- return x;
-}
diff --git a/mpbsd/mfree.c b/mpbsd/mfree.c
deleted file mode 100644
index 84e93f8cb..000000000
--- a/mpbsd/mfree.c
+++ /dev/null
@@ -1,29 +0,0 @@
-/* mfree -- BSD compatible mfree.
-
-Copyright 1991, 1994, 1995, 2000, 2001 Free Software Foundation, Inc.
-
-This file is part of the GNU MP Library.
-
-The GNU MP Library is free software; you can redistribute it and/or modify
-it under the terms of the GNU Lesser General Public License as published by
-the Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-The GNU MP Library is distributed in the hope that it will be useful, but
-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
-along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
-
-#include "mp.h"
-#include "gmp.h"
-#include "gmp-impl.h"
-
-void
-mfree (MINT *m)
-{
- (*__gmp_free_func) (m->_mp_d, m->_mp_alloc * BYTES_PER_MP_LIMB);
- (*__gmp_free_func) (m, sizeof (MINT));
-}
diff --git a/mpbsd/min.c b/mpbsd/min.c
deleted file mode 100644
index 4502dfc03..000000000
--- a/mpbsd/min.c
+++ /dev/null
@@ -1,88 +0,0 @@
-/* min(MINT) -- Do decimal input from standard input and store result in
- MINT.
-
-Copyright 1991, 1994, 1996, 2000, 2001 Free Software Foundation, Inc.
-
-This file is part of the GNU MP Library.
-
-The GNU MP Library is free software; you can redistribute it and/or modify
-it under the terms of the GNU Lesser General Public License as published by
-the Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-The GNU MP Library is distributed in the hope that it will be useful, but
-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
-along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
-
-#include <stdio.h>
-#include <ctype.h>
-#include "mp.h"
-#include "gmp.h"
-#include "gmp-impl.h"
-
-#define digit_value_tab __gmp_digit_value_tab
-
-void
-min (MINT *dest)
-{
- char *str;
- size_t alloc_size, str_size;
- int c;
- int negative;
- mp_size_t dest_size;
- const unsigned char *digit_value;
-
- digit_value = digit_value_tab;
-
- alloc_size = 100;
- str = (char *) (*__gmp_allocate_func) (alloc_size);
- str_size = 0;
-
- /* Skip whitespace. */
- do
- c = getc (stdin);
- while (isspace (c));
-
- negative = 0;
- if (c == '-')
- {
- negative = 1;
- c = getc (stdin);
- }
-
- if (c == EOF || digit_value[c] >= 10)
- return; /* error if no digits */
-
- do
- {
- int dig;
- dig = digit_value[c];
- if (dig >= 10)
- break;
- if (str_size >= alloc_size)
- {
- size_t old_alloc_size = alloc_size;
- alloc_size = alloc_size * 3 / 2;
- str = (char *) (*__gmp_reallocate_func) (str, old_alloc_size, alloc_size);
- }
- str[str_size++] = dig;
- c = getc (stdin);
- }
- while (c != EOF);
-
- ungetc (c, stdin);
-
- dest_size = str_size / mp_bases[10].chars_per_limb + 1;
- if (dest->_mp_alloc < dest_size)
- _mp_realloc (dest, dest_size);
-
- dest_size = mpn_set_str (dest->_mp_d, (unsigned char *) str, str_size, 10);
- dest->_mp_size = negative ? -dest_size : dest_size;
-
- (*__gmp_free_func) (str, alloc_size);
- return;
-}
diff --git a/mpbsd/mout.c b/mpbsd/mout.c
deleted file mode 100644
index 545539cce..000000000
--- a/mpbsd/mout.c
+++ /dev/null
@@ -1,92 +0,0 @@
-/* mout(MINT) -- Do decimal output of MINT to standard output.
-
-Copyright 1991, 1994, 1996, 2000, 2001, 2002, 2005 Free Software Foundation,
-Inc.
-
-This file is part of the GNU MP Library.
-
-The GNU MP Library is free software; you can redistribute it and/or modify
-it under the terms of the GNU Lesser General Public License as published by
-the Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-The GNU MP Library is distributed in the hope that it will be useful, but
-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
-along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
-
-#include <stdio.h>
-#include <string.h>
-#include "mp.h"
-#include "gmp.h"
-#include "gmp-impl.h"
-#include "longlong.h"
-
-void
-mout (const MINT *x)
-{
- mp_ptr xp;
- mp_srcptr x_ptr;
- mp_size_t x_size;
- unsigned char *str;
- size_t str_size;
- int i;
- TMP_DECL;
-
- x_size = x->_mp_size;
- if (x_size == 0)
- {
- fputc ('0', stdout);
- fputc ('\n', stdout);
- return;
- }
- if (x_size < 0)
- {
- fputc ('-', stdout);
- x_size = -x_size;
- }
-
- TMP_MARK;
- x_ptr = x->_mp_d;
- MPN_SIZEINBASE (str_size, x_ptr, x_size, 10);
- str_size += 2;
- str = (unsigned char *) TMP_ALLOC (str_size);
-
- /* mpn_get_str clobbers its argument */
- xp = TMP_ALLOC_LIMBS (x_size);
- MPN_COPY (xp, x_ptr, x_size);
-
- str_size = mpn_get_str (str, 10, xp, x_size);
-
- /* mpn_get_str might make a leading zero, skip it. */
- str_size -= (*str == 0);
- str += (*str == 0);
- ASSERT (*str != 0);
-
- /* Translate to printable chars. */
- for (i = 0; i < str_size; i++)
- str[i] = "0123456789"[str[i]];
- str[str_size] = 0;
-
- str_size = strlen ((char *) str);
- if (str_size % 10 != 0)
- {
- fwrite (str, 1, str_size % 10, stdout);
- str += str_size % 10;
- str_size -= str_size % 10;
- if (str_size != 0)
- fputc (' ', stdout);
- }
- for (i = 0; i < str_size; i += 10)
- {
- fwrite (str, 1, 10, stdout);
- str += 10;
- if (i + 10 < str_size)
- fputc (' ', stdout);
- }
- fputc ('\n', stdout);
- TMP_FREE;
-}
diff --git a/mpbsd/mtox.c b/mpbsd/mtox.c
deleted file mode 100644
index 7babfdd07..000000000
--- a/mpbsd/mtox.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/* mtox -- Convert OPERAND to hexadecimal and return a malloc'ed string
- with the result of the conversion.
-
-Copyright 1991, 1994, 2000, 2001, 2002 Free Software Foundation, Inc.
-
-This file is part of the GNU MP Library.
-
-The GNU MP Library is free software; you can redistribute it and/or modify
-it under the terms of the GNU Lesser General Public License as published by
-the Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-The GNU MP Library is distributed in the hope that it will be useful, but
-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
-along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
-
-#include <string.h>
-#include "mp.h"
-#include "gmp.h"
-#include "gmp-impl.h"
-#include "longlong.h"
-
-char *
-mtox (const MINT *x)
-{
- mp_size_t xsize = x->_mp_size;
- mp_ptr xp;
- mp_size_t xsign;
- unsigned char *str, *s;
- size_t str_size, alloc_size, i;
-
- xsign = xsize;
- if (xsize < 0)
- xsize = -xsize;
-
- /* digits, plus '\0', plus possible '-', for an exact size */
- xp = x->_mp_d;
- MPN_SIZEINBASE_16 (alloc_size, xp, xsize);
- alloc_size += 1 + (xsign < 0);
-
- str = (unsigned char *) (*__gmp_allocate_func) (alloc_size);
- s = str;
-
- if (xsign < 0)
- *s++ = '-';
-
- str_size = mpn_get_str (s, 16, xp, xsize);
- ASSERT (str_size <= alloc_size - (xsign < 0));
- ASSERT (str_size == 1 || *s != 0);
-
- for (i = 0; i < str_size; i++)
- s[i] = "0123456789abcdef"[s[i]];
- s[str_size] = 0;
-
- ASSERT (strlen (str) + 1 == alloc_size);
- return (char *) str;
-}
diff --git a/mpbsd/rpow.c b/mpbsd/rpow.c
deleted file mode 100644
index 827aacb6b..000000000
--- a/mpbsd/rpow.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* rpow -- MINT raised to short. */
-
-/*
-Copyright 2001 Free Software Foundation, Inc.
-
-This file is part of the GNU MP Library.
-
-The GNU MP Library is free software; you can redistribute it and/or modify
-it under the terms of the GNU Lesser General Public License as published by
-the Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-The GNU MP Library is distributed in the hope that it will be useful, but
-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
-along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
-
-#include "mp.h"
-#include "gmp.h"
-#include "gmp-impl.h"
-
-void
-rpow (const MINT *b, short e, MINT *r)
-{
- if (e >= 0)
- mpz_n_pow_ui (r, PTR(b), (mp_size_t) SIZ(b), (unsigned long) e);
- else
- SIZ(r) = 0;
-}
diff --git a/mpbsd/sdiv.c b/mpbsd/sdiv.c
deleted file mode 100644
index 802fe52a9..000000000
--- a/mpbsd/sdiv.c
+++ /dev/null
@@ -1,67 +0,0 @@
-/* sdiv -- Divide a MINT by a short integer. Produce a MINT quotient
- and a short remainder.
-
-Copyright 1991, 1994, 1995, 2000, 2001 Free Software Foundation, Inc.
-
-This file is part of the GNU MP Library.
-
-The GNU MP Library is free software; you can redistribute it and/or modify
-it under the terms of the GNU Lesser General Public License as published by
-the Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-The GNU MP Library is distributed in the hope that it will be useful, but
-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
-along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
-
-#include "mp.h"
-#include "gmp.h"
-#include "gmp-impl.h"
-#include "longlong.h"
-
-void
-sdiv (const MINT *dividend, signed short int divisor_short, MINT *quot, short *rem_ptr)
-{
- mp_size_t sign_dividend;
- signed long int sign_divisor;
- mp_size_t dividend_size, quot_size;
- mp_ptr dividend_ptr, quot_ptr;
- mp_limb_t divisor_limb;
- mp_limb_t remainder_limb;
-
- sign_dividend = dividend->_mp_size;
- dividend_size = ABS (dividend->_mp_size);
-
- if (dividend_size == 0)
- {
- quot->_mp_size = 0;
- *rem_ptr = 0;
- return;
- }
-
- sign_divisor = divisor_short;
- divisor_limb = (unsigned short) ABS (divisor_short);
-
- /* No need for temporary allocation and copying even if QUOT == DIVIDEND
- as the divisor is just one limb, and thus no intermediate remainders
- need to be stored. */
-
- if (quot->_mp_alloc < dividend_size)
- _mp_realloc (quot, dividend_size);
-
- quot_ptr = quot->_mp_d;
- dividend_ptr = dividend->_mp_d;
-
- remainder_limb = mpn_divmod_1 (quot_ptr,
- dividend_ptr, dividend_size, divisor_limb);
-
- *rem_ptr = sign_dividend >= 0 ? remainder_limb : -remainder_limb;
- /* The quotient is DIVIDEND_SIZE limbs, but the most significant
- might be zero. Set QUOT_SIZE properly. */
- quot_size = dividend_size - (quot_ptr[dividend_size - 1] == 0);
- quot->_mp_size = (sign_divisor ^ sign_dividend) >= 0 ? quot_size : -quot_size;
-}
diff --git a/mpbsd/xtom.c b/mpbsd/xtom.c
deleted file mode 100644
index 0161b4248..000000000
--- a/mpbsd/xtom.c
+++ /dev/null
@@ -1,87 +0,0 @@
-/* xtom -- convert a hexadecimal string to a MINT, and return a pointer to
- the MINT.
-
-Copyright 1991, 1994, 1995, 1996, 2000, 2001, 2002, 2005 Free Software
-Foundation, Inc.
-
-This file is part of the GNU MP Library.
-
-The GNU MP Library is free software; you can redistribute it and/or modify
-it under the terms of the GNU Lesser General Public License as published by
-the Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-The GNU MP Library is distributed in the hope that it will be useful, but
-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
-along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
-
-#include <string.h>
-#include <ctype.h>
-#include "mp.h"
-#include "gmp.h"
-#include "gmp-impl.h"
-
-#define digit_value __gmp_digit_value_tab
-
-MINT *
-xtom (const char *str)
-{
- size_t str_size;
- char *s, *begs;
- size_t i;
- mp_size_t xsize;
- int c;
- int negative;
- MINT *x = (MINT *) (*__gmp_allocate_func) (sizeof (MINT));
- TMP_DECL;
-
- /* Skip whitespace. */
- do
- c = (unsigned char) *str++;
- while (isspace (c));
-
- negative = 0;
- if (c == '-')
- {
- negative = 1;
- c = (unsigned char) *str++;
- }
-
- if (digit_value[c] >= 16)
- return 0; /* error if no digits */
-
- TMP_MARK;
- str_size = strlen (str - 1);
- s = begs = (char *) TMP_ALLOC (str_size + 1);
-
- for (i = 0; i < str_size; i++)
- {
- if (!isspace (c))
- {
- int dig = digit_value[c];
- if (dig >= 16)
- {
- TMP_FREE;
- return 0;
- }
- *s++ = dig;
- }
- c = (unsigned char) *str++;
- }
-
- str_size = s - begs;
-
- xsize = str_size / mp_bases[16].chars_per_limb + 1;
- x->_mp_alloc = xsize;
- x->_mp_d = (mp_ptr) (*__gmp_allocate_func) (xsize * BYTES_PER_MP_LIMB);
-
- xsize = mpn_set_str (x->_mp_d, (unsigned char *) begs, str_size, 16);
- x->_mp_size = negative ? -xsize : xsize;
-
- TMP_FREE;
- return x;
-}
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 30975cbf4..bfc35a471 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -18,7 +18,7 @@
# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
-SUBDIRS = . devel mpn mpz mpq mpf rand misc cxx mpbsd
+SUBDIRS = . devel mpn mpz mpq mpf rand misc cxx
include ../mpn/Makeasm.am
diff --git a/tests/mpbsd/Makefile.am b/tests/mpbsd/Makefile.am
deleted file mode 100644
index f609a6a8c..000000000
--- a/tests/mpbsd/Makefile.am
+++ /dev/null
@@ -1,35 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-# Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
-#
-# This file is part of the GNU MP Library.
-#
-# The GNU MP Library is free software; you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or (at your
-# option) any later version.
-#
-# The GNU MP Library is distributed in the hope that it will be useful, but
-# 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
-# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
-
-
-INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/tests
-LDADD = $(top_builddir)/tests/libtests.la $(top_builddir)/libmp.la
-
-if WANT_MPBSD
-MPBSD_check_OPTION = allfuns t-itom t-mtox
-endif
-
-check_PROGRAMS = $(MPBSD_check_OPTION)
-TESTS = $(check_PROGRAMS)
-
-# check linking only against libmp
-allfuns_LDADD = $(top_builddir)/libmp.la
-
-$(top_builddir)/tests/libtests.la:
- cd $(top_builddir)/tests; $(MAKE) $(AM_MAKEFLAGS) libtests.la
diff --git a/tests/mpbsd/allfuns.c b/tests/mpbsd/allfuns.c
deleted file mode 100644
index 2aa25d333..000000000
--- a/tests/mpbsd/allfuns.c
+++ /dev/null
@@ -1,56 +0,0 @@
-/* A test program doing nothing really, just linking to all the BSD MP
- functions that're supposed to exist.
-
-Copyright 2000, 2001 Free Software Foundation, Inc.
-
-This file is part of the GNU MP Library.
-
-The GNU MP Library is free software; you can redistribute it and/or modify
-it under the terms of the GNU Lesser General Public License as published by
-the Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-The GNU MP Library is distributed in the hope that it will be useful, but
-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
-along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include "mp.h"
-
-int
-main (int argc, char *argv[])
-{
- MINT *a, *b, *c, *d;
- short h;
-
- mp_set_memory_functions (NULL, NULL, NULL);
- a = itom (123);
- b = xtom ("DEADBEEF");
- c = itom (0);
- d = itom (0);
- move (a, b);
- madd (a, b, c);
- msub (a, b, c);
- mult (a, b, c);
- mdiv (b, a, c, d);
- sdiv (b, 2, c, &h);
- msqrt (a, c, d);
- pow (b, a, a, c);
- rpow (a, 3, c);
- gcd (a, b, c);
- mcmp (a, b);
- if (argc > 1)
- {
- min (c);
- mout (a);
- }
- mtox (b);
- mfree(a);
-
- exit (0);
-}
diff --git a/tests/mpbsd/t-itom.c b/tests/mpbsd/t-itom.c
deleted file mode 100644
index 9b49cb000..000000000
--- a/tests/mpbsd/t-itom.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/* Test itom.
-
-Copyright 2000, 2001 Free Software Foundation, Inc.
-
-This file is part of the GNU MP Library.
-
-The GNU MP Library is free software; you can redistribute it and/or modify
-it under the terms of the GNU Lesser General Public License as published by
-the Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-The GNU MP Library is distributed in the hope that it will be useful, but
-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
-along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include "gmp.h"
-#include "gmp-impl.h"
-#include "mp.h"
-#include "tests.h"
-
-#define SGN(x) ((x) < 0 ? -1 : (x) == 0 ? 0 : 1)
-
-
-void
-check_data (void)
-{
- static const struct {
- short m;
- mp_size_t want_size;
- mp_limb_t want_limb;
- } data[] = {
-
- { 0L, 0 },
- { 1L, 1, 1 },
- { -1L, -1, 1 },
-
- { SHRT_MAX, 1, SHRT_MAX },
- { -SHRT_MAX, -1, SHRT_MAX },
- { SHRT_MIN, -1, -SHRT_MIN },
- };
-
- MINT *m;
- int i;
-
- for (i = 0; i < numberof (data); i++)
- {
- m = itom (data[i].m);
- if (m->_mp_size != data[i].want_size
- || (m->_mp_size != 0 && m->_mp_d[0] != data[i].want_limb))
- {
- printf ("itom wrong on data[%d]\n", i);
- abort();
- }
- mfree (m);
- }
-}
-
-
-int
-main (void)
-{
- tests_start ();
-
- check_data ();
-
- tests_end ();
- exit (0);
-}
diff --git a/tests/mpbsd/t-mtox.c b/tests/mpbsd/t-mtox.c
deleted file mode 100644
index 1138e7623..000000000
--- a/tests/mpbsd/t-mtox.c
+++ /dev/null
@@ -1,86 +0,0 @@
-/* Test mtox.
-
-Copyright 2002 Free Software Foundation, Inc.
-
-This file is part of the GNU MP Library.
-
-The GNU MP Library is free software; you can redistribute it and/or modify
-it under the terms of the GNU Lesser General Public License as published by
-the Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-The GNU MP Library is distributed in the hope that it will be useful, but
-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
-along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
-
-#include <string.h> /* for strcmp, strlen */
-#include <stdlib.h> /* for abort */
-#include <stdio.h>
-#include "gmp.h"
-#include "gmp-impl.h"
-#include "mp.h"
-#include "tests.h"
-
-
-void
-check_random (void)
-{
- mpz_t z;
- int i;
- char *got, *want;
- gmp_randstate_ptr rands = RANDS;
-
- mpz_init (z);
-
- for (i = 0; i < 1000; i++)
- {
- mpz_erandomb (z, rands, 6 * GMP_LIMB_BITS);
- got = mtox (z);
- want = mpz_get_str (NULL, 16, z);
- if (strcmp (got, want) != 0)
- {
- printf ("mtox wrong result\n");
- printf (" got \"%s\"\n", got);
- printf (" want \"%s\"\n", want);
- abort ();
- }
- (*__gmp_free_func) (got, strlen (got) + 1);
- (*__gmp_free_func) (want, strlen (want) + 1);
- }
-
- mpz_clear (z);
-}
-
-void
-check_mem (void)
-{
- MINT *m;
- char *s;
-
- m = itom (0);
- s = mtox (m);
- if (! tests_memory_valid (s))
- {
- printf ("Skipping t-mtox, cannot test libgmp and libmp memory together\n");
- exit (0);
- }
- mfree (m);
- (*__gmp_free_func) (s, strlen (s) + 1);
-}
-
-
-int
-main (void)
-{
- tests_start ();
-
- check_mem ();
- check_random ();
-
- tests_end ();
- exit (0);
-}