diff options
Diffstat (limited to 'gmp/tests/mpz')
65 files changed, 1894 insertions, 3308 deletions
diff --git a/gmp/tests/mpz/Makefile.am b/gmp/tests/mpz/Makefile.am index 8dc5721e0a..311a53acad 100644 --- a/gmp/tests/mpz/Makefile.am +++ b/gmp/tests/mpz/Makefile.am @@ -1,35 +1,36 @@ ## Process this file with automake to generate Makefile.in -# Copyright 1996, 1997, 1999-2003, 2009, 2012 Free Software Foundation, Inc. +# Copyright 1996, 1997, 1999, 2000, 2001, 2002, 2003, 2009 Free Software +# Foundation, Inc. # -# This file is part of the GNU MP Library test suite. +# This file is part of the GNU MP Library. # -# The GNU MP Library test suite is free software; you can redistribute it -# and/or modify it under the terms of the GNU 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 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 test suite 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 General -# Public License for more details. +# 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 General Public License along with -# the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. +# 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)/libgmp.la check_PROGRAMS = t-addsub t-cmp t-mul t-mul_i t-tdiv t-tdiv_ui t-fdiv \ - t-fdiv_ui t-cdiv_ui t-gcd t-gcd_ui t-lcm t-invert dive dive_ui t-sqrtrem \ - convert io t-inp_str logic bit t-powm t-powm_ui t-pow t-div_2exp reuse \ + t-fdiv_ui t-cdiv_ui t-gcd t-gcd_ui t-lcm dive dive_ui t-sqrtrem convert io \ + t-inp_str logic bit t-powm t-powm_ui t-pow t-div_2exp reuse \ t-root t-perfsqr t-perfpow t-jac t-bin t-get_d t-get_d_2exp t-get_si \ t-set_d t-set_si \ - t-fac_ui t-mfac_uiui t-primorial_ui t-fib_ui t-lucnum_ui t-scan t-fits \ + t-fac_ui t-fib_ui t-lucnum_ui t-scan t-fits \ t-divis t-divis_2exp t-cong t-cong_2exp t-sizeinbase t-set_str \ t-aorsmul t-cmp_d t-cmp_si t-hamdist t-oddeven t-popcount t-set_f \ - t-io_raw t-import t-export t-pprime_p t-nextprime t-remove t-limbs + t-io_raw t-import t-export t-pprime_p t-nextprime TESTS = $(check_PROGRAMS) diff --git a/gmp/tests/mpz/Makefile.in b/gmp/tests/mpz/Makefile.in index ec96613ff3..ee4c24c5a6 100644 --- a/gmp/tests/mpz/Makefile.in +++ b/gmp/tests/mpz/Makefile.in @@ -1,9 +1,8 @@ -# Makefile.in generated by automake 1.11.6 from Makefile.am. +# Makefile.in generated by automake 1.8.4 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software -# Foundation, Inc. +# 2003, 2004 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -15,45 +14,34 @@ @SET_MAKE@ -# Copyright 1996, 1997, 1999-2003, 2009, 2012 Free Software Foundation, Inc. +# Copyright 1996, 1997, 1999, 2000, 2001, 2002, 2003, 2009 Free Software +# Foundation, Inc. # -# This file is part of the GNU MP Library test suite. +# This file is part of the GNU MP Library. # -# The GNU MP Library test suite is free software; you can redistribute it -# and/or modify it under the terms of the GNU 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 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 test suite 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 General -# Public License for more details. +# 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 General Public License along with -# the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. +# 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/. +SOURCES = bit.c convert.c dive.c dive_ui.c io.c logic.c reuse.c t-addsub.c t-aorsmul.c t-bin.c t-cdiv_ui.c t-cmp.c t-cmp_d.c t-cmp_si.c t-cong.c t-cong_2exp.c t-div_2exp.c t-divis.c t-divis_2exp.c t-export.c t-fac_ui.c t-fdiv.c t-fdiv_ui.c t-fib_ui.c t-fits.c t-gcd.c t-gcd_ui.c t-get_d.c t-get_d_2exp.c t-get_si.c t-hamdist.c t-import.c t-inp_str.c t-io_raw.c t-jac.c t-lcm.c t-lucnum_ui.c t-mul.c t-mul_i.c t-nextprime.c t-oddeven.c t-perfpow.c t-perfsqr.c t-popcount.c t-pow.c t-powm.c t-powm_ui.c t-pprime_p.c t-root.c t-scan.c t-set_d.c t-set_f.c t-set_si.c t-set_str.c t-sizeinbase.c t-sqrtrem.c t-tdiv.c t-tdiv_ui.c + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ VPATH = @srcdir@ -am__make_dryrun = \ - { \ - am__dry=no; \ - case $$MAKEFLAGS in \ - *\\[\ \ ]*) \ - echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ - | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ - *) \ - for am__flg in $$MAKEFLAGS; do \ - case $$am__flg in \ - *=*|--*) ;; \ - *n*) am__dry=yes; break;; \ - esac; \ - done;; \ - esac; \ - test $$am__dry = yes; \ - } pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../.. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c @@ -65,400 +53,362 @@ POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : -build_triplet = @build@ host_triplet = @host@ +ANSI2KNR = $(top_builddir)/ansi2knr check_PROGRAMS = t-addsub$(EXEEXT) t-cmp$(EXEEXT) t-mul$(EXEEXT) \ t-mul_i$(EXEEXT) t-tdiv$(EXEEXT) t-tdiv_ui$(EXEEXT) \ t-fdiv$(EXEEXT) t-fdiv_ui$(EXEEXT) t-cdiv_ui$(EXEEXT) \ - t-gcd$(EXEEXT) t-gcd_ui$(EXEEXT) t-lcm$(EXEEXT) \ - t-invert$(EXEEXT) dive$(EXEEXT) dive_ui$(EXEEXT) \ - t-sqrtrem$(EXEEXT) convert$(EXEEXT) io$(EXEEXT) \ - t-inp_str$(EXEEXT) logic$(EXEEXT) bit$(EXEEXT) t-powm$(EXEEXT) \ - t-powm_ui$(EXEEXT) t-pow$(EXEEXT) t-div_2exp$(EXEEXT) \ - reuse$(EXEEXT) t-root$(EXEEXT) t-perfsqr$(EXEEXT) \ - t-perfpow$(EXEEXT) t-jac$(EXEEXT) t-bin$(EXEEXT) \ - t-get_d$(EXEEXT) t-get_d_2exp$(EXEEXT) t-get_si$(EXEEXT) \ - t-set_d$(EXEEXT) t-set_si$(EXEEXT) t-fac_ui$(EXEEXT) \ - t-mfac_uiui$(EXEEXT) t-primorial_ui$(EXEEXT) t-fib_ui$(EXEEXT) \ - t-lucnum_ui$(EXEEXT) t-scan$(EXEEXT) t-fits$(EXEEXT) \ - t-divis$(EXEEXT) t-divis_2exp$(EXEEXT) t-cong$(EXEEXT) \ - t-cong_2exp$(EXEEXT) t-sizeinbase$(EXEEXT) t-set_str$(EXEEXT) \ - t-aorsmul$(EXEEXT) t-cmp_d$(EXEEXT) t-cmp_si$(EXEEXT) \ - t-hamdist$(EXEEXT) t-oddeven$(EXEEXT) t-popcount$(EXEEXT) \ - t-set_f$(EXEEXT) t-io_raw$(EXEEXT) t-import$(EXEEXT) \ - t-export$(EXEEXT) t-pprime_p$(EXEEXT) t-nextprime$(EXEEXT) \ - t-remove$(EXEEXT) t-limbs$(EXEEXT) + t-gcd$(EXEEXT) t-gcd_ui$(EXEEXT) t-lcm$(EXEEXT) dive$(EXEEXT) \ + dive_ui$(EXEEXT) t-sqrtrem$(EXEEXT) convert$(EXEEXT) \ + io$(EXEEXT) t-inp_str$(EXEEXT) logic$(EXEEXT) bit$(EXEEXT) \ + t-powm$(EXEEXT) t-powm_ui$(EXEEXT) t-pow$(EXEEXT) \ + t-div_2exp$(EXEEXT) reuse$(EXEEXT) t-root$(EXEEXT) \ + t-perfsqr$(EXEEXT) t-perfpow$(EXEEXT) t-jac$(EXEEXT) \ + t-bin$(EXEEXT) t-get_d$(EXEEXT) t-get_d_2exp$(EXEEXT) \ + t-get_si$(EXEEXT) t-set_d$(EXEEXT) t-set_si$(EXEEXT) \ + t-fac_ui$(EXEEXT) t-fib_ui$(EXEEXT) t-lucnum_ui$(EXEEXT) \ + t-scan$(EXEEXT) t-fits$(EXEEXT) t-divis$(EXEEXT) \ + t-divis_2exp$(EXEEXT) t-cong$(EXEEXT) t-cong_2exp$(EXEEXT) \ + t-sizeinbase$(EXEEXT) t-set_str$(EXEEXT) t-aorsmul$(EXEEXT) \ + t-cmp_d$(EXEEXT) t-cmp_si$(EXEEXT) t-hamdist$(EXEEXT) \ + t-oddeven$(EXEEXT) t-popcount$(EXEEXT) t-set_f$(EXEEXT) \ + t-io_raw$(EXEEXT) t-import$(EXEEXT) t-export$(EXEEXT) \ + t-pprime_p$(EXEEXT) t-nextprime$(EXEEXT) subdir = tests/mpz DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -mkinstalldirs = $(install_sh) -d +mkinstalldirs = $(mkdir_p) CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = bit_SOURCES = bit.c -bit_OBJECTS = bit.$(OBJEXT) +bit_OBJECTS = bit$U.$(OBJEXT) bit_LDADD = $(LDADD) bit_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ $(top_builddir)/libgmp.la convert_SOURCES = convert.c -convert_OBJECTS = convert.$(OBJEXT) +convert_OBJECTS = convert$U.$(OBJEXT) convert_LDADD = $(LDADD) convert_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ $(top_builddir)/libgmp.la dive_SOURCES = dive.c -dive_OBJECTS = dive.$(OBJEXT) +dive_OBJECTS = dive$U.$(OBJEXT) dive_LDADD = $(LDADD) dive_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ $(top_builddir)/libgmp.la dive_ui_SOURCES = dive_ui.c -dive_ui_OBJECTS = dive_ui.$(OBJEXT) +dive_ui_OBJECTS = dive_ui$U.$(OBJEXT) dive_ui_LDADD = $(LDADD) dive_ui_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ $(top_builddir)/libgmp.la io_SOURCES = io.c -io_OBJECTS = io.$(OBJEXT) +io_OBJECTS = io$U.$(OBJEXT) io_LDADD = $(LDADD) io_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ $(top_builddir)/libgmp.la logic_SOURCES = logic.c -logic_OBJECTS = logic.$(OBJEXT) +logic_OBJECTS = logic$U.$(OBJEXT) logic_LDADD = $(LDADD) logic_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ $(top_builddir)/libgmp.la reuse_SOURCES = reuse.c -reuse_OBJECTS = reuse.$(OBJEXT) +reuse_OBJECTS = reuse$U.$(OBJEXT) reuse_LDADD = $(LDADD) reuse_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ $(top_builddir)/libgmp.la t_addsub_SOURCES = t-addsub.c -t_addsub_OBJECTS = t-addsub.$(OBJEXT) +t_addsub_OBJECTS = t-addsub$U.$(OBJEXT) t_addsub_LDADD = $(LDADD) t_addsub_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ $(top_builddir)/libgmp.la t_aorsmul_SOURCES = t-aorsmul.c -t_aorsmul_OBJECTS = t-aorsmul.$(OBJEXT) +t_aorsmul_OBJECTS = t-aorsmul$U.$(OBJEXT) t_aorsmul_LDADD = $(LDADD) t_aorsmul_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ $(top_builddir)/libgmp.la t_bin_SOURCES = t-bin.c -t_bin_OBJECTS = t-bin.$(OBJEXT) +t_bin_OBJECTS = t-bin$U.$(OBJEXT) t_bin_LDADD = $(LDADD) t_bin_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ $(top_builddir)/libgmp.la t_cdiv_ui_SOURCES = t-cdiv_ui.c -t_cdiv_ui_OBJECTS = t-cdiv_ui.$(OBJEXT) +t_cdiv_ui_OBJECTS = t-cdiv_ui$U.$(OBJEXT) t_cdiv_ui_LDADD = $(LDADD) t_cdiv_ui_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ $(top_builddir)/libgmp.la t_cmp_SOURCES = t-cmp.c -t_cmp_OBJECTS = t-cmp.$(OBJEXT) +t_cmp_OBJECTS = t-cmp$U.$(OBJEXT) t_cmp_LDADD = $(LDADD) t_cmp_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ $(top_builddir)/libgmp.la t_cmp_d_SOURCES = t-cmp_d.c -t_cmp_d_OBJECTS = t-cmp_d.$(OBJEXT) +t_cmp_d_OBJECTS = t-cmp_d$U.$(OBJEXT) t_cmp_d_LDADD = $(LDADD) t_cmp_d_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ $(top_builddir)/libgmp.la t_cmp_si_SOURCES = t-cmp_si.c -t_cmp_si_OBJECTS = t-cmp_si.$(OBJEXT) +t_cmp_si_OBJECTS = t-cmp_si$U.$(OBJEXT) t_cmp_si_LDADD = $(LDADD) t_cmp_si_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ $(top_builddir)/libgmp.la t_cong_SOURCES = t-cong.c -t_cong_OBJECTS = t-cong.$(OBJEXT) +t_cong_OBJECTS = t-cong$U.$(OBJEXT) t_cong_LDADD = $(LDADD) t_cong_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ $(top_builddir)/libgmp.la t_cong_2exp_SOURCES = t-cong_2exp.c -t_cong_2exp_OBJECTS = t-cong_2exp.$(OBJEXT) +t_cong_2exp_OBJECTS = t-cong_2exp$U.$(OBJEXT) t_cong_2exp_LDADD = $(LDADD) t_cong_2exp_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ $(top_builddir)/libgmp.la t_div_2exp_SOURCES = t-div_2exp.c -t_div_2exp_OBJECTS = t-div_2exp.$(OBJEXT) +t_div_2exp_OBJECTS = t-div_2exp$U.$(OBJEXT) t_div_2exp_LDADD = $(LDADD) t_div_2exp_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ $(top_builddir)/libgmp.la t_divis_SOURCES = t-divis.c -t_divis_OBJECTS = t-divis.$(OBJEXT) +t_divis_OBJECTS = t-divis$U.$(OBJEXT) t_divis_LDADD = $(LDADD) t_divis_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ $(top_builddir)/libgmp.la t_divis_2exp_SOURCES = t-divis_2exp.c -t_divis_2exp_OBJECTS = t-divis_2exp.$(OBJEXT) +t_divis_2exp_OBJECTS = t-divis_2exp$U.$(OBJEXT) t_divis_2exp_LDADD = $(LDADD) t_divis_2exp_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ $(top_builddir)/libgmp.la t_export_SOURCES = t-export.c -t_export_OBJECTS = t-export.$(OBJEXT) +t_export_OBJECTS = t-export$U.$(OBJEXT) t_export_LDADD = $(LDADD) t_export_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ $(top_builddir)/libgmp.la t_fac_ui_SOURCES = t-fac_ui.c -t_fac_ui_OBJECTS = t-fac_ui.$(OBJEXT) +t_fac_ui_OBJECTS = t-fac_ui$U.$(OBJEXT) t_fac_ui_LDADD = $(LDADD) t_fac_ui_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ $(top_builddir)/libgmp.la t_fdiv_SOURCES = t-fdiv.c -t_fdiv_OBJECTS = t-fdiv.$(OBJEXT) +t_fdiv_OBJECTS = t-fdiv$U.$(OBJEXT) t_fdiv_LDADD = $(LDADD) t_fdiv_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ $(top_builddir)/libgmp.la t_fdiv_ui_SOURCES = t-fdiv_ui.c -t_fdiv_ui_OBJECTS = t-fdiv_ui.$(OBJEXT) +t_fdiv_ui_OBJECTS = t-fdiv_ui$U.$(OBJEXT) t_fdiv_ui_LDADD = $(LDADD) t_fdiv_ui_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ $(top_builddir)/libgmp.la t_fib_ui_SOURCES = t-fib_ui.c -t_fib_ui_OBJECTS = t-fib_ui.$(OBJEXT) +t_fib_ui_OBJECTS = t-fib_ui$U.$(OBJEXT) t_fib_ui_LDADD = $(LDADD) t_fib_ui_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ $(top_builddir)/libgmp.la t_fits_SOURCES = t-fits.c -t_fits_OBJECTS = t-fits.$(OBJEXT) +t_fits_OBJECTS = t-fits$U.$(OBJEXT) t_fits_LDADD = $(LDADD) t_fits_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ $(top_builddir)/libgmp.la t_gcd_SOURCES = t-gcd.c -t_gcd_OBJECTS = t-gcd.$(OBJEXT) +t_gcd_OBJECTS = t-gcd$U.$(OBJEXT) t_gcd_LDADD = $(LDADD) t_gcd_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ $(top_builddir)/libgmp.la t_gcd_ui_SOURCES = t-gcd_ui.c -t_gcd_ui_OBJECTS = t-gcd_ui.$(OBJEXT) +t_gcd_ui_OBJECTS = t-gcd_ui$U.$(OBJEXT) t_gcd_ui_LDADD = $(LDADD) t_gcd_ui_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ $(top_builddir)/libgmp.la t_get_d_SOURCES = t-get_d.c -t_get_d_OBJECTS = t-get_d.$(OBJEXT) +t_get_d_OBJECTS = t-get_d$U.$(OBJEXT) t_get_d_LDADD = $(LDADD) t_get_d_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ $(top_builddir)/libgmp.la t_get_d_2exp_SOURCES = t-get_d_2exp.c -t_get_d_2exp_OBJECTS = t-get_d_2exp.$(OBJEXT) +t_get_d_2exp_OBJECTS = t-get_d_2exp$U.$(OBJEXT) t_get_d_2exp_LDADD = $(LDADD) t_get_d_2exp_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ $(top_builddir)/libgmp.la t_get_si_SOURCES = t-get_si.c -t_get_si_OBJECTS = t-get_si.$(OBJEXT) +t_get_si_OBJECTS = t-get_si$U.$(OBJEXT) t_get_si_LDADD = $(LDADD) t_get_si_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ $(top_builddir)/libgmp.la t_hamdist_SOURCES = t-hamdist.c -t_hamdist_OBJECTS = t-hamdist.$(OBJEXT) +t_hamdist_OBJECTS = t-hamdist$U.$(OBJEXT) t_hamdist_LDADD = $(LDADD) t_hamdist_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ $(top_builddir)/libgmp.la t_import_SOURCES = t-import.c -t_import_OBJECTS = t-import.$(OBJEXT) +t_import_OBJECTS = t-import$U.$(OBJEXT) t_import_LDADD = $(LDADD) t_import_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ $(top_builddir)/libgmp.la t_inp_str_SOURCES = t-inp_str.c -t_inp_str_OBJECTS = t-inp_str.$(OBJEXT) +t_inp_str_OBJECTS = t-inp_str$U.$(OBJEXT) t_inp_str_LDADD = $(LDADD) t_inp_str_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ $(top_builddir)/libgmp.la -t_invert_SOURCES = t-invert.c -t_invert_OBJECTS = t-invert.$(OBJEXT) -t_invert_LDADD = $(LDADD) -t_invert_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ - $(top_builddir)/libgmp.la t_io_raw_SOURCES = t-io_raw.c -t_io_raw_OBJECTS = t-io_raw.$(OBJEXT) +t_io_raw_OBJECTS = t-io_raw$U.$(OBJEXT) t_io_raw_LDADD = $(LDADD) t_io_raw_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ $(top_builddir)/libgmp.la t_jac_SOURCES = t-jac.c -t_jac_OBJECTS = t-jac.$(OBJEXT) +t_jac_OBJECTS = t-jac$U.$(OBJEXT) t_jac_LDADD = $(LDADD) t_jac_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ $(top_builddir)/libgmp.la t_lcm_SOURCES = t-lcm.c -t_lcm_OBJECTS = t-lcm.$(OBJEXT) +t_lcm_OBJECTS = t-lcm$U.$(OBJEXT) t_lcm_LDADD = $(LDADD) t_lcm_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ $(top_builddir)/libgmp.la -t_limbs_SOURCES = t-limbs.c -t_limbs_OBJECTS = t-limbs.$(OBJEXT) -t_limbs_LDADD = $(LDADD) -t_limbs_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ - $(top_builddir)/libgmp.la t_lucnum_ui_SOURCES = t-lucnum_ui.c -t_lucnum_ui_OBJECTS = t-lucnum_ui.$(OBJEXT) +t_lucnum_ui_OBJECTS = t-lucnum_ui$U.$(OBJEXT) t_lucnum_ui_LDADD = $(LDADD) t_lucnum_ui_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ $(top_builddir)/libgmp.la -t_mfac_uiui_SOURCES = t-mfac_uiui.c -t_mfac_uiui_OBJECTS = t-mfac_uiui.$(OBJEXT) -t_mfac_uiui_LDADD = $(LDADD) -t_mfac_uiui_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ - $(top_builddir)/libgmp.la t_mul_SOURCES = t-mul.c -t_mul_OBJECTS = t-mul.$(OBJEXT) +t_mul_OBJECTS = t-mul$U.$(OBJEXT) t_mul_LDADD = $(LDADD) t_mul_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ $(top_builddir)/libgmp.la t_mul_i_SOURCES = t-mul_i.c -t_mul_i_OBJECTS = t-mul_i.$(OBJEXT) +t_mul_i_OBJECTS = t-mul_i$U.$(OBJEXT) t_mul_i_LDADD = $(LDADD) t_mul_i_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ $(top_builddir)/libgmp.la t_nextprime_SOURCES = t-nextprime.c -t_nextprime_OBJECTS = t-nextprime.$(OBJEXT) +t_nextprime_OBJECTS = t-nextprime$U.$(OBJEXT) t_nextprime_LDADD = $(LDADD) t_nextprime_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ $(top_builddir)/libgmp.la t_oddeven_SOURCES = t-oddeven.c -t_oddeven_OBJECTS = t-oddeven.$(OBJEXT) +t_oddeven_OBJECTS = t-oddeven$U.$(OBJEXT) t_oddeven_LDADD = $(LDADD) t_oddeven_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ $(top_builddir)/libgmp.la t_perfpow_SOURCES = t-perfpow.c -t_perfpow_OBJECTS = t-perfpow.$(OBJEXT) +t_perfpow_OBJECTS = t-perfpow$U.$(OBJEXT) t_perfpow_LDADD = $(LDADD) t_perfpow_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ $(top_builddir)/libgmp.la t_perfsqr_SOURCES = t-perfsqr.c -t_perfsqr_OBJECTS = t-perfsqr.$(OBJEXT) +t_perfsqr_OBJECTS = t-perfsqr$U.$(OBJEXT) t_perfsqr_LDADD = $(LDADD) t_perfsqr_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ $(top_builddir)/libgmp.la t_popcount_SOURCES = t-popcount.c -t_popcount_OBJECTS = t-popcount.$(OBJEXT) +t_popcount_OBJECTS = t-popcount$U.$(OBJEXT) t_popcount_LDADD = $(LDADD) t_popcount_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ $(top_builddir)/libgmp.la t_pow_SOURCES = t-pow.c -t_pow_OBJECTS = t-pow.$(OBJEXT) +t_pow_OBJECTS = t-pow$U.$(OBJEXT) t_pow_LDADD = $(LDADD) t_pow_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ $(top_builddir)/libgmp.la t_powm_SOURCES = t-powm.c -t_powm_OBJECTS = t-powm.$(OBJEXT) +t_powm_OBJECTS = t-powm$U.$(OBJEXT) t_powm_LDADD = $(LDADD) t_powm_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ $(top_builddir)/libgmp.la t_powm_ui_SOURCES = t-powm_ui.c -t_powm_ui_OBJECTS = t-powm_ui.$(OBJEXT) +t_powm_ui_OBJECTS = t-powm_ui$U.$(OBJEXT) t_powm_ui_LDADD = $(LDADD) t_powm_ui_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ $(top_builddir)/libgmp.la t_pprime_p_SOURCES = t-pprime_p.c -t_pprime_p_OBJECTS = t-pprime_p.$(OBJEXT) +t_pprime_p_OBJECTS = t-pprime_p$U.$(OBJEXT) t_pprime_p_LDADD = $(LDADD) t_pprime_p_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ $(top_builddir)/libgmp.la -t_primorial_ui_SOURCES = t-primorial_ui.c -t_primorial_ui_OBJECTS = t-primorial_ui.$(OBJEXT) -t_primorial_ui_LDADD = $(LDADD) -t_primorial_ui_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ - $(top_builddir)/libgmp.la -t_remove_SOURCES = t-remove.c -t_remove_OBJECTS = t-remove.$(OBJEXT) -t_remove_LDADD = $(LDADD) -t_remove_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ - $(top_builddir)/libgmp.la t_root_SOURCES = t-root.c -t_root_OBJECTS = t-root.$(OBJEXT) +t_root_OBJECTS = t-root$U.$(OBJEXT) t_root_LDADD = $(LDADD) t_root_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ $(top_builddir)/libgmp.la t_scan_SOURCES = t-scan.c -t_scan_OBJECTS = t-scan.$(OBJEXT) +t_scan_OBJECTS = t-scan$U.$(OBJEXT) t_scan_LDADD = $(LDADD) t_scan_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ $(top_builddir)/libgmp.la t_set_d_SOURCES = t-set_d.c -t_set_d_OBJECTS = t-set_d.$(OBJEXT) +t_set_d_OBJECTS = t-set_d$U.$(OBJEXT) t_set_d_LDADD = $(LDADD) t_set_d_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ $(top_builddir)/libgmp.la t_set_f_SOURCES = t-set_f.c -t_set_f_OBJECTS = t-set_f.$(OBJEXT) +t_set_f_OBJECTS = t-set_f$U.$(OBJEXT) t_set_f_LDADD = $(LDADD) t_set_f_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ $(top_builddir)/libgmp.la t_set_si_SOURCES = t-set_si.c -t_set_si_OBJECTS = t-set_si.$(OBJEXT) +t_set_si_OBJECTS = t-set_si$U.$(OBJEXT) t_set_si_LDADD = $(LDADD) t_set_si_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ $(top_builddir)/libgmp.la t_set_str_SOURCES = t-set_str.c -t_set_str_OBJECTS = t-set_str.$(OBJEXT) +t_set_str_OBJECTS = t-set_str$U.$(OBJEXT) t_set_str_LDADD = $(LDADD) t_set_str_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ $(top_builddir)/libgmp.la t_sizeinbase_SOURCES = t-sizeinbase.c -t_sizeinbase_OBJECTS = t-sizeinbase.$(OBJEXT) +t_sizeinbase_OBJECTS = t-sizeinbase$U.$(OBJEXT) t_sizeinbase_LDADD = $(LDADD) t_sizeinbase_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ $(top_builddir)/libgmp.la t_sqrtrem_SOURCES = t-sqrtrem.c -t_sqrtrem_OBJECTS = t-sqrtrem.$(OBJEXT) +t_sqrtrem_OBJECTS = t-sqrtrem$U.$(OBJEXT) t_sqrtrem_LDADD = $(LDADD) t_sqrtrem_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ $(top_builddir)/libgmp.la t_tdiv_SOURCES = t-tdiv.c -t_tdiv_OBJECTS = t-tdiv.$(OBJEXT) +t_tdiv_OBJECTS = t-tdiv$U.$(OBJEXT) t_tdiv_LDADD = $(LDADD) t_tdiv_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ $(top_builddir)/libgmp.la t_tdiv_ui_SOURCES = t-tdiv_ui.c -t_tdiv_ui_OBJECTS = t-tdiv_ui.$(OBJEXT) +t_tdiv_ui_OBJECTS = t-tdiv_ui$U.$(OBJEXT) t_tdiv_ui_LDADD = $(LDADD) t_tdiv_ui_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ $(top_builddir)/libgmp.la -DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) depcomp = am__depfiles_maybe = COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ - $(LDFLAGS) -o $@ +LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = bit.c convert.c dive.c dive_ui.c io.c logic.c reuse.c \ t-addsub.c t-aorsmul.c t-bin.c t-cdiv_ui.c t-cmp.c t-cmp_d.c \ t-cmp_si.c t-cong.c t-cong_2exp.c t-div_2exp.c t-divis.c \ t-divis_2exp.c t-export.c t-fac_ui.c t-fdiv.c t-fdiv_ui.c \ t-fib_ui.c t-fits.c t-gcd.c t-gcd_ui.c t-get_d.c \ t-get_d_2exp.c t-get_si.c t-hamdist.c t-import.c t-inp_str.c \ - t-invert.c t-io_raw.c t-jac.c t-lcm.c t-limbs.c t-lucnum_ui.c \ - t-mfac_uiui.c t-mul.c t-mul_i.c t-nextprime.c t-oddeven.c \ - t-perfpow.c t-perfsqr.c t-popcount.c t-pow.c t-powm.c \ - t-powm_ui.c t-pprime_p.c t-primorial_ui.c t-remove.c t-root.c \ - t-scan.c t-set_d.c t-set_f.c t-set_si.c t-set_str.c \ - t-sizeinbase.c t-sqrtrem.c t-tdiv.c t-tdiv_ui.c + t-io_raw.c t-jac.c t-lcm.c t-lucnum_ui.c t-mul.c t-mul_i.c \ + t-nextprime.c t-oddeven.c t-perfpow.c t-perfsqr.c t-popcount.c \ + t-pow.c t-powm.c t-powm_ui.c t-pprime_p.c t-root.c t-scan.c \ + t-set_d.c t-set_f.c t-set_si.c t-set_str.c t-sizeinbase.c \ + t-sqrtrem.c t-tdiv.c t-tdiv_ui.c DIST_SOURCES = bit.c convert.c dive.c dive_ui.c io.c logic.c reuse.c \ t-addsub.c t-aorsmul.c t-bin.c t-cdiv_ui.c t-cmp.c t-cmp_d.c \ t-cmp_si.c t-cong.c t-cong_2exp.c t-div_2exp.c t-divis.c \ t-divis_2exp.c t-export.c t-fac_ui.c t-fdiv.c t-fdiv_ui.c \ t-fib_ui.c t-fits.c t-gcd.c t-gcd_ui.c t-get_d.c \ t-get_d_2exp.c t-get_si.c t-hamdist.c t-import.c t-inp_str.c \ - t-invert.c t-io_raw.c t-jac.c t-lcm.c t-limbs.c t-lucnum_ui.c \ - t-mfac_uiui.c t-mul.c t-mul_i.c t-nextprime.c t-oddeven.c \ - t-perfpow.c t-perfsqr.c t-popcount.c t-pow.c t-powm.c \ - t-powm_ui.c t-pprime_p.c t-primorial_ui.c t-remove.c t-root.c \ - t-scan.c t-set_d.c t-set_f.c t-set_si.c t-set_str.c \ - t-sizeinbase.c t-sqrtrem.c t-tdiv.c t-tdiv_ui.c -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac + t-io_raw.c t-jac.c t-lcm.c t-lucnum_ui.c t-mul.c t-mul_i.c \ + t-nextprime.c t-oddeven.c t-perfpow.c t-perfsqr.c t-popcount.c \ + t-pow.c t-powm.c t-powm_ui.c t-pprime_p.c t-root.c t-scan.c \ + t-set_d.c t-set_f.c t-set_si.c t-set_str.c t-sizeinbase.c \ + t-sqrtrem.c t-tdiv.c t-tdiv_ui.c ETAGS = etags CTAGS = ctags -am__tty_colors = \ -red=; grn=; lgn=; blu=; std= DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABI = @ABI@ ACLOCAL = @ACLOCAL@ @@ -470,6 +420,7 @@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ +BITS_PER_MP_LIMB = @BITS_PER_MP_LIMB@ CALLING_CONVENTIONS_OBJS = @CALLING_CONVENTIONS_OBJS@ CC = @CC@ CCAS = @CCAS@ @@ -485,17 +436,16 @@ CYGPATH_W = @CYGPATH_W@ DEFN_LONG_LONG_LIMB = @DEFN_LONG_LONG_LIMB@ DEFS = @DEFS@ DLLTOOL = @DLLTOOL@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ +ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ +ENABLE_STATIC_FALSE = @ENABLE_STATIC_FALSE@ +ENABLE_STATIC_TRUE = @ENABLE_STATIC_TRUE@ EXEEXT = @EXEEXT@ EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@ -FGREP = @FGREP@ GMP_LDFLAGS = @GMP_LDFLAGS@ -GMP_LIMB_BITS = @GMP_LIMB_BITS@ GMP_NAIL_BITS = @GMP_NAIL_BITS@ GREP = @GREP@ HAVE_CLOCK_01 = @HAVE_CLOCK_01@ @@ -509,12 +459,10 @@ HAVE_SIGALTSTACK_01 = @HAVE_SIGALTSTACK_01@ HAVE_SIGSTACK_01 = @HAVE_SIGSTACK_01@ HAVE_STACK_T_01 = @HAVE_STACK_T_01@ HAVE_SYS_RESOURCE_H_01 = @HAVE_SYS_RESOURCE_H_01@ -INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LD = @LD@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ @@ -529,26 +477,20 @@ LIBOBJS = @LIBOBJS@ LIBREADLINE = @LIBREADLINE@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ M4 = @M4@ MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ -MANIFEST_TOOL = @MANIFEST_TOOL@ -MKDIR_P = @MKDIR_P@ -NM = @NM@ -NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ @@ -558,31 +500,26 @@ SHELL = @SHELL@ SPEED_CYCLECOUNTER_OBJ = @SPEED_CYCLECOUNTER_OBJ@ STRIP = @STRIP@ TAL_OBJECT = @TAL_OBJECT@ -TUNE_LIBS = @TUNE_LIBS@ TUNE_SQR_OBJ = @TUNE_SQR_OBJ@ +U = @U@ U_FOR_BUILD = @U_FOR_BUILD@ VERSION = @VERSION@ +WANT_CXX_FALSE = @WANT_CXX_FALSE@ +WANT_CXX_TRUE = @WANT_CXX_TRUE@ +WANT_MPBSD_FALSE = @WANT_MPBSD_FALSE@ +WANT_MPBSD_TRUE = @WANT_MPBSD_TRUE@ WITH_READLINE_01 = @WITH_READLINE_01@ YACC = @YACC@ YFLAGS = @YFLAGS@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__leading_dot = @am__leading_dot@ -am__tar = @am__tar@ -am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ -builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ @@ -606,6 +543,7 @@ mandir = @mandir@ mkdir_p = @mkdir_p@ mpn_objects = @mpn_objects@ mpn_objs_in_libgmp = @mpn_objs_in_libgmp@ +mpn_objs_in_libmp = @mpn_objs_in_libmp@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ @@ -613,12 +551,8 @@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/tests LDADD = $(top_builddir)/tests/libtests.la $(top_builddir)/libgmp.la TESTS = $(check_PROGRAMS) @@ -635,14 +569,14 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ exit 1;; \ esac; \ done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps tests/mpz/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu --ignore-deps tests/mpz/Makefile + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps tests/mpz/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu --ignore-deps tests/mpz/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ @@ -660,211 +594,198 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): clean-checkPROGRAMS: - @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ - echo " rm -f" $$list; \ - rm -f $$list || exit $$?; \ - test -n "$(EXEEXT)" || exit 0; \ - list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ - echo " rm -f" $$list; \ - rm -f $$list -bit$(EXEEXT): $(bit_OBJECTS) $(bit_DEPENDENCIES) $(EXTRA_bit_DEPENDENCIES) + @list='$(check_PROGRAMS)'; for p in $$list; do \ + f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f $$p $$f"; \ + rm -f $$p $$f ; \ + done +bit$(EXEEXT): $(bit_OBJECTS) $(bit_DEPENDENCIES) @rm -f bit$(EXEEXT) - $(LINK) $(bit_OBJECTS) $(bit_LDADD) $(LIBS) -convert$(EXEEXT): $(convert_OBJECTS) $(convert_DEPENDENCIES) $(EXTRA_convert_DEPENDENCIES) + $(LINK) $(bit_LDFLAGS) $(bit_OBJECTS) $(bit_LDADD) $(LIBS) +convert$(EXEEXT): $(convert_OBJECTS) $(convert_DEPENDENCIES) @rm -f convert$(EXEEXT) - $(LINK) $(convert_OBJECTS) $(convert_LDADD) $(LIBS) -dive$(EXEEXT): $(dive_OBJECTS) $(dive_DEPENDENCIES) $(EXTRA_dive_DEPENDENCIES) + $(LINK) $(convert_LDFLAGS) $(convert_OBJECTS) $(convert_LDADD) $(LIBS) +dive$(EXEEXT): $(dive_OBJECTS) $(dive_DEPENDENCIES) @rm -f dive$(EXEEXT) - $(LINK) $(dive_OBJECTS) $(dive_LDADD) $(LIBS) -dive_ui$(EXEEXT): $(dive_ui_OBJECTS) $(dive_ui_DEPENDENCIES) $(EXTRA_dive_ui_DEPENDENCIES) + $(LINK) $(dive_LDFLAGS) $(dive_OBJECTS) $(dive_LDADD) $(LIBS) +dive_ui$(EXEEXT): $(dive_ui_OBJECTS) $(dive_ui_DEPENDENCIES) @rm -f dive_ui$(EXEEXT) - $(LINK) $(dive_ui_OBJECTS) $(dive_ui_LDADD) $(LIBS) -io$(EXEEXT): $(io_OBJECTS) $(io_DEPENDENCIES) $(EXTRA_io_DEPENDENCIES) + $(LINK) $(dive_ui_LDFLAGS) $(dive_ui_OBJECTS) $(dive_ui_LDADD) $(LIBS) +io$(EXEEXT): $(io_OBJECTS) $(io_DEPENDENCIES) @rm -f io$(EXEEXT) - $(LINK) $(io_OBJECTS) $(io_LDADD) $(LIBS) -logic$(EXEEXT): $(logic_OBJECTS) $(logic_DEPENDENCIES) $(EXTRA_logic_DEPENDENCIES) + $(LINK) $(io_LDFLAGS) $(io_OBJECTS) $(io_LDADD) $(LIBS) +logic$(EXEEXT): $(logic_OBJECTS) $(logic_DEPENDENCIES) @rm -f logic$(EXEEXT) - $(LINK) $(logic_OBJECTS) $(logic_LDADD) $(LIBS) -reuse$(EXEEXT): $(reuse_OBJECTS) $(reuse_DEPENDENCIES) $(EXTRA_reuse_DEPENDENCIES) + $(LINK) $(logic_LDFLAGS) $(logic_OBJECTS) $(logic_LDADD) $(LIBS) +reuse$(EXEEXT): $(reuse_OBJECTS) $(reuse_DEPENDENCIES) @rm -f reuse$(EXEEXT) - $(LINK) $(reuse_OBJECTS) $(reuse_LDADD) $(LIBS) -t-addsub$(EXEEXT): $(t_addsub_OBJECTS) $(t_addsub_DEPENDENCIES) $(EXTRA_t_addsub_DEPENDENCIES) + $(LINK) $(reuse_LDFLAGS) $(reuse_OBJECTS) $(reuse_LDADD) $(LIBS) +t-addsub$(EXEEXT): $(t_addsub_OBJECTS) $(t_addsub_DEPENDENCIES) @rm -f t-addsub$(EXEEXT) - $(LINK) $(t_addsub_OBJECTS) $(t_addsub_LDADD) $(LIBS) -t-aorsmul$(EXEEXT): $(t_aorsmul_OBJECTS) $(t_aorsmul_DEPENDENCIES) $(EXTRA_t_aorsmul_DEPENDENCIES) + $(LINK) $(t_addsub_LDFLAGS) $(t_addsub_OBJECTS) $(t_addsub_LDADD) $(LIBS) +t-aorsmul$(EXEEXT): $(t_aorsmul_OBJECTS) $(t_aorsmul_DEPENDENCIES) @rm -f t-aorsmul$(EXEEXT) - $(LINK) $(t_aorsmul_OBJECTS) $(t_aorsmul_LDADD) $(LIBS) -t-bin$(EXEEXT): $(t_bin_OBJECTS) $(t_bin_DEPENDENCIES) $(EXTRA_t_bin_DEPENDENCIES) + $(LINK) $(t_aorsmul_LDFLAGS) $(t_aorsmul_OBJECTS) $(t_aorsmul_LDADD) $(LIBS) +t-bin$(EXEEXT): $(t_bin_OBJECTS) $(t_bin_DEPENDENCIES) @rm -f t-bin$(EXEEXT) - $(LINK) $(t_bin_OBJECTS) $(t_bin_LDADD) $(LIBS) -t-cdiv_ui$(EXEEXT): $(t_cdiv_ui_OBJECTS) $(t_cdiv_ui_DEPENDENCIES) $(EXTRA_t_cdiv_ui_DEPENDENCIES) + $(LINK) $(t_bin_LDFLAGS) $(t_bin_OBJECTS) $(t_bin_LDADD) $(LIBS) +t-cdiv_ui$(EXEEXT): $(t_cdiv_ui_OBJECTS) $(t_cdiv_ui_DEPENDENCIES) @rm -f t-cdiv_ui$(EXEEXT) - $(LINK) $(t_cdiv_ui_OBJECTS) $(t_cdiv_ui_LDADD) $(LIBS) -t-cmp$(EXEEXT): $(t_cmp_OBJECTS) $(t_cmp_DEPENDENCIES) $(EXTRA_t_cmp_DEPENDENCIES) + $(LINK) $(t_cdiv_ui_LDFLAGS) $(t_cdiv_ui_OBJECTS) $(t_cdiv_ui_LDADD) $(LIBS) +t-cmp$(EXEEXT): $(t_cmp_OBJECTS) $(t_cmp_DEPENDENCIES) @rm -f t-cmp$(EXEEXT) - $(LINK) $(t_cmp_OBJECTS) $(t_cmp_LDADD) $(LIBS) -t-cmp_d$(EXEEXT): $(t_cmp_d_OBJECTS) $(t_cmp_d_DEPENDENCIES) $(EXTRA_t_cmp_d_DEPENDENCIES) + $(LINK) $(t_cmp_LDFLAGS) $(t_cmp_OBJECTS) $(t_cmp_LDADD) $(LIBS) +t-cmp_d$(EXEEXT): $(t_cmp_d_OBJECTS) $(t_cmp_d_DEPENDENCIES) @rm -f t-cmp_d$(EXEEXT) - $(LINK) $(t_cmp_d_OBJECTS) $(t_cmp_d_LDADD) $(LIBS) -t-cmp_si$(EXEEXT): $(t_cmp_si_OBJECTS) $(t_cmp_si_DEPENDENCIES) $(EXTRA_t_cmp_si_DEPENDENCIES) + $(LINK) $(t_cmp_d_LDFLAGS) $(t_cmp_d_OBJECTS) $(t_cmp_d_LDADD) $(LIBS) +t-cmp_si$(EXEEXT): $(t_cmp_si_OBJECTS) $(t_cmp_si_DEPENDENCIES) @rm -f t-cmp_si$(EXEEXT) - $(LINK) $(t_cmp_si_OBJECTS) $(t_cmp_si_LDADD) $(LIBS) -t-cong$(EXEEXT): $(t_cong_OBJECTS) $(t_cong_DEPENDENCIES) $(EXTRA_t_cong_DEPENDENCIES) + $(LINK) $(t_cmp_si_LDFLAGS) $(t_cmp_si_OBJECTS) $(t_cmp_si_LDADD) $(LIBS) +t-cong$(EXEEXT): $(t_cong_OBJECTS) $(t_cong_DEPENDENCIES) @rm -f t-cong$(EXEEXT) - $(LINK) $(t_cong_OBJECTS) $(t_cong_LDADD) $(LIBS) -t-cong_2exp$(EXEEXT): $(t_cong_2exp_OBJECTS) $(t_cong_2exp_DEPENDENCIES) $(EXTRA_t_cong_2exp_DEPENDENCIES) + $(LINK) $(t_cong_LDFLAGS) $(t_cong_OBJECTS) $(t_cong_LDADD) $(LIBS) +t-cong_2exp$(EXEEXT): $(t_cong_2exp_OBJECTS) $(t_cong_2exp_DEPENDENCIES) @rm -f t-cong_2exp$(EXEEXT) - $(LINK) $(t_cong_2exp_OBJECTS) $(t_cong_2exp_LDADD) $(LIBS) -t-div_2exp$(EXEEXT): $(t_div_2exp_OBJECTS) $(t_div_2exp_DEPENDENCIES) $(EXTRA_t_div_2exp_DEPENDENCIES) + $(LINK) $(t_cong_2exp_LDFLAGS) $(t_cong_2exp_OBJECTS) $(t_cong_2exp_LDADD) $(LIBS) +t-div_2exp$(EXEEXT): $(t_div_2exp_OBJECTS) $(t_div_2exp_DEPENDENCIES) @rm -f t-div_2exp$(EXEEXT) - $(LINK) $(t_div_2exp_OBJECTS) $(t_div_2exp_LDADD) $(LIBS) -t-divis$(EXEEXT): $(t_divis_OBJECTS) $(t_divis_DEPENDENCIES) $(EXTRA_t_divis_DEPENDENCIES) + $(LINK) $(t_div_2exp_LDFLAGS) $(t_div_2exp_OBJECTS) $(t_div_2exp_LDADD) $(LIBS) +t-divis$(EXEEXT): $(t_divis_OBJECTS) $(t_divis_DEPENDENCIES) @rm -f t-divis$(EXEEXT) - $(LINK) $(t_divis_OBJECTS) $(t_divis_LDADD) $(LIBS) -t-divis_2exp$(EXEEXT): $(t_divis_2exp_OBJECTS) $(t_divis_2exp_DEPENDENCIES) $(EXTRA_t_divis_2exp_DEPENDENCIES) + $(LINK) $(t_divis_LDFLAGS) $(t_divis_OBJECTS) $(t_divis_LDADD) $(LIBS) +t-divis_2exp$(EXEEXT): $(t_divis_2exp_OBJECTS) $(t_divis_2exp_DEPENDENCIES) @rm -f t-divis_2exp$(EXEEXT) - $(LINK) $(t_divis_2exp_OBJECTS) $(t_divis_2exp_LDADD) $(LIBS) -t-export$(EXEEXT): $(t_export_OBJECTS) $(t_export_DEPENDENCIES) $(EXTRA_t_export_DEPENDENCIES) + $(LINK) $(t_divis_2exp_LDFLAGS) $(t_divis_2exp_OBJECTS) $(t_divis_2exp_LDADD) $(LIBS) +t-export$(EXEEXT): $(t_export_OBJECTS) $(t_export_DEPENDENCIES) @rm -f t-export$(EXEEXT) - $(LINK) $(t_export_OBJECTS) $(t_export_LDADD) $(LIBS) -t-fac_ui$(EXEEXT): $(t_fac_ui_OBJECTS) $(t_fac_ui_DEPENDENCIES) $(EXTRA_t_fac_ui_DEPENDENCIES) + $(LINK) $(t_export_LDFLAGS) $(t_export_OBJECTS) $(t_export_LDADD) $(LIBS) +t-fac_ui$(EXEEXT): $(t_fac_ui_OBJECTS) $(t_fac_ui_DEPENDENCIES) @rm -f t-fac_ui$(EXEEXT) - $(LINK) $(t_fac_ui_OBJECTS) $(t_fac_ui_LDADD) $(LIBS) -t-fdiv$(EXEEXT): $(t_fdiv_OBJECTS) $(t_fdiv_DEPENDENCIES) $(EXTRA_t_fdiv_DEPENDENCIES) + $(LINK) $(t_fac_ui_LDFLAGS) $(t_fac_ui_OBJECTS) $(t_fac_ui_LDADD) $(LIBS) +t-fdiv$(EXEEXT): $(t_fdiv_OBJECTS) $(t_fdiv_DEPENDENCIES) @rm -f t-fdiv$(EXEEXT) - $(LINK) $(t_fdiv_OBJECTS) $(t_fdiv_LDADD) $(LIBS) -t-fdiv_ui$(EXEEXT): $(t_fdiv_ui_OBJECTS) $(t_fdiv_ui_DEPENDENCIES) $(EXTRA_t_fdiv_ui_DEPENDENCIES) + $(LINK) $(t_fdiv_LDFLAGS) $(t_fdiv_OBJECTS) $(t_fdiv_LDADD) $(LIBS) +t-fdiv_ui$(EXEEXT): $(t_fdiv_ui_OBJECTS) $(t_fdiv_ui_DEPENDENCIES) @rm -f t-fdiv_ui$(EXEEXT) - $(LINK) $(t_fdiv_ui_OBJECTS) $(t_fdiv_ui_LDADD) $(LIBS) -t-fib_ui$(EXEEXT): $(t_fib_ui_OBJECTS) $(t_fib_ui_DEPENDENCIES) $(EXTRA_t_fib_ui_DEPENDENCIES) + $(LINK) $(t_fdiv_ui_LDFLAGS) $(t_fdiv_ui_OBJECTS) $(t_fdiv_ui_LDADD) $(LIBS) +t-fib_ui$(EXEEXT): $(t_fib_ui_OBJECTS) $(t_fib_ui_DEPENDENCIES) @rm -f t-fib_ui$(EXEEXT) - $(LINK) $(t_fib_ui_OBJECTS) $(t_fib_ui_LDADD) $(LIBS) -t-fits$(EXEEXT): $(t_fits_OBJECTS) $(t_fits_DEPENDENCIES) $(EXTRA_t_fits_DEPENDENCIES) + $(LINK) $(t_fib_ui_LDFLAGS) $(t_fib_ui_OBJECTS) $(t_fib_ui_LDADD) $(LIBS) +t-fits$(EXEEXT): $(t_fits_OBJECTS) $(t_fits_DEPENDENCIES) @rm -f t-fits$(EXEEXT) - $(LINK) $(t_fits_OBJECTS) $(t_fits_LDADD) $(LIBS) -t-gcd$(EXEEXT): $(t_gcd_OBJECTS) $(t_gcd_DEPENDENCIES) $(EXTRA_t_gcd_DEPENDENCIES) + $(LINK) $(t_fits_LDFLAGS) $(t_fits_OBJECTS) $(t_fits_LDADD) $(LIBS) +t-gcd$(EXEEXT): $(t_gcd_OBJECTS) $(t_gcd_DEPENDENCIES) @rm -f t-gcd$(EXEEXT) - $(LINK) $(t_gcd_OBJECTS) $(t_gcd_LDADD) $(LIBS) -t-gcd_ui$(EXEEXT): $(t_gcd_ui_OBJECTS) $(t_gcd_ui_DEPENDENCIES) $(EXTRA_t_gcd_ui_DEPENDENCIES) + $(LINK) $(t_gcd_LDFLAGS) $(t_gcd_OBJECTS) $(t_gcd_LDADD) $(LIBS) +t-gcd_ui$(EXEEXT): $(t_gcd_ui_OBJECTS) $(t_gcd_ui_DEPENDENCIES) @rm -f t-gcd_ui$(EXEEXT) - $(LINK) $(t_gcd_ui_OBJECTS) $(t_gcd_ui_LDADD) $(LIBS) -t-get_d$(EXEEXT): $(t_get_d_OBJECTS) $(t_get_d_DEPENDENCIES) $(EXTRA_t_get_d_DEPENDENCIES) + $(LINK) $(t_gcd_ui_LDFLAGS) $(t_gcd_ui_OBJECTS) $(t_gcd_ui_LDADD) $(LIBS) +t-get_d$(EXEEXT): $(t_get_d_OBJECTS) $(t_get_d_DEPENDENCIES) @rm -f t-get_d$(EXEEXT) - $(LINK) $(t_get_d_OBJECTS) $(t_get_d_LDADD) $(LIBS) -t-get_d_2exp$(EXEEXT): $(t_get_d_2exp_OBJECTS) $(t_get_d_2exp_DEPENDENCIES) $(EXTRA_t_get_d_2exp_DEPENDENCIES) + $(LINK) $(t_get_d_LDFLAGS) $(t_get_d_OBJECTS) $(t_get_d_LDADD) $(LIBS) +t-get_d_2exp$(EXEEXT): $(t_get_d_2exp_OBJECTS) $(t_get_d_2exp_DEPENDENCIES) @rm -f t-get_d_2exp$(EXEEXT) - $(LINK) $(t_get_d_2exp_OBJECTS) $(t_get_d_2exp_LDADD) $(LIBS) -t-get_si$(EXEEXT): $(t_get_si_OBJECTS) $(t_get_si_DEPENDENCIES) $(EXTRA_t_get_si_DEPENDENCIES) + $(LINK) $(t_get_d_2exp_LDFLAGS) $(t_get_d_2exp_OBJECTS) $(t_get_d_2exp_LDADD) $(LIBS) +t-get_si$(EXEEXT): $(t_get_si_OBJECTS) $(t_get_si_DEPENDENCIES) @rm -f t-get_si$(EXEEXT) - $(LINK) $(t_get_si_OBJECTS) $(t_get_si_LDADD) $(LIBS) -t-hamdist$(EXEEXT): $(t_hamdist_OBJECTS) $(t_hamdist_DEPENDENCIES) $(EXTRA_t_hamdist_DEPENDENCIES) + $(LINK) $(t_get_si_LDFLAGS) $(t_get_si_OBJECTS) $(t_get_si_LDADD) $(LIBS) +t-hamdist$(EXEEXT): $(t_hamdist_OBJECTS) $(t_hamdist_DEPENDENCIES) @rm -f t-hamdist$(EXEEXT) - $(LINK) $(t_hamdist_OBJECTS) $(t_hamdist_LDADD) $(LIBS) -t-import$(EXEEXT): $(t_import_OBJECTS) $(t_import_DEPENDENCIES) $(EXTRA_t_import_DEPENDENCIES) + $(LINK) $(t_hamdist_LDFLAGS) $(t_hamdist_OBJECTS) $(t_hamdist_LDADD) $(LIBS) +t-import$(EXEEXT): $(t_import_OBJECTS) $(t_import_DEPENDENCIES) @rm -f t-import$(EXEEXT) - $(LINK) $(t_import_OBJECTS) $(t_import_LDADD) $(LIBS) -t-inp_str$(EXEEXT): $(t_inp_str_OBJECTS) $(t_inp_str_DEPENDENCIES) $(EXTRA_t_inp_str_DEPENDENCIES) + $(LINK) $(t_import_LDFLAGS) $(t_import_OBJECTS) $(t_import_LDADD) $(LIBS) +t-inp_str$(EXEEXT): $(t_inp_str_OBJECTS) $(t_inp_str_DEPENDENCIES) @rm -f t-inp_str$(EXEEXT) - $(LINK) $(t_inp_str_OBJECTS) $(t_inp_str_LDADD) $(LIBS) -t-invert$(EXEEXT): $(t_invert_OBJECTS) $(t_invert_DEPENDENCIES) $(EXTRA_t_invert_DEPENDENCIES) - @rm -f t-invert$(EXEEXT) - $(LINK) $(t_invert_OBJECTS) $(t_invert_LDADD) $(LIBS) -t-io_raw$(EXEEXT): $(t_io_raw_OBJECTS) $(t_io_raw_DEPENDENCIES) $(EXTRA_t_io_raw_DEPENDENCIES) + $(LINK) $(t_inp_str_LDFLAGS) $(t_inp_str_OBJECTS) $(t_inp_str_LDADD) $(LIBS) +t-io_raw$(EXEEXT): $(t_io_raw_OBJECTS) $(t_io_raw_DEPENDENCIES) @rm -f t-io_raw$(EXEEXT) - $(LINK) $(t_io_raw_OBJECTS) $(t_io_raw_LDADD) $(LIBS) -t-jac$(EXEEXT): $(t_jac_OBJECTS) $(t_jac_DEPENDENCIES) $(EXTRA_t_jac_DEPENDENCIES) + $(LINK) $(t_io_raw_LDFLAGS) $(t_io_raw_OBJECTS) $(t_io_raw_LDADD) $(LIBS) +t-jac$(EXEEXT): $(t_jac_OBJECTS) $(t_jac_DEPENDENCIES) @rm -f t-jac$(EXEEXT) - $(LINK) $(t_jac_OBJECTS) $(t_jac_LDADD) $(LIBS) -t-lcm$(EXEEXT): $(t_lcm_OBJECTS) $(t_lcm_DEPENDENCIES) $(EXTRA_t_lcm_DEPENDENCIES) + $(LINK) $(t_jac_LDFLAGS) $(t_jac_OBJECTS) $(t_jac_LDADD) $(LIBS) +t-lcm$(EXEEXT): $(t_lcm_OBJECTS) $(t_lcm_DEPENDENCIES) @rm -f t-lcm$(EXEEXT) - $(LINK) $(t_lcm_OBJECTS) $(t_lcm_LDADD) $(LIBS) -t-limbs$(EXEEXT): $(t_limbs_OBJECTS) $(t_limbs_DEPENDENCIES) $(EXTRA_t_limbs_DEPENDENCIES) - @rm -f t-limbs$(EXEEXT) - $(LINK) $(t_limbs_OBJECTS) $(t_limbs_LDADD) $(LIBS) -t-lucnum_ui$(EXEEXT): $(t_lucnum_ui_OBJECTS) $(t_lucnum_ui_DEPENDENCIES) $(EXTRA_t_lucnum_ui_DEPENDENCIES) + $(LINK) $(t_lcm_LDFLAGS) $(t_lcm_OBJECTS) $(t_lcm_LDADD) $(LIBS) +t-lucnum_ui$(EXEEXT): $(t_lucnum_ui_OBJECTS) $(t_lucnum_ui_DEPENDENCIES) @rm -f t-lucnum_ui$(EXEEXT) - $(LINK) $(t_lucnum_ui_OBJECTS) $(t_lucnum_ui_LDADD) $(LIBS) -t-mfac_uiui$(EXEEXT): $(t_mfac_uiui_OBJECTS) $(t_mfac_uiui_DEPENDENCIES) $(EXTRA_t_mfac_uiui_DEPENDENCIES) - @rm -f t-mfac_uiui$(EXEEXT) - $(LINK) $(t_mfac_uiui_OBJECTS) $(t_mfac_uiui_LDADD) $(LIBS) -t-mul$(EXEEXT): $(t_mul_OBJECTS) $(t_mul_DEPENDENCIES) $(EXTRA_t_mul_DEPENDENCIES) + $(LINK) $(t_lucnum_ui_LDFLAGS) $(t_lucnum_ui_OBJECTS) $(t_lucnum_ui_LDADD) $(LIBS) +t-mul$(EXEEXT): $(t_mul_OBJECTS) $(t_mul_DEPENDENCIES) @rm -f t-mul$(EXEEXT) - $(LINK) $(t_mul_OBJECTS) $(t_mul_LDADD) $(LIBS) -t-mul_i$(EXEEXT): $(t_mul_i_OBJECTS) $(t_mul_i_DEPENDENCIES) $(EXTRA_t_mul_i_DEPENDENCIES) + $(LINK) $(t_mul_LDFLAGS) $(t_mul_OBJECTS) $(t_mul_LDADD) $(LIBS) +t-mul_i$(EXEEXT): $(t_mul_i_OBJECTS) $(t_mul_i_DEPENDENCIES) @rm -f t-mul_i$(EXEEXT) - $(LINK) $(t_mul_i_OBJECTS) $(t_mul_i_LDADD) $(LIBS) -t-nextprime$(EXEEXT): $(t_nextprime_OBJECTS) $(t_nextprime_DEPENDENCIES) $(EXTRA_t_nextprime_DEPENDENCIES) + $(LINK) $(t_mul_i_LDFLAGS) $(t_mul_i_OBJECTS) $(t_mul_i_LDADD) $(LIBS) +t-nextprime$(EXEEXT): $(t_nextprime_OBJECTS) $(t_nextprime_DEPENDENCIES) @rm -f t-nextprime$(EXEEXT) - $(LINK) $(t_nextprime_OBJECTS) $(t_nextprime_LDADD) $(LIBS) -t-oddeven$(EXEEXT): $(t_oddeven_OBJECTS) $(t_oddeven_DEPENDENCIES) $(EXTRA_t_oddeven_DEPENDENCIES) + $(LINK) $(t_nextprime_LDFLAGS) $(t_nextprime_OBJECTS) $(t_nextprime_LDADD) $(LIBS) +t-oddeven$(EXEEXT): $(t_oddeven_OBJECTS) $(t_oddeven_DEPENDENCIES) @rm -f t-oddeven$(EXEEXT) - $(LINK) $(t_oddeven_OBJECTS) $(t_oddeven_LDADD) $(LIBS) -t-perfpow$(EXEEXT): $(t_perfpow_OBJECTS) $(t_perfpow_DEPENDENCIES) $(EXTRA_t_perfpow_DEPENDENCIES) + $(LINK) $(t_oddeven_LDFLAGS) $(t_oddeven_OBJECTS) $(t_oddeven_LDADD) $(LIBS) +t-perfpow$(EXEEXT): $(t_perfpow_OBJECTS) $(t_perfpow_DEPENDENCIES) @rm -f t-perfpow$(EXEEXT) - $(LINK) $(t_perfpow_OBJECTS) $(t_perfpow_LDADD) $(LIBS) -t-perfsqr$(EXEEXT): $(t_perfsqr_OBJECTS) $(t_perfsqr_DEPENDENCIES) $(EXTRA_t_perfsqr_DEPENDENCIES) + $(LINK) $(t_perfpow_LDFLAGS) $(t_perfpow_OBJECTS) $(t_perfpow_LDADD) $(LIBS) +t-perfsqr$(EXEEXT): $(t_perfsqr_OBJECTS) $(t_perfsqr_DEPENDENCIES) @rm -f t-perfsqr$(EXEEXT) - $(LINK) $(t_perfsqr_OBJECTS) $(t_perfsqr_LDADD) $(LIBS) -t-popcount$(EXEEXT): $(t_popcount_OBJECTS) $(t_popcount_DEPENDENCIES) $(EXTRA_t_popcount_DEPENDENCIES) + $(LINK) $(t_perfsqr_LDFLAGS) $(t_perfsqr_OBJECTS) $(t_perfsqr_LDADD) $(LIBS) +t-popcount$(EXEEXT): $(t_popcount_OBJECTS) $(t_popcount_DEPENDENCIES) @rm -f t-popcount$(EXEEXT) - $(LINK) $(t_popcount_OBJECTS) $(t_popcount_LDADD) $(LIBS) -t-pow$(EXEEXT): $(t_pow_OBJECTS) $(t_pow_DEPENDENCIES) $(EXTRA_t_pow_DEPENDENCIES) + $(LINK) $(t_popcount_LDFLAGS) $(t_popcount_OBJECTS) $(t_popcount_LDADD) $(LIBS) +t-pow$(EXEEXT): $(t_pow_OBJECTS) $(t_pow_DEPENDENCIES) @rm -f t-pow$(EXEEXT) - $(LINK) $(t_pow_OBJECTS) $(t_pow_LDADD) $(LIBS) -t-powm$(EXEEXT): $(t_powm_OBJECTS) $(t_powm_DEPENDENCIES) $(EXTRA_t_powm_DEPENDENCIES) + $(LINK) $(t_pow_LDFLAGS) $(t_pow_OBJECTS) $(t_pow_LDADD) $(LIBS) +t-powm$(EXEEXT): $(t_powm_OBJECTS) $(t_powm_DEPENDENCIES) @rm -f t-powm$(EXEEXT) - $(LINK) $(t_powm_OBJECTS) $(t_powm_LDADD) $(LIBS) -t-powm_ui$(EXEEXT): $(t_powm_ui_OBJECTS) $(t_powm_ui_DEPENDENCIES) $(EXTRA_t_powm_ui_DEPENDENCIES) + $(LINK) $(t_powm_LDFLAGS) $(t_powm_OBJECTS) $(t_powm_LDADD) $(LIBS) +t-powm_ui$(EXEEXT): $(t_powm_ui_OBJECTS) $(t_powm_ui_DEPENDENCIES) @rm -f t-powm_ui$(EXEEXT) - $(LINK) $(t_powm_ui_OBJECTS) $(t_powm_ui_LDADD) $(LIBS) -t-pprime_p$(EXEEXT): $(t_pprime_p_OBJECTS) $(t_pprime_p_DEPENDENCIES) $(EXTRA_t_pprime_p_DEPENDENCIES) + $(LINK) $(t_powm_ui_LDFLAGS) $(t_powm_ui_OBJECTS) $(t_powm_ui_LDADD) $(LIBS) +t-pprime_p$(EXEEXT): $(t_pprime_p_OBJECTS) $(t_pprime_p_DEPENDENCIES) @rm -f t-pprime_p$(EXEEXT) - $(LINK) $(t_pprime_p_OBJECTS) $(t_pprime_p_LDADD) $(LIBS) -t-primorial_ui$(EXEEXT): $(t_primorial_ui_OBJECTS) $(t_primorial_ui_DEPENDENCIES) $(EXTRA_t_primorial_ui_DEPENDENCIES) - @rm -f t-primorial_ui$(EXEEXT) - $(LINK) $(t_primorial_ui_OBJECTS) $(t_primorial_ui_LDADD) $(LIBS) -t-remove$(EXEEXT): $(t_remove_OBJECTS) $(t_remove_DEPENDENCIES) $(EXTRA_t_remove_DEPENDENCIES) - @rm -f t-remove$(EXEEXT) - $(LINK) $(t_remove_OBJECTS) $(t_remove_LDADD) $(LIBS) -t-root$(EXEEXT): $(t_root_OBJECTS) $(t_root_DEPENDENCIES) $(EXTRA_t_root_DEPENDENCIES) + $(LINK) $(t_pprime_p_LDFLAGS) $(t_pprime_p_OBJECTS) $(t_pprime_p_LDADD) $(LIBS) +t-root$(EXEEXT): $(t_root_OBJECTS) $(t_root_DEPENDENCIES) @rm -f t-root$(EXEEXT) - $(LINK) $(t_root_OBJECTS) $(t_root_LDADD) $(LIBS) -t-scan$(EXEEXT): $(t_scan_OBJECTS) $(t_scan_DEPENDENCIES) $(EXTRA_t_scan_DEPENDENCIES) + $(LINK) $(t_root_LDFLAGS) $(t_root_OBJECTS) $(t_root_LDADD) $(LIBS) +t-scan$(EXEEXT): $(t_scan_OBJECTS) $(t_scan_DEPENDENCIES) @rm -f t-scan$(EXEEXT) - $(LINK) $(t_scan_OBJECTS) $(t_scan_LDADD) $(LIBS) -t-set_d$(EXEEXT): $(t_set_d_OBJECTS) $(t_set_d_DEPENDENCIES) $(EXTRA_t_set_d_DEPENDENCIES) + $(LINK) $(t_scan_LDFLAGS) $(t_scan_OBJECTS) $(t_scan_LDADD) $(LIBS) +t-set_d$(EXEEXT): $(t_set_d_OBJECTS) $(t_set_d_DEPENDENCIES) @rm -f t-set_d$(EXEEXT) - $(LINK) $(t_set_d_OBJECTS) $(t_set_d_LDADD) $(LIBS) -t-set_f$(EXEEXT): $(t_set_f_OBJECTS) $(t_set_f_DEPENDENCIES) $(EXTRA_t_set_f_DEPENDENCIES) + $(LINK) $(t_set_d_LDFLAGS) $(t_set_d_OBJECTS) $(t_set_d_LDADD) $(LIBS) +t-set_f$(EXEEXT): $(t_set_f_OBJECTS) $(t_set_f_DEPENDENCIES) @rm -f t-set_f$(EXEEXT) - $(LINK) $(t_set_f_OBJECTS) $(t_set_f_LDADD) $(LIBS) -t-set_si$(EXEEXT): $(t_set_si_OBJECTS) $(t_set_si_DEPENDENCIES) $(EXTRA_t_set_si_DEPENDENCIES) + $(LINK) $(t_set_f_LDFLAGS) $(t_set_f_OBJECTS) $(t_set_f_LDADD) $(LIBS) +t-set_si$(EXEEXT): $(t_set_si_OBJECTS) $(t_set_si_DEPENDENCIES) @rm -f t-set_si$(EXEEXT) - $(LINK) $(t_set_si_OBJECTS) $(t_set_si_LDADD) $(LIBS) -t-set_str$(EXEEXT): $(t_set_str_OBJECTS) $(t_set_str_DEPENDENCIES) $(EXTRA_t_set_str_DEPENDENCIES) + $(LINK) $(t_set_si_LDFLAGS) $(t_set_si_OBJECTS) $(t_set_si_LDADD) $(LIBS) +t-set_str$(EXEEXT): $(t_set_str_OBJECTS) $(t_set_str_DEPENDENCIES) @rm -f t-set_str$(EXEEXT) - $(LINK) $(t_set_str_OBJECTS) $(t_set_str_LDADD) $(LIBS) -t-sizeinbase$(EXEEXT): $(t_sizeinbase_OBJECTS) $(t_sizeinbase_DEPENDENCIES) $(EXTRA_t_sizeinbase_DEPENDENCIES) + $(LINK) $(t_set_str_LDFLAGS) $(t_set_str_OBJECTS) $(t_set_str_LDADD) $(LIBS) +t-sizeinbase$(EXEEXT): $(t_sizeinbase_OBJECTS) $(t_sizeinbase_DEPENDENCIES) @rm -f t-sizeinbase$(EXEEXT) - $(LINK) $(t_sizeinbase_OBJECTS) $(t_sizeinbase_LDADD) $(LIBS) -t-sqrtrem$(EXEEXT): $(t_sqrtrem_OBJECTS) $(t_sqrtrem_DEPENDENCIES) $(EXTRA_t_sqrtrem_DEPENDENCIES) + $(LINK) $(t_sizeinbase_LDFLAGS) $(t_sizeinbase_OBJECTS) $(t_sizeinbase_LDADD) $(LIBS) +t-sqrtrem$(EXEEXT): $(t_sqrtrem_OBJECTS) $(t_sqrtrem_DEPENDENCIES) @rm -f t-sqrtrem$(EXEEXT) - $(LINK) $(t_sqrtrem_OBJECTS) $(t_sqrtrem_LDADD) $(LIBS) -t-tdiv$(EXEEXT): $(t_tdiv_OBJECTS) $(t_tdiv_DEPENDENCIES) $(EXTRA_t_tdiv_DEPENDENCIES) + $(LINK) $(t_sqrtrem_LDFLAGS) $(t_sqrtrem_OBJECTS) $(t_sqrtrem_LDADD) $(LIBS) +t-tdiv$(EXEEXT): $(t_tdiv_OBJECTS) $(t_tdiv_DEPENDENCIES) @rm -f t-tdiv$(EXEEXT) - $(LINK) $(t_tdiv_OBJECTS) $(t_tdiv_LDADD) $(LIBS) -t-tdiv_ui$(EXEEXT): $(t_tdiv_ui_OBJECTS) $(t_tdiv_ui_DEPENDENCIES) $(EXTRA_t_tdiv_ui_DEPENDENCIES) + $(LINK) $(t_tdiv_LDFLAGS) $(t_tdiv_OBJECTS) $(t_tdiv_LDADD) $(LIBS) +t-tdiv_ui$(EXEEXT): $(t_tdiv_ui_OBJECTS) $(t_tdiv_ui_DEPENDENCIES) @rm -f t-tdiv_ui$(EXEEXT) - $(LINK) $(t_tdiv_ui_OBJECTS) $(t_tdiv_ui_LDADD) $(LIBS) + $(LINK) $(t_tdiv_ui_LDFLAGS) $(t_tdiv_ui_OBJECTS) $(t_tdiv_ui_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c +$(top_builddir)/ansi2knr: + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) ansi2knr + +mostlyclean-kr: + -test "$U" = "" || rm -f *_.c .c.o: $(COMPILE) -c $< @@ -874,6 +795,152 @@ distclean-compile: .c.lo: $(LTCOMPILE) -c -o $@ $< +bit_.c: bit.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/bit.c; then echo $(srcdir)/bit.c; else echo bit.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +convert_.c: convert.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/convert.c; then echo $(srcdir)/convert.c; else echo convert.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +dive_.c: dive.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/dive.c; then echo $(srcdir)/dive.c; else echo dive.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +dive_ui_.c: dive_ui.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/dive_ui.c; then echo $(srcdir)/dive_ui.c; else echo dive_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +io_.c: io.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/io.c; then echo $(srcdir)/io.c; else echo io.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +logic_.c: logic.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/logic.c; then echo $(srcdir)/logic.c; else echo logic.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +reuse_.c: reuse.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/reuse.c; then echo $(srcdir)/reuse.c; else echo reuse.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +t-addsub_.c: t-addsub.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-addsub.c; then echo $(srcdir)/t-addsub.c; else echo t-addsub.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +t-aorsmul_.c: t-aorsmul.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-aorsmul.c; then echo $(srcdir)/t-aorsmul.c; else echo t-aorsmul.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +t-bin_.c: t-bin.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-bin.c; then echo $(srcdir)/t-bin.c; else echo t-bin.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +t-cdiv_ui_.c: t-cdiv_ui.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-cdiv_ui.c; then echo $(srcdir)/t-cdiv_ui.c; else echo t-cdiv_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +t-cmp_.c: t-cmp.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-cmp.c; then echo $(srcdir)/t-cmp.c; else echo t-cmp.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +t-cmp_d_.c: t-cmp_d.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-cmp_d.c; then echo $(srcdir)/t-cmp_d.c; else echo t-cmp_d.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +t-cmp_si_.c: t-cmp_si.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-cmp_si.c; then echo $(srcdir)/t-cmp_si.c; else echo t-cmp_si.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +t-cong_.c: t-cong.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-cong.c; then echo $(srcdir)/t-cong.c; else echo t-cong.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +t-cong_2exp_.c: t-cong_2exp.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-cong_2exp.c; then echo $(srcdir)/t-cong_2exp.c; else echo t-cong_2exp.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +t-div_2exp_.c: t-div_2exp.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-div_2exp.c; then echo $(srcdir)/t-div_2exp.c; else echo t-div_2exp.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +t-divis_.c: t-divis.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-divis.c; then echo $(srcdir)/t-divis.c; else echo t-divis.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +t-divis_2exp_.c: t-divis_2exp.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-divis_2exp.c; then echo $(srcdir)/t-divis_2exp.c; else echo t-divis_2exp.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +t-export_.c: t-export.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-export.c; then echo $(srcdir)/t-export.c; else echo t-export.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +t-fac_ui_.c: t-fac_ui.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-fac_ui.c; then echo $(srcdir)/t-fac_ui.c; else echo t-fac_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +t-fdiv_.c: t-fdiv.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-fdiv.c; then echo $(srcdir)/t-fdiv.c; else echo t-fdiv.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +t-fdiv_ui_.c: t-fdiv_ui.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-fdiv_ui.c; then echo $(srcdir)/t-fdiv_ui.c; else echo t-fdiv_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +t-fib_ui_.c: t-fib_ui.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-fib_ui.c; then echo $(srcdir)/t-fib_ui.c; else echo t-fib_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +t-fits_.c: t-fits.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-fits.c; then echo $(srcdir)/t-fits.c; else echo t-fits.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +t-gcd_.c: t-gcd.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-gcd.c; then echo $(srcdir)/t-gcd.c; else echo t-gcd.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +t-gcd_ui_.c: t-gcd_ui.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-gcd_ui.c; then echo $(srcdir)/t-gcd_ui.c; else echo t-gcd_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +t-get_d_.c: t-get_d.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-get_d.c; then echo $(srcdir)/t-get_d.c; else echo t-get_d.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +t-get_d_2exp_.c: t-get_d_2exp.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-get_d_2exp.c; then echo $(srcdir)/t-get_d_2exp.c; else echo t-get_d_2exp.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +t-get_si_.c: t-get_si.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-get_si.c; then echo $(srcdir)/t-get_si.c; else echo t-get_si.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +t-hamdist_.c: t-hamdist.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-hamdist.c; then echo $(srcdir)/t-hamdist.c; else echo t-hamdist.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +t-import_.c: t-import.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-import.c; then echo $(srcdir)/t-import.c; else echo t-import.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +t-inp_str_.c: t-inp_str.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-inp_str.c; then echo $(srcdir)/t-inp_str.c; else echo t-inp_str.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +t-io_raw_.c: t-io_raw.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-io_raw.c; then echo $(srcdir)/t-io_raw.c; else echo t-io_raw.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +t-jac_.c: t-jac.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-jac.c; then echo $(srcdir)/t-jac.c; else echo t-jac.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +t-lcm_.c: t-lcm.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-lcm.c; then echo $(srcdir)/t-lcm.c; else echo t-lcm.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +t-lucnum_ui_.c: t-lucnum_ui.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-lucnum_ui.c; then echo $(srcdir)/t-lucnum_ui.c; else echo t-lucnum_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +t-mul_.c: t-mul.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-mul.c; then echo $(srcdir)/t-mul.c; else echo t-mul.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +t-mul_i_.c: t-mul_i.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-mul_i.c; then echo $(srcdir)/t-mul_i.c; else echo t-mul_i.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +t-nextprime_.c: t-nextprime.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-nextprime.c; then echo $(srcdir)/t-nextprime.c; else echo t-nextprime.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +t-oddeven_.c: t-oddeven.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-oddeven.c; then echo $(srcdir)/t-oddeven.c; else echo t-oddeven.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +t-perfpow_.c: t-perfpow.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-perfpow.c; then echo $(srcdir)/t-perfpow.c; else echo t-perfpow.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +t-perfsqr_.c: t-perfsqr.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-perfsqr.c; then echo $(srcdir)/t-perfsqr.c; else echo t-perfsqr.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +t-popcount_.c: t-popcount.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-popcount.c; then echo $(srcdir)/t-popcount.c; else echo t-popcount.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +t-pow_.c: t-pow.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-pow.c; then echo $(srcdir)/t-pow.c; else echo t-pow.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +t-powm_.c: t-powm.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-powm.c; then echo $(srcdir)/t-powm.c; else echo t-powm.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +t-powm_ui_.c: t-powm_ui.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-powm_ui.c; then echo $(srcdir)/t-powm_ui.c; else echo t-powm_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +t-pprime_p_.c: t-pprime_p.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-pprime_p.c; then echo $(srcdir)/t-pprime_p.c; else echo t-pprime_p.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +t-root_.c: t-root.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-root.c; then echo $(srcdir)/t-root.c; else echo t-root.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +t-scan_.c: t-scan.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-scan.c; then echo $(srcdir)/t-scan.c; else echo t-scan.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +t-set_d_.c: t-set_d.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-set_d.c; then echo $(srcdir)/t-set_d.c; else echo t-set_d.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +t-set_f_.c: t-set_f.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-set_f.c; then echo $(srcdir)/t-set_f.c; else echo t-set_f.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +t-set_si_.c: t-set_si.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-set_si.c; then echo $(srcdir)/t-set_si.c; else echo t-set_si.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +t-set_str_.c: t-set_str.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-set_str.c; then echo $(srcdir)/t-set_str.c; else echo t-set_str.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +t-sizeinbase_.c: t-sizeinbase.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-sizeinbase.c; then echo $(srcdir)/t-sizeinbase.c; else echo t-sizeinbase.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +t-sqrtrem_.c: t-sqrtrem.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-sqrtrem.c; then echo $(srcdir)/t-sqrtrem.c; else echo t-sqrtrem.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +t-tdiv_.c: t-tdiv.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-tdiv.c; then echo $(srcdir)/t-tdiv.c; else echo t-tdiv.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +t-tdiv_ui_.c: t-tdiv_ui.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-tdiv_ui.c; then echo $(srcdir)/t-tdiv_ui.c; else echo t-tdiv_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +bit_.$(OBJEXT) bit_.lo convert_.$(OBJEXT) convert_.lo dive_.$(OBJEXT) \ +dive_.lo dive_ui_.$(OBJEXT) dive_ui_.lo io_.$(OBJEXT) io_.lo \ +logic_.$(OBJEXT) logic_.lo reuse_.$(OBJEXT) reuse_.lo \ +t-addsub_.$(OBJEXT) t-addsub_.lo t-aorsmul_.$(OBJEXT) t-aorsmul_.lo \ +t-bin_.$(OBJEXT) t-bin_.lo t-cdiv_ui_.$(OBJEXT) t-cdiv_ui_.lo \ +t-cmp_.$(OBJEXT) t-cmp_.lo t-cmp_d_.$(OBJEXT) t-cmp_d_.lo \ +t-cmp_si_.$(OBJEXT) t-cmp_si_.lo t-cong_.$(OBJEXT) t-cong_.lo \ +t-cong_2exp_.$(OBJEXT) t-cong_2exp_.lo t-div_2exp_.$(OBJEXT) \ +t-div_2exp_.lo t-divis_.$(OBJEXT) t-divis_.lo t-divis_2exp_.$(OBJEXT) \ +t-divis_2exp_.lo t-export_.$(OBJEXT) t-export_.lo t-fac_ui_.$(OBJEXT) \ +t-fac_ui_.lo t-fdiv_.$(OBJEXT) t-fdiv_.lo t-fdiv_ui_.$(OBJEXT) \ +t-fdiv_ui_.lo t-fib_ui_.$(OBJEXT) t-fib_ui_.lo t-fits_.$(OBJEXT) \ +t-fits_.lo t-gcd_.$(OBJEXT) t-gcd_.lo t-gcd_ui_.$(OBJEXT) t-gcd_ui_.lo \ +t-get_d_.$(OBJEXT) t-get_d_.lo t-get_d_2exp_.$(OBJEXT) \ +t-get_d_2exp_.lo t-get_si_.$(OBJEXT) t-get_si_.lo t-hamdist_.$(OBJEXT) \ +t-hamdist_.lo t-import_.$(OBJEXT) t-import_.lo t-inp_str_.$(OBJEXT) \ +t-inp_str_.lo t-io_raw_.$(OBJEXT) t-io_raw_.lo t-jac_.$(OBJEXT) \ +t-jac_.lo t-lcm_.$(OBJEXT) t-lcm_.lo t-lucnum_ui_.$(OBJEXT) \ +t-lucnum_ui_.lo t-mul_.$(OBJEXT) t-mul_.lo t-mul_i_.$(OBJEXT) \ +t-mul_i_.lo t-nextprime_.$(OBJEXT) t-nextprime_.lo \ +t-oddeven_.$(OBJEXT) t-oddeven_.lo t-perfpow_.$(OBJEXT) t-perfpow_.lo \ +t-perfsqr_.$(OBJEXT) t-perfsqr_.lo t-popcount_.$(OBJEXT) \ +t-popcount_.lo t-pow_.$(OBJEXT) t-pow_.lo t-powm_.$(OBJEXT) t-powm_.lo \ +t-powm_ui_.$(OBJEXT) t-powm_ui_.lo t-pprime_p_.$(OBJEXT) \ +t-pprime_p_.lo t-root_.$(OBJEXT) t-root_.lo t-scan_.$(OBJEXT) \ +t-scan_.lo t-set_d_.$(OBJEXT) t-set_d_.lo t-set_f_.$(OBJEXT) \ +t-set_f_.lo t-set_si_.$(OBJEXT) t-set_si_.lo t-set_str_.$(OBJEXT) \ +t-set_str_.lo t-sizeinbase_.$(OBJEXT) t-sizeinbase_.lo \ +t-sqrtrem_.$(OBJEXT) t-sqrtrem_.lo t-tdiv_.$(OBJEXT) t-tdiv_.lo \ +t-tdiv_ui_.$(OBJEXT) t-tdiv_ui_.lo : $(ANSI2KNR) mostlyclean-libtool: -rm -f *.lo @@ -881,54 +948,54 @@ mostlyclean-libtool: clean-libtool: -rm -rf .libs _libs +distclean-libtool: + -rm -f libtool +uninstall-info-am: + ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) - set x; \ + tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - shift; \ - if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - if test $$# -gt 0; then \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - "$$@" $$unique; \ - else \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$unique; \ - fi; \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -z "$$unique" && unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - test -z "$(CTAGS_ARGS)$$unique" \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$unique + $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ - && $(am__cd) $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) "$$here" + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags @@ -936,8 +1003,7 @@ distclean-tags: check-TESTS: $(TESTS) @failed=0; all=0; xfail=0; xpass=0; skip=0; \ srcdir=$(srcdir); export srcdir; \ - list=' $(TESTS) '; \ - $(am__tty_colors); \ + list='$(TESTS)'; \ if test -n "$$list"; then \ for tst in $$list; do \ if test -f ./$$tst; then dir=./; \ @@ -946,113 +1012,91 @@ check-TESTS: $(TESTS) if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ all=`expr $$all + 1`; \ case " $(XFAIL_TESTS) " in \ - *[\ \ ]$$tst[\ \ ]*) \ + *" $$tst "*) \ xpass=`expr $$xpass + 1`; \ failed=`expr $$failed + 1`; \ - col=$$red; res=XPASS; \ + echo "XPASS: $$tst"; \ ;; \ *) \ - col=$$grn; res=PASS; \ + echo "PASS: $$tst"; \ ;; \ esac; \ elif test $$? -ne 77; then \ all=`expr $$all + 1`; \ case " $(XFAIL_TESTS) " in \ - *[\ \ ]$$tst[\ \ ]*) \ + *" $$tst "*) \ xfail=`expr $$xfail + 1`; \ - col=$$lgn; res=XFAIL; \ + echo "XFAIL: $$tst"; \ ;; \ *) \ failed=`expr $$failed + 1`; \ - col=$$red; res=FAIL; \ + echo "FAIL: $$tst"; \ ;; \ esac; \ else \ skip=`expr $$skip + 1`; \ - col=$$blu; res=SKIP; \ + echo "SKIP: $$tst"; \ fi; \ - echo "$${col}$$res$${std}: $$tst"; \ done; \ - if test "$$all" -eq 1; then \ - tests="test"; \ - All=""; \ - else \ - tests="tests"; \ - All="All "; \ - fi; \ if test "$$failed" -eq 0; then \ if test "$$xfail" -eq 0; then \ - banner="$$All$$all $$tests passed"; \ + banner="All $$all tests passed"; \ else \ - if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \ - banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \ + banner="All $$all tests behaved as expected ($$xfail expected failures)"; \ fi; \ else \ if test "$$xpass" -eq 0; then \ - banner="$$failed of $$all $$tests failed"; \ + banner="$$failed of $$all tests failed"; \ else \ - if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \ - banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \ + banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \ fi; \ fi; \ dashes="$$banner"; \ skipped=""; \ if test "$$skip" -ne 0; then \ - if test "$$skip" -eq 1; then \ - skipped="($$skip test was not run)"; \ - else \ - skipped="($$skip tests were not run)"; \ - fi; \ - test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ + skipped="($$skip tests were not run)"; \ + test `echo "$$skipped" | wc -c` -gt `echo "$$banner" | wc -c` && \ dashes="$$skipped"; \ fi; \ report=""; \ if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ report="Please report to $(PACKAGE_BUGREPORT)"; \ - test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ + test `echo "$$report" | wc -c` -gt `echo "$$banner" | wc -c` && \ dashes="$$report"; \ fi; \ dashes=`echo "$$dashes" | sed s/./=/g`; \ - if test "$$failed" -eq 0; then \ - col="$$grn"; \ - else \ - col="$$red"; \ - fi; \ - echo "$${col}$$dashes$${std}"; \ - echo "$${col}$$banner$${std}"; \ - test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \ - test -z "$$report" || echo "$${col}$$report$${std}"; \ - echo "$${col}$$dashes$${std}"; \ + echo "$$dashes"; \ + echo "$$banner"; \ + test -n "$$skipped" && echo "$$skipped"; \ + test -n "$$report" && echo "$$report"; \ + echo "$$dashes"; \ test "$$failed" -eq 0; \ else :; fi distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done @@ -1072,23 +1116,17 @@ install-am: all-am installcheck: installcheck-am install-strip: - if test -z '$(STRIP)'; then \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - install; \ - else \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ - fi + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + -rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @@ -1101,7 +1139,7 @@ clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags + distclean-libtool distclean-tags dvi: dvi-am @@ -1109,38 +1147,18 @@ dvi-am: html: html-am -html-am: - info: info-am info-am: install-data-am: -install-dvi: install-dvi-am - -install-dvi-am: - install-exec-am: -install-html: install-html-am - -install-html-am: - install-info: install-info-am -install-info-am: - install-man: -install-pdf: install-pdf-am - -install-pdf-am: - -install-ps: install-ps-am - -install-ps-am: - installcheck-am: maintainer-clean: maintainer-clean-am @@ -1149,7 +1167,7 @@ maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ +mostlyclean-am: mostlyclean-compile mostlyclean-generic mostlyclean-kr \ mostlyclean-libtool pdf: pdf-am @@ -1160,28 +1178,23 @@ ps: ps-am ps-am: -uninstall-am: - -.MAKE: check-am install-am install-strip +uninstall-am: uninstall-info-am .PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \ clean-checkPROGRAMS clean-generic clean-libtool ctags \ distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ - install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-man install-pdf install-pdf-am \ - install-ps install-ps-am install-strip installcheck \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-man install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags uninstall uninstall-am + mostlyclean-generic mostlyclean-kr mostlyclean-libtool pdf \ + pdf-am ps ps-am tags uninstall uninstall-am uninstall-info-am $(top_builddir)/tests/libtests.la: cd $(top_builddir)/tests; $(MAKE) $(AM_MAKEFLAGS) libtests.la - # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/gmp/tests/mpz/bit.c b/gmp/tests/mpz/bit.c index c42e9f0cc5..9eddbb4889 100644 --- a/gmp/tests/mpz/bit.c +++ b/gmp/tests/mpz/bit.c @@ -1,21 +1,21 @@ /* Test mpz_setbit, mpz_clrbit, mpz_tstbit. -Copyright 1997, 2000-2003, 2012, 2013 Free Software Foundation, Inc. +Copyright 1997, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. -This file is part of the GNU MP Library test suite. +This file is part of the GNU MP Library. -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU 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 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 test suite 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 General -Public License for more details. +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 General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ +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> @@ -38,7 +38,6 @@ debug_mp (mpz_srcptr x, int base) /* exercise the case where mpz_clrbit or mpz_combit ends up extending a value like -2^(k*GMP_NUMB_BITS-1) when clearing bit k*GMP_NUMB_BITS-1. */ -/* And vice-versa. */ void check_clr_extend (void) { @@ -54,7 +53,7 @@ check_clr_extend (void) for (f = 0; f <= 1; f++) { /* lots of 1 bits in _mp_d */ - mpz_set_si (got, 1L); + mpz_set_ui (got, 1L); mpz_mul_2exp (got, got, 10*GMP_NUMB_BITS); mpz_sub_ui (got, got, 1L); @@ -83,28 +82,6 @@ check_clr_extend (void) mpz_trace ("want", want); abort (); } - - /* complement bit n, going back to ..11100..00 which is -2^(n-1) */ - if (f == 0) - mpz_setbit (got, i*GMP_NUMB_BITS-1); - else - mpz_combit (got, i*GMP_NUMB_BITS-1); - MPZ_CHECK_FORMAT (got); - - mpz_set_si (want, -1L); - mpz_mul_2exp (want, want, i*GMP_NUMB_BITS - 1); - - if (mpz_cmp (got, want) != 0) - { - if (f == 0) - printf ("mpz_setbit: "); - else - printf ("mpz_combit: "); - printf ("wrong after shrinking\n"); - mpz_trace ("got ", got); - mpz_trace ("want", want); - abort (); - } } } @@ -188,7 +165,7 @@ check_tstbit (void) if (low1) pos[0] |= 1; - refmpn_neg (neg, pos, (mp_size_t) numberof(neg)); + refmpn_neg_n (neg, pos, (mp_size_t) numberof(neg)); mpz_set_n (z, neg, (mp_size_t) numberof(neg)); mpz_neg (z, z); @@ -226,11 +203,11 @@ check_single (void) { for (offset = (limb==0 ? 0 : -2); offset <= 2; offset++) { - for (initial = 1; initial >= -1; initial--) + for (initial = 0; initial >= -1; initial--) { mpz_set_si (x, (long) initial); - bit = (unsigned long) limb*GMP_LIMB_BITS + offset; + bit = (unsigned long) limb*BITS_PER_MP_LIMB + offset; mpz_clrbit (x, bit); MPZ_CHECK_FORMAT (x); @@ -318,7 +295,7 @@ check_random (int argc, char *argv[]) mpz_set (s2, x); bit2 = mpz_tstbit (x, bitindex); - mpz_combit (x, bitindex); + mpz_setbit (x, bitindex); MPZ_CHECK_FORMAT (x); mpz_set (s3, x); @@ -346,26 +323,16 @@ check_random (int argc, char *argv[]) if (mpz_cmp (s2, s3) == 0) abort (); - mpz_combit (x, bitindex); - MPZ_CHECK_FORMAT (x); - if (mpz_cmp (s2, x) != 0) - abort (); - - mpz_clrbit (x, bitindex); - MPZ_CHECK_FORMAT (x); - if (mpz_cmp (s2, x) != 0) - abort (); - mpz_ui_pow_ui (m, 2L, bitindex); MPZ_CHECK_FORMAT (m); - mpz_ior (x, s0, m); + mpz_ior (x, s2, m); MPZ_CHECK_FORMAT (x); if (mpz_cmp (x, s3) != 0) abort (); mpz_com (m, m); MPZ_CHECK_FORMAT (m); - mpz_and (x, s0, m); + mpz_and (x, s1, m); MPZ_CHECK_FORMAT (x); if (mpz_cmp (x, s2) != 0) abort (); diff --git a/gmp/tests/mpz/convert.c b/gmp/tests/mpz/convert.c index ada6d11a16..bfe8b70b30 100644 --- a/gmp/tests/mpz/convert.c +++ b/gmp/tests/mpz/convert.c @@ -1,22 +1,22 @@ /* Test conversion using mpz_get_str and mpz_set_str. -Copyright 1993, 1994, 1996, 1999-2002, 2006, 2007 Free Software Foundation, -Inc. +Copyright 1993, 1994, 1996, 1999, 2000, 2001, 2002, 2006, 2007 Free Software +Foundation, Inc. -This file is part of the GNU MP Library test suite. +This file is part of the GNU MP Library. -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU 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 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 test suite 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 General -Public License for more details. +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 General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ +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> @@ -26,7 +26,7 @@ the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ #include "gmp-impl.h" #include "tests.h" -void debug_mp (mpz_t, int); +void debug_mp __GMP_PROTO ((mpz_t, int)); void @@ -35,7 +35,7 @@ string_urandomb (char *bp, size_t len, int base, gmp_randstate_ptr rands) mpz_t bs; unsigned long bsi; int d, l; - const char *collseq = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; + char *collseq = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; mpz_init (bs); @@ -78,12 +78,13 @@ main (int argc, char **argv) size_t len; tests_start (); - TESTS_REPS (reps, argv, argc); - rands = RANDS; mpz_init (bs); + if (argc == 2) + reps = atoi (argv[1]); + mpz_init (op1); mpz_init (op2); @@ -92,8 +93,8 @@ main (int argc, char **argv) /* 1. Generate random mpz_t and convert to a string and back to mpz_t again. */ mpz_urandomb (bs, rands, 32); - size_range = mpz_get_ui (bs) % 17 + 2; /* 2..18 */ - mpz_urandomb (bs, rands, size_range); /* 3..262144 bits */ + size_range = mpz_get_ui (bs) % 15 + 2; /* 2..16 */ + mpz_urandomb (bs, rands, size_range); /* 3..65536 bits */ size = mpz_get_ui (bs); mpz_rrandomb (op1, rands, size); @@ -126,10 +127,10 @@ main (int argc, char **argv) /* 2. Generate random string and convert to mpz_t and back to a string again. */ mpz_urandomb (bs, rands, 32); - size_range = mpz_get_ui (bs) % 16 + 1; /* 1..16 */ - mpz_urandomb (bs, rands, size_range); /* 1..65536 digits */ + size_range = mpz_get_ui (bs) % 14 + 1; /* 1..14 */ + mpz_urandomb (bs, rands, size_range); /* 1..16384 digits */ len = mpz_get_ui (bs) + 1; - buf = (char *) (*__gmp_allocate_func) (len + 1); + buf = (*__gmp_allocate_func) (len + 1); if (base == 0) base = 10; string_urandomb (buf, len, base, rands); diff --git a/gmp/tests/mpz/dive.c b/gmp/tests/mpz/dive.c index 7970e718a0..7b0651e63c 100644 --- a/gmp/tests/mpz/dive.c +++ b/gmp/tests/mpz/dive.c @@ -2,20 +2,20 @@ Copyright 1996, 2001, 2002 Free Software Foundation, Inc. -This file is part of the GNU MP Library test suite. +This file is part of the GNU MP Library. -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU 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 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 test suite 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 General -Public License for more details. +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 General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ +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> @@ -31,20 +31,21 @@ main (int argc, char **argv) mpz_t prod, quot; mp_size_t size; int i; - int reps = 5000; + int reps = 200000; gmp_randstate_ptr rands; mpz_t bs; unsigned long bsi, size_range; tests_start (); - TESTS_REPS (reps, argv, argc); - rands = RANDS; mp_trace_base = -16; mpz_init (bs); + if (argc == 2) + reps = atoi (argv[1]); + mpz_init (op1); mpz_init (op2); mpz_init (prod); @@ -53,7 +54,7 @@ main (int argc, char **argv) for (i = 0; i < reps; i++) { mpz_urandomb (bs, rands, 32); - size_range = mpz_get_ui (bs) % 17 + 2; /* 0..2047 bit operands */ + size_range = mpz_get_ui (bs) % 10 + 2; /* 0..2047 bit operands */ mpz_urandomb (bs, rands, size_range); size = mpz_get_ui (bs); diff --git a/gmp/tests/mpz/dive_ui.c b/gmp/tests/mpz/dive_ui.c index 6771677f1f..93f7a9b6e3 100644 --- a/gmp/tests/mpz/dive_ui.c +++ b/gmp/tests/mpz/dive_ui.c @@ -2,20 +2,20 @@ Copyright 1996, 2001 Free Software Foundation, Inc. -This file is part of the GNU MP Library test suite. +This file is part of the GNU MP Library. -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU 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 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 test suite 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 General -Public License for more details. +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 General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ +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> diff --git a/gmp/tests/mpz/io.c b/gmp/tests/mpz/io.c index 7674d69b1c..d6bbbbabe6 100644 --- a/gmp/tests/mpz/io.c +++ b/gmp/tests/mpz/io.c @@ -1,21 +1,21 @@ /* Test conversion and I/O using mpz_out_str and mpz_inp_str. -Copyright 1993, 1994, 1996, 2000, 2001, 2012 Free Software Foundation, Inc. +Copyright 1993, 1994, 1996, 2000, 2001 Free Software Foundation, Inc. -This file is part of the GNU MP Library test suite. +This file is part of the GNU MP Library. -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU 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 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 test suite 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 General -Public License for more details. +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 General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ +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 "config.h" @@ -45,7 +45,7 @@ main (int argc, char **argv) int i; int reps = 10000; FILE *fp; - int base, base_out; + int base; gmp_randstate_ptr rands; mpz_t bs; unsigned long bsi, size_range; @@ -79,17 +79,12 @@ main (int argc, char **argv) mpz_urandomb (bs, rands, 16); bsi = mpz_get_ui (bs); - base = bsi % 62 + 1; + base = bsi % 36 + 1; if (base == 1) base = 0; - if (i % 2 == 0 && base <= 36) - base_out = -base; - else - base_out = base; - rewind (fp); - if (mpz_out_str (fp, base_out, op1) == 0 + if (mpz_out_str (fp, base, op1) == 0 || putc (' ', fp) == EOF || fflush (fp) != 0) { diff --git a/gmp/tests/mpz/logic.c b/gmp/tests/mpz/logic.c index d99cadc2bd..e5d3930235 100644 --- a/gmp/tests/mpz/logic.c +++ b/gmp/tests/mpz/logic.c @@ -1,21 +1,21 @@ /* Test mpz_com, mpz_and, mpz_ior, and mpz_xor. -Copyright 1993, 1994, 1996, 1997, 2001, 2013 Free Software Foundation, Inc. +Copyright 1993, 1994, 1996, 1997, 2001 Free Software Foundation, Inc. -This file is part of the GNU MP Library test suite. +This file is part of the GNU MP Library. -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU 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 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 test suite 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 General -Public License for more details. +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 General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ +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> @@ -24,8 +24,8 @@ the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ #include "gmp-impl.h" #include "tests.h" -void dump_abort (void); -void debug_mp (mpz_t, int); +void dump_abort __GMP_PROTO (()); +void debug_mp __GMP_PROTO ((mpz_t, int)); int main (int argc, char **argv) @@ -55,45 +55,6 @@ main (int argc, char **argv) mpz_init (t2); mpz_init (t3); - mpz_set_si (x, -1); - mpz_set_ui (y, 0); - for (i = 0; i < 300; i++) - { - mpz_mul_2exp (x, x, 1); - - mpz_and (r1, x, x); - MPZ_CHECK_FORMAT (r1); - if (mpz_cmp (r1, x) != 0) - dump_abort (); - - mpz_ior (r2, x, x); - MPZ_CHECK_FORMAT (r2); - if (mpz_cmp (r2, x) != 0) - dump_abort (); - - mpz_xor (t1, x, x); - MPZ_CHECK_FORMAT (t1); - if (mpz_cmp_si (t1, 0) != 0) - dump_abort (); - - mpz_ior (t1, x, y); - MPZ_CHECK_FORMAT (t1); - if (mpz_cmp (t1, x) != 0) - dump_abort (); - - mpz_xor (t2, x, y); - MPZ_CHECK_FORMAT (t2); - if (mpz_cmp (t2, x) != 0) - dump_abort (); - - mpz_com (t2, x); - MPZ_CHECK_FORMAT (t2); - mpz_xor (t3, t2, x); - MPZ_CHECK_FORMAT (t3); - if (mpz_cmp_si (t3, -1) != 0) - dump_abort (); - } - for (i = 0; i < reps; i++) { mpz_urandomb (bs, rands, 32); diff --git a/gmp/tests/mpz/reuse.c b/gmp/tests/mpz/reuse.c index 4b67fbe38b..257e9abfaa 100644 --- a/gmp/tests/mpz/reuse.c +++ b/gmp/tests/mpz/reuse.c @@ -6,27 +6,26 @@ mpz_mul_si mpz_addmul_ui (should this really allow a+=a*c?) -Copyright 1996, 1999-2002, 2009, 2012, 2013 Free Software Foundation, Inc. +Copyright 1996, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. -This file is part of the GNU MP Library test suite. +This file is part of the GNU MP Library. -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU 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 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 test suite 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 General -Public License for more details. +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 General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ +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 <string.h> -#include <unistd.h> #include "gmp.h" #include "gmp-impl.h" @@ -49,14 +48,14 @@ main (void) #else /* ! DLL_EXPORT */ -void dump (const char *, mpz_t, mpz_t, mpz_t); +void dump __GMP_PROTO ((char *, mpz_t, mpz_t, mpz_t)); -typedef void (*dss_func) (mpz_ptr, mpz_srcptr, mpz_srcptr); -typedef void (*dsi_func) (mpz_ptr, mpz_srcptr, unsigned long int); -typedef unsigned long int (*dsi_div_func) (mpz_ptr, mpz_srcptr, unsigned long int); -typedef unsigned long int (*ddsi_div_func) (mpz_ptr, mpz_ptr, mpz_srcptr, unsigned long int); -typedef void (*ddss_div_func) (mpz_ptr, mpz_ptr, mpz_srcptr, mpz_srcptr); -typedef void (*ds_func) (mpz_ptr, mpz_srcptr); +typedef void (*dss_func) __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr)); +typedef void (*dsi_func) __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int)); +typedef unsigned long int (*dsi_div_func) __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int)); +typedef unsigned long int (*ddsi_div_func) __GMP_PROTO ((mpz_ptr, mpz_ptr, mpz_srcptr, unsigned long int)); +typedef void (*ddss_div_func) __GMP_PROTO ((mpz_ptr, mpz_ptr, mpz_srcptr, mpz_srcptr)); +typedef void (*ds_func) __GMP_PROTO ((mpz_ptr, mpz_srcptr)); void @@ -68,140 +67,124 @@ mpz_xinvert (mpz_ptr r, mpz_srcptr a, mpz_srcptr b) mpz_set_ui (r, 0); } -struct { - dss_func fptr; - const char *fname; - int isdivision; - int isslow; -} dss[] = - { { mpz_add, "mpz_add", 0, 0 }, - { mpz_sub, "mpz_sub", 0, 0 }, - { mpz_mul, "mpz_mul", 0, 0 }, - { mpz_cdiv_q, "mpz_cdiv_q", 1, 0 }, - { mpz_cdiv_r, "mpz_cdiv_r", 1, 0 }, - { mpz_fdiv_q, "mpz_fdiv_q", 1, 0 }, - { mpz_fdiv_r, "mpz_fdiv_r", 1, 0 }, - { mpz_tdiv_q, "mpz_tdiv_q", 1, 0 }, - { mpz_tdiv_r, "mpz_tdiv_r", 1, 0 }, - { mpz_mod, "mpz_mod", 1, 0 }, - { mpz_xinvert, "mpz_xinvert", 1, 1 }, - { mpz_gcd, "mpz_gcd", 0, 1 }, - { mpz_lcm, "mpz_lcm", 0, 1 }, - { mpz_and, "mpz_and", 0, 0 }, - { mpz_ior, "mpz_ior", 0, 0 }, - { mpz_xor, "mpz_xor", 0, 0 } - }; - - -struct { - dsi_func fptr; - const char *fname; - int mod; -} dsi[] = +dss_func dss_funcs[] = { - /* Don't change order here without changing the code in main(). */ - { mpz_add_ui, "mpz_add_ui", 0 }, - { mpz_mul_ui, "mpz_mul_ui", 0 }, - { mpz_sub_ui, "mpz_sub_ui", 0 }, - { mpz_fdiv_q_2exp, "mpz_fdiv_q_2exp", 0x1000 }, - { mpz_fdiv_r_2exp, "mpz_fdiv_r_2exp", 0x1000 }, - { mpz_cdiv_q_2exp, "mpz_cdiv_q_2exp", 0x1000 }, - { mpz_cdiv_r_2exp, "mpz_cdiv_r_2exp", 0x1000 }, - { mpz_tdiv_q_2exp, "mpz_tdiv_q_2exp", 0x1000 }, - { mpz_tdiv_r_2exp, "mpz_tdiv_r_2exp", 0x1000 }, - { mpz_mul_2exp, "mpz_mul_2exp", 0x100 }, - { mpz_pow_ui, "mpz_pow_ui", 0x10 } + mpz_add, mpz_sub, mpz_mul, + mpz_cdiv_q, mpz_cdiv_r, mpz_fdiv_q, mpz_fdiv_r, mpz_tdiv_q, mpz_tdiv_r, + mpz_xinvert, + mpz_gcd, mpz_lcm, mpz_and, mpz_ior, mpz_xor }; - -struct { - dsi_div_func fptr; - const char *fname; -} dsi_div[] = +char *dss_func_names[] = { - { mpz_cdiv_q_ui, "mpz_cdiv_q_ui" }, - { mpz_cdiv_r_ui, "mpz_cdiv_r_ui" }, - { mpz_fdiv_q_ui, "mpz_fdiv_q_ui" }, - { mpz_fdiv_r_ui, "mpz_fdiv_r_ui" }, - { mpz_tdiv_q_ui, "mpz_tdiv_q_ui" }, - { mpz_tdiv_r_ui, "mpz_tdiv_r_ui" } + "mpz_add", "mpz_sub", "mpz_mul", + "mpz_cdiv_q", "mpz_cdiv_r", "mpz_fdiv_q", "mpz_fdiv_r", "mpz_tdiv_q", "mpz_tdiv_r", + "mpz_xinvert", + "mpz_gcd", "mpz_lcm", "mpz_and", "mpz_ior", "mpz_xor" }; +char dss_func_division[] = {0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0}; -struct { - ddsi_div_func fptr; - const char *fname; - int isslow; -} ddsi_div[] = +dsi_func dsi_funcs[] = { - { mpz_cdiv_qr_ui, "mpz_cdiv_qr_ui", 0 }, - { mpz_fdiv_qr_ui, "mpz_fdiv_qr_ui", 0 }, - { mpz_tdiv_qr_ui, "mpz_tdiv_qr_ui", 0 }, + /* Don't change order here without changing the code in main(). */ + mpz_add_ui, mpz_mul_ui, mpz_sub_ui, + mpz_fdiv_q_2exp, mpz_fdiv_r_2exp, + mpz_cdiv_q_2exp, mpz_cdiv_r_2exp, + mpz_tdiv_q_2exp, mpz_tdiv_r_2exp, + mpz_mul_2exp, + mpz_pow_ui +}; +char *dsi_func_names[] = +{ + "mpz_add_ui", "mpz_mul_ui", "mpz_sub_ui", + "mpz_fdiv_q_2exp", "mpz_fdiv_r_2exp", + "mpz_cdiv_q_2exp", "mpz_cdiv_r_2exp", + "mpz_tdiv_q_2exp", "mpz_tdiv_r_2exp", + "mpz_mul_2exp", + "mpz_pow_ui" }; - -struct { - ddss_div_func fptr; - const char *fname; - int isslow; -} ddss_div[] = +dsi_div_func dsi_div_funcs[] = { - { mpz_cdiv_qr, "mpz_cdiv_qr", 0 }, - { mpz_fdiv_qr, "mpz_fdiv_qr", 0 }, - { mpz_tdiv_qr, "mpz_tdiv_qr", 0 }, + mpz_cdiv_q_ui, mpz_cdiv_r_ui, + mpz_fdiv_q_ui, mpz_fdiv_r_ui, + mpz_tdiv_q_ui, mpz_tdiv_r_ui +}; +char *dsi_div_func_names[] = +{ + "mpz_cdiv_q_ui", "mpz_cdiv_r_ui", + "mpz_fdiv_q_ui", "mpz_fdiv_r_ui", + "mpz_tdiv_q_ui", "mpz_tdiv_r_ui" }; -struct { - ds_func fptr; - const char *fname; - int nonneg; -} ds[] = +ddsi_div_func ddsi_div_funcs[] = +{ + mpz_cdiv_qr_ui, + mpz_fdiv_qr_ui, + mpz_tdiv_qr_ui +}; +char *ddsi_div_func_names[] = { - { mpz_abs, "mpz_abs", 0 }, - { mpz_com, "mpz_com", 0 }, - { mpz_neg, "mpz_neg", 0 }, - { mpz_sqrt, "mpz_sqrt", 1 }, + "mpz_cdiv_qr_ui", + "mpz_fdiv_qr_ui", + "mpz_tdiv_qr_ui" }; -#define FAIL(class,indx,op1,op2,op3) \ - do { \ - dump (class[indx].fname, op1, op2, op3); \ - exit (1); \ - } while (0) +ddss_div_func ddss_div_funcs[] = +{ + mpz_cdiv_qr, + mpz_fdiv_qr, + mpz_tdiv_qr +}; +char *ddss_div_func_names[] = +{ + "mpz_cdiv_qr", + "mpz_fdiv_qr", + "mpz_tdiv_qr" +}; -#define FAIL2(fname,op1,op2,op3) \ - do { \ - dump (#fname, op1, op2, op3); \ - exit (1); \ - } while (0) +ds_func ds_funcs[] = +{ + mpz_abs, mpz_com, mpz_neg, mpz_sqrt +}; +char *ds_func_names[] = +{ + "mpz_abs", "mpz_com", "mpz_neg", "mpz_sqrt" +}; -#define INVOKE_RRS(desc,r1,r2,i1) \ +/* Really use `defined (__STDC__)' here; we want it to be true for Sun C */ +#if defined (__STDC__) || defined (__cplusplus) +#define FAIL(class,indx,op1,op2,op3) \ do { \ - if (pass & 1) _mpz_realloc (r1, ABSIZ(r1)); \ - if (pass & 2) _mpz_realloc (r2, ABSIZ(r2)); \ - (desc).fptr (r1, r2, i1); \ + class##_funcs[indx] = 0; \ + dump (class##_func_names[indx], op1, op2, op3); \ + failures++; \ } while (0) -#define INVOKE_RS(desc,r1,i1) \ +#define FAIL2(fname,op1,op2,op3) \ do { \ - if (pass & 1) _mpz_realloc (r1, ABSIZ(r1)); \ - (desc).fptr (r1, i1); \ + dump (#fname, op1, op2, op3); \ + failures++; \ } while (0) -#define INVOKE_RRSS(desc,r1,r2,i1,i2) \ +#else +#define FAIL(class,indx,op1,op2,op3) \ do { \ - if (pass & 1) _mpz_realloc (r1, ABSIZ(r1)); \ - if (pass & 2) _mpz_realloc (r2, ABSIZ(r2)); \ - (desc).fptr (r1, r2, i1, i2); \ + class/**/_funcs[indx] = 0; \ + dump (class/**/_func_names[indx], op1, op2, op3); \ + failures++; \ } while (0) -#define INVOKE_RSS(desc,r1,i1,i2) \ +#define FAIL2(fname,op1,op2,op3) \ do { \ - if (pass & 1) _mpz_realloc (r1, ABSIZ(r1)); \ - (desc).fptr (r1, i1, i2); \ + dump ("fname", op1, op2, op3); \ + failures++; \ } while (0) +#endif + int main (int argc, char **argv) { int i; - int pass, reps = 400; + int pass, reps = 1000; mpz_t in1, in2, in3; unsigned long int in2i; mp_size_t size; @@ -209,17 +192,19 @@ main (int argc, char **argv) mpz_t ref1, ref2, ref3; mpz_t t; unsigned long int r1, r2; + long failures = 0; gmp_randstate_ptr rands; mpz_t bs; unsigned long bsi, size_range; tests_start (); - TESTS_REPS (reps, argv, argc); - rands = RANDS; mpz_init (bs); + if (argc == 2) + reps = atoi (argv[1]); + mpz_init (in1); mpz_init (in2); mpz_init (in3); @@ -233,126 +218,106 @@ main (int argc, char **argv) for (pass = 1; pass <= reps; pass++) { - if (isatty (fileno (stdout))) - { - printf ("\r%d/%d passes", pass, reps); - fflush (stdout); - } - mpz_urandomb (bs, rands, 32); - size_range = mpz_get_ui (bs) % 21 + 2; + size_range = mpz_get_ui (bs) % 12 + 2; - if ((pass & 1) == 0) - { - /* Make all input operands have quite different sizes */ - mpz_urandomb (bs, rands, 32); - size = mpz_get_ui (bs) % size_range; - mpz_rrandomb (in1, rands, size); - - mpz_urandomb (bs, rands, 32); - size = mpz_get_ui (bs) % size_range; - mpz_rrandomb (in2, rands, size); - - mpz_urandomb (bs, rands, 32); - size = mpz_get_ui (bs) % size_range; - mpz_rrandomb (in3, rands, size); - } - else - { - /* Make all input operands have about the same size */ - mpz_urandomb (bs, rands, size_range); - size = mpz_get_ui (bs); - mpz_rrandomb (in1, rands, size); - - mpz_urandomb (bs, rands, size_range); - size = mpz_get_ui (bs); - mpz_rrandomb (in2, rands, size); - - mpz_urandomb (bs, rands, size_range); - size = mpz_get_ui (bs); - mpz_rrandomb (in3, rands, size); - } + mpz_urandomb (bs, rands, size_range); + size = mpz_get_ui (bs); + mpz_rrandomb (in1, rands, size); + + mpz_urandomb (bs, rands, size_range); + size = mpz_get_ui (bs); + mpz_rrandomb (in2, rands, size); + + mpz_urandomb (bs, rands, size_range); + size = mpz_get_ui (bs); + mpz_rrandomb (in3, rands, size); mpz_urandomb (bs, rands, 3); bsi = mpz_get_ui (bs); if ((bsi & 1) != 0) mpz_neg (in1, in1); - if ((bsi & 2) != 0) + if ((bsi & 1) != 0) mpz_neg (in2, in2); - if ((bsi & 4) != 0) + if ((bsi & 1) != 0) mpz_neg (in3, in3); - for (i = 0; i < numberof (dss); i++) + for (i = 0; i < sizeof (dss_funcs) / sizeof (dss_func); i++) { - if (dss[i].isdivision && mpz_sgn (in2) == 0) + if (dss_funcs[i] == 0) continue; - if (dss[i].isslow && size_range > 19) + if (dss_func_division[i] && mpz_sgn (in2) == 0) continue; - (dss[i].fptr) (ref1, in1, in2); + (dss_funcs[i]) (ref1, in1, in2); MPZ_CHECK_FORMAT (ref1); mpz_set (res1, in1); - INVOKE_RSS (dss[i], res1, res1, in2); + (dss_funcs[i]) (res1, res1, in2); MPZ_CHECK_FORMAT (res1); if (mpz_cmp (ref1, res1) != 0) FAIL (dss, i, in1, in2, NULL); mpz_set (res1, in2); - INVOKE_RSS (dss[i], res1, in1, res1); + (dss_funcs[i]) (res1, in1, res1); MPZ_CHECK_FORMAT (res1); if (mpz_cmp (ref1, res1) != 0) FAIL (dss, i, in1, in2, NULL); } - for (i = 0; i < numberof (ddss_div); i++) + for (i = 0; i < sizeof (ddss_div_funcs) / sizeof (ddss_div_func); i++) { + if (ddss_div_funcs[i] == 0) + continue; if (mpz_sgn (in2) == 0) continue; - (ddss_div[i].fptr) (ref1, ref2, in1, in2); + (ddss_div_funcs[i]) (ref1, ref2, in1, in2); MPZ_CHECK_FORMAT (ref1); MPZ_CHECK_FORMAT (ref2); mpz_set (res1, in1); - INVOKE_RRSS (ddss_div[i], res1, res2, res1, in2); + (ddss_div_funcs[i]) (res1, res2, res1, in2); MPZ_CHECK_FORMAT (res1); MPZ_CHECK_FORMAT (res2); if (mpz_cmp (ref1, res1) != 0 || mpz_cmp (ref2, res2) != 0) FAIL (ddss_div, i, in1, in2, NULL); mpz_set (res2, in1); - INVOKE_RRSS (ddss_div[i], res1, res2, res2, in2); + (ddss_div_funcs[i]) (res1, res2, res2, in2); MPZ_CHECK_FORMAT (res1); MPZ_CHECK_FORMAT (res2); if (mpz_cmp (ref1, res1) != 0 || mpz_cmp (ref2, res2) != 0) FAIL (ddss_div, i, in1, in2, NULL); mpz_set (res1, in2); - INVOKE_RRSS (ddss_div[i], res1, res2, in1, res1); + (ddss_div_funcs[i]) (res1, res2, in1, res1); MPZ_CHECK_FORMAT (res1); MPZ_CHECK_FORMAT (res2); if (mpz_cmp (ref1, res1) != 0 || mpz_cmp (ref2, res2) != 0) FAIL (ddss_div, i, in1, in2, NULL); mpz_set (res2, in2); - INVOKE_RRSS (ddss_div[i], res1, res2, in1, res2); + (ddss_div_funcs[i]) (res1, res2, in1, res2); MPZ_CHECK_FORMAT (res1); MPZ_CHECK_FORMAT (res2); if (mpz_cmp (ref1, res1) != 0 || mpz_cmp (ref2, res2) != 0) FAIL (ddss_div, i, in1, in2, NULL); } - for (i = 0; i < numberof (ds); i++) + for (i = 0; i < sizeof (ds_funcs) / sizeof (ds_func); i++) { - if (ds[i].nonneg && mpz_sgn (in1) < 0) + if (ds_funcs[i] == 0) + continue; + if (strcmp (ds_func_names[i], "mpz_sqrt") == 0 + && mpz_sgn (in1) < 0) continue; - (ds[i].fptr) (ref1, in1); + (ds_funcs[i]) (ref1, in1); MPZ_CHECK_FORMAT (ref1); mpz_set (res1, in1); - INVOKE_RS (ds[i], res1, res1); + (ds_funcs[i]) (res1, res1); MPZ_CHECK_FORMAT (res1); if (mpz_cmp (ref1, res1) != 0) FAIL (ds, i, in1, in2, NULL); @@ -360,16 +325,27 @@ main (int argc, char **argv) in2i = mpz_get_ui (in2); - for (i = 0; i < numberof (dsi); i++) + for (i = 0; i < sizeof (dsi_funcs) / sizeof (dsi_func); i++) { - if (dsi[i].mod != 0) - in2i = mpz_get_ui (in2) % dsi[i].mod; - - (dsi[i].fptr) (ref1, in1, in2i); + if (dsi_funcs[i] == 0) + continue; + if (strcmp (dsi_func_names[i], "mpz_fdiv_q_2exp") == 0) + /* Limit exponent to something reasonable for the division + functions. Without this, we'd normally shift things off + the end and just generate the trivial values 1, 0, -1. */ + in2i %= 0x1000; + if (strcmp (dsi_func_names[i], "mpz_mul_2exp") == 0) + /* Limit exponent more for mpz_mul_2exp to save time. */ + in2i %= 0x100; + if (strcmp (dsi_func_names[i], "mpz_pow_ui") == 0) + /* Limit exponent yet more for mpz_pow_ui to save time. */ + in2i %= 0x10; + + (dsi_funcs[i]) (ref1, in1, in2i); MPZ_CHECK_FORMAT (ref1); mpz_set (res1, in1); - INVOKE_RRS (dsi[i], res1, res1, in2i); + (dsi_funcs[i]) (res1, res1, in2i); MPZ_CHECK_FORMAT (res1); if (mpz_cmp (ref1, res1) != 0) FAIL (dsi, i, in1, in2, NULL); @@ -377,31 +353,31 @@ main (int argc, char **argv) if (in2i != 0) /* Don't divide by 0. */ { - for (i = 0; i < numberof (dsi_div); i++) + for (i = 0; i < sizeof (dsi_div_funcs) / sizeof (dsi_div_funcs); i++) { - r1 = (dsi_div[i].fptr) (ref1, in1, in2i); + r1 = (dsi_div_funcs[i]) (ref1, in1, in2i); MPZ_CHECK_FORMAT (ref1); mpz_set (res1, in1); - r2 = (dsi_div[i].fptr) (res1, res1, in2i); + r2 = (dsi_div_funcs[i]) (res1, res1, in2i); MPZ_CHECK_FORMAT (res1); if (mpz_cmp (ref1, res1) != 0 || r1 != r2) FAIL (dsi_div, i, in1, in2, NULL); } - for (i = 0; i < numberof (ddsi_div); i++) + for (i = 0; i < sizeof (ddsi_div_funcs) / sizeof (ddsi_div_funcs); i++) { - r1 = (ddsi_div[i].fptr) (ref1, ref2, in1, in2i); + r1 = (ddsi_div_funcs[i]) (ref1, ref2, in1, in2i); MPZ_CHECK_FORMAT (ref1); mpz_set (res1, in1); - r2 = (ddsi_div[i].fptr) (res1, res2, res1, in2i); + r2 = (ddsi_div_funcs[i]) (res1, res2, res1, in2i); MPZ_CHECK_FORMAT (res1); if (mpz_cmp (ref1, res1) != 0 || mpz_cmp (ref2, res2) != 0 || r1 != r2) FAIL (ddsi_div, i, in1, in2, NULL); mpz_set (res2, in1); - (ddsi_div[i].fptr) (res1, res2, res2, in2i); + (ddsi_div_funcs[i]) (res1, res2, res2, in2i); MPZ_CHECK_FORMAT (res1); if (mpz_cmp (ref1, res1) != 0 || mpz_cmp (ref2, res2) != 0 || r1 != r2) FAIL (ddsi_div, i, in1, in2, NULL); @@ -427,21 +403,15 @@ main (int argc, char **argv) MPZ_CHECK_FORMAT (res2); if (mpz_cmp (ref1, res1) != 0 || mpz_cmp (ref2, res2) != 0) FAIL2 (mpz_sqrtrem, in1, NULL, NULL); - - mpz_set (res1, in1); - mpz_sqrtrem (res1, res1, res1); - MPZ_CHECK_FORMAT (res1); - if (mpz_cmp (ref2, res1) != 0) - FAIL2 (mpz_sqrtrem, in1, NULL, NULL); } if (mpz_sgn (in1) >= 0) { - mpz_root (ref1, in1, in2i % 0x100 + 1); + mpz_root (ref1, in1, in2i % 0x1000 + 1); MPZ_CHECK_FORMAT (ref1); mpz_set (res1, in1); - mpz_root (res1, res1, in2i % 0x100 + 1); + mpz_root (res1, res1, in2i % 0x1000 + 1); MPZ_CHECK_FORMAT (res1); if (mpz_cmp (ref1, res1) != 0) FAIL2 (mpz_root, in1, in2, NULL); @@ -449,26 +419,26 @@ main (int argc, char **argv) if (mpz_sgn (in1) >= 0) { - mpz_rootrem (ref1, ref2, in1, in2i % 0x100 + 1); + mpz_rootrem (ref1, ref2, in1, in2i % 0x1000 + 1); MPZ_CHECK_FORMAT (ref1); MPZ_CHECK_FORMAT (ref2); mpz_set (res1, in1); - mpz_rootrem (res1, res2, res1, in2i % 0x100 + 1); + mpz_rootrem (res1, res2, res1, in2i % 0x1000 + 1); MPZ_CHECK_FORMAT (res1); MPZ_CHECK_FORMAT (res2); if (mpz_cmp (ref1, res1) != 0 || mpz_cmp (ref2, res2) != 0) FAIL2 (mpz_rootrem, in1, in2, NULL); mpz_set (res2, in1); - mpz_rootrem (res1, res2, res2, in2i % 0x100 + 1); + mpz_rootrem (res1, res2, res2, in2i % 0x1000 + 1); MPZ_CHECK_FORMAT (res1); MPZ_CHECK_FORMAT (res2); if (mpz_cmp (ref1, res1) != 0 || mpz_cmp (ref2, res2) != 0) FAIL2 (mpz_rootrem, in1, in2, NULL); } - if (size_range < 18) /* run fewer tests since gcdext is slow */ + if (pass < reps / 2) /* run fewer tests since gcdext lots of time */ { mpz_gcdext (ref1, ref2, ref3, in1, in2); MPZ_CHECK_FORMAT (ref1); @@ -563,7 +533,7 @@ main (int argc, char **argv) } /* Don't run mpz_powm for huge exponents or when undefined. */ - if (size_range < 17 && mpz_sizeinbase (in2, 2) < 250 && mpz_sgn (in3) != 0 + if (mpz_sizeinbase (in2, 2) < 250 && mpz_sgn (in3) != 0 && (mpz_sgn (in2) >= 0 || mpz_invert (t, in1, in3))) { mpz_powm (ref1, in1, in2, in3); @@ -589,7 +559,7 @@ main (int argc, char **argv) } /* Don't run mpz_powm_ui when undefined. */ - if (size_range < 17 && mpz_sgn (in3) != 0) + if (mpz_sgn (in3) != 0) { mpz_powm_ui (ref1, in1, in2i, in3); MPZ_CHECK_FORMAT (ref1); @@ -618,23 +588,22 @@ main (int argc, char **argv) FAIL2 (mpz_gcd_ui, in1, in2, NULL); } - if (mpz_sgn (in2) != 0) + if (mpz_cmp_ui (in2, 1L) > 0 && mpz_sgn (in1) != 0) { /* Test mpz_remove */ - mp_bitcnt_t refretval, retval; - refretval = mpz_remove (ref1, in1, in2); + mpz_remove (ref1, in1, in2); MPZ_CHECK_FORMAT (ref1); mpz_set (res1, in1); - retval = mpz_remove (res1, res1, in2); + mpz_remove (res1, res1, in2); MPZ_CHECK_FORMAT (res1); - if (mpz_cmp (ref1, res1) != 0 || refretval != retval) + if (mpz_cmp (ref1, res1) != 0) FAIL2 (mpz_remove, in1, in2, NULL); mpz_set (res1, in2); - retval = mpz_remove (res1, in1, res1); + mpz_remove (res1, in1, res1); MPZ_CHECK_FORMAT (res1); - if (mpz_cmp (ref1, res1) != 0 || refretval != retval) + if (mpz_cmp (ref1, res1) != 0) FAIL2 (mpz_remove, in1, in2, NULL); } @@ -679,8 +648,11 @@ main (int argc, char **argv) } } - if (isatty (fileno (stdout))) - printf ("\r%20s", ""); + if (failures != 0) + { + fprintf (stderr, "mpz/reuse: %ld error%s\n", failures, "s" + (failures == 1)); + exit (1); + } mpz_clear (bs); mpz_clear (in1); @@ -694,27 +666,24 @@ main (int argc, char **argv) mpz_clear (res3); mpz_clear (t); - if (isatty (fileno (stdout))) - printf ("\r"); - tests_end (); exit (0); } void -dump (const char *name, mpz_t in1, mpz_t in2, mpz_t in3) +dump (char *name, mpz_t in1, mpz_t in2, mpz_t in3) { printf ("failure in %s (", name); - 0 && mpz_out_str (stdout, -16, in1); + mpz_out_str (stdout, -16, in1); if (in2 != NULL) { printf (" "); - 0 && mpz_out_str (stdout, -16, in2); + mpz_out_str (stdout, -16, in2); } if (in3 != NULL) { printf (" "); - 0 && mpz_out_str (stdout, -16, in3); + mpz_out_str (stdout, -16, in3); } printf (")\n"); } diff --git a/gmp/tests/mpz/t-addsub.c b/gmp/tests/mpz/t-addsub.c index bf89841150..815a839731 100644 --- a/gmp/tests/mpz/t-addsub.c +++ b/gmp/tests/mpz/t-addsub.c @@ -2,20 +2,20 @@ Copyright 2002 Free Software Foundation, Inc. -This file is part of the GNU MP Library test suite. +This file is part of the GNU MP Library. -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU 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 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 test suite 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 General -Public License for more details. +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 General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ +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> @@ -25,8 +25,8 @@ the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ #include "longlong.h" #include "tests.h" -void debug_mp (mpz_t, int); -void dump_abort (int, const char *, mpz_t, mpz_t); +void debug_mp __GMP_PROTO ((mpz_t, int)); +void dump_abort __GMP_PROTO ((int, char *, mpz_t, mpz_t)); int main (int argc, char **argv) @@ -107,7 +107,7 @@ main (int argc, char **argv) } void -dump_abort (int i, const char *s, mpz_t op1, mpz_t op2) +dump_abort (int i, char *s, mpz_t op1, mpz_t op2) { fprintf (stderr, "ERROR: %s in test %d\n", s, i); fprintf (stderr, "op1 = "); debug_mp (op1, -16); diff --git a/gmp/tests/mpz/t-aorsmul.c b/gmp/tests/mpz/t-aorsmul.c index 918725fdcb..36b7933cad 100644 --- a/gmp/tests/mpz/t-aorsmul.c +++ b/gmp/tests/mpz/t-aorsmul.c @@ -2,20 +2,20 @@ Copyright 2001, 2002 Free Software Foundation, Inc. -This file is part of the GNU MP Library test suite. +This file is part of the GNU MP Library. -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU 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 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 test suite 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 General -Public License for more details. +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 General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ +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> @@ -388,14 +388,14 @@ check_random (int argc, char *argv[]) for (i = 0; i < reps; i++) { - mpz_errandomb (w, rands, 5*GMP_LIMB_BITS); - mpz_errandomb (x, rands, 5*GMP_LIMB_BITS); - mpz_errandomb (y, rands, 5*GMP_LIMB_BITS); + mpz_errandomb (w, rands, 5*BITS_PER_MP_LIMB); + mpz_errandomb (x, rands, 5*BITS_PER_MP_LIMB); + mpz_errandomb (y, rands, 5*BITS_PER_MP_LIMB); check_all (w, x, y); check_all_inplace (w, y); - mpz_errandomb (w, rands, 5*GMP_LIMB_BITS); - mpz_errandomb (x, rands, 5*GMP_LIMB_BITS); + mpz_errandomb (w, rands, 5*BITS_PER_MP_LIMB); + mpz_errandomb (x, rands, 5*BITS_PER_MP_LIMB); mpz_errandomb (y, rands, BITS_PER_ULONG); check_all (w, x, y); check_all_inplace (w, y); diff --git a/gmp/tests/mpz/t-bin.c b/gmp/tests/mpz/t-bin.c index acce41df9a..6e9a34b803 100644 --- a/gmp/tests/mpz/t-bin.c +++ b/gmp/tests/mpz/t-bin.c @@ -1,21 +1,21 @@ /* Exercise mpz_bin_ui and mpz_bin_uiui. -Copyright 2000, 2001, 2010, 2012 Free Software Foundation, Inc. +Copyright 2000, 2001 Free Software Foundation, Inc. -This file is part of the GNU MP Library test suite. +This file is part of the GNU MP Library. -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU 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 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 test suite 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 General -Public License for more details. +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 General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ +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> @@ -23,8 +23,6 @@ the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ #include "gmp-impl.h" #include "tests.h" -/* Default number of generated tests. */ -#define COUNT 700 void try_mpz_bin_ui (mpz_srcptr want, mpz_srcptr n, unsigned long k) @@ -77,11 +75,58 @@ samples (void) const char *want; } data[] = { + { "0", 0, "1" }, + { "0", 1, "0" }, + { "0", 2, "0" }, + { "0", 3, "0" }, + { "0", 4, "0" }, { "0", 123456, "0" }, - { "1", 543210, "0" }, - { "2", 123321, "0" }, - { "3", 234567, "0" }, - { "10", 23456, "0" }, + + { "1", 0, "1" }, + { "1", 1, "1" }, + { "1", 2, "0" }, + { "1", 3, "0" }, + { "1", 4, "0" }, + { "1", 123456, "0" }, + + { "2", 0, "1" }, + { "2", 1, "2" }, + { "2", 2, "1" }, + { "2", 3, "0" }, + { "2", 4, "0" }, + { "2", 123456, "0" }, + + { "3", 0, "1" }, + { "3", 1, "3" }, + { "3", 2, "3" }, + { "3", 3, "1" }, + { "3", 4, "0" }, + { "3", 5, "0" }, + { "3", 123456, "0" }, + + { "4", 0, "1" }, + { "4", 1, "4" }, + { "4", 2, "6" }, + { "4", 3, "4" }, + { "4", 4, "1" }, + { "4", 5, "0" }, + { "4", 6, "0" }, + { "4", 123456, "0" }, + + { "10", 0, "1" }, + { "10", 1, "10" }, + { "10", 2, "45" }, + { "10", 3, "120" }, + { "10", 4, "210" }, + { "10", 5, "252" }, + { "10", 6, "210" }, + { "10", 7, "120" }, + { "10", 8, "45" }, + { "10", 9, "10" }, + { "10", 10, "1" }, + { "10", 11, "0" }, + { "10", 12, "0" }, + { "10", 123456, "0" }, /* negatives, using bin(-n,k)=bin(n+k-1,k) */ { "-1", 0, "1" }, @@ -106,11 +151,8 @@ samples (void) { "-3", 5, "-21" }, { "-3", 6, "28" }, - /* A few random values */ - { "41", 20, "269128937220" }, - { "62", 37, "147405545359541742" }, - { "50", 18, "18053528883775" }, - { "149", 21, "19332950844468483467894649" }, + { "40", 20, "137846528820" }, + { "60", 30, "118264581564861424" }, }; mpz_t n, want; @@ -138,7 +180,7 @@ samples (void) /* Test some bin(2k,k) cases. This produces some biggish numbers to exercise the limb accumulating code. */ void -twos (int count) +twos (void) { mpz_t n, want; unsigned long k; @@ -147,7 +189,7 @@ twos (int count) mpz_init (want); mpz_set_ui (want, (unsigned long) 2); - for (k = 1; k < count; k++) + for (k = 1; k < 200; k++) { mpz_set_ui (n, 2*k); try_mpz_bin_ui (want, n, k); @@ -162,104 +204,14 @@ twos (int count) mpz_clear (want); } -/* Test some random bin(n,k) cases. This produces some biggish - numbers to exercise the limb accumulating code. */ -void -randomwalk (int count) -{ - mpz_t n_z, want; - unsigned long n, k, i, r; - int tests; - gmp_randstate_ptr rands; - - rands = RANDS; - mpz_init (n_z); - mpz_init (want); - - k = 3; - n = 12; - mpz_set_ui (want, (unsigned long) 220); /* binomial(12,3) = 220 */ - - for (tests = 1; tests < count; tests++) - { - r = gmp_urandomm_ui (rands, 62) + 1; - for (i = r & 7; i > 0; i--) - { - n++; k++; - mpz_mul_ui (want, want, n); - mpz_fdiv_q_ui (want, want, k); - } - for (i = r >> 3; i > 0; i--) - { - n++; - mpz_mul_ui (want, want, n); - mpz_fdiv_q_ui (want, want, n - k); - } - - mpz_set_ui (n_z, n); - try_mpz_bin_ui (want, n_z, k); - - try_mpz_bin_uiui (want, n, k); - } - - mpz_clear (n_z); - mpz_clear (want); -} - - -/* Test all bin(n,k) cases, with 0 <= k <= n + 1 <= count. */ -void -smallexaustive (unsigned int count) -{ - mpz_t n_z, want; - unsigned long n, k; - - mpz_init (n_z); - mpz_init (want); - - for (n = 0; n < count; n++) - { - mpz_set_ui (want, (unsigned long) 1); - mpz_set_ui (n_z, n); - for (k = 0; k <= n; k++) - { - try_mpz_bin_ui (want, n_z, k); - try_mpz_bin_uiui (want, n, k); - mpz_mul_ui (want, want, n - k); - mpz_fdiv_q_ui (want, want, k + 1); - } - try_mpz_bin_ui (want, n_z, k); - try_mpz_bin_uiui (want, n, k); - } - - mpz_clear (n_z); - mpz_clear (want); -} int -main (int argc, char **argv) +main (void) { - int count; - - if (argc > 1) - { - char *end; - count = strtol (argv[1], &end, 0); - if (*end || count <= 0) - { - fprintf (stderr, "Invalid test count: %s.\n", argv[1]); - return 1; - } - } - else - count = COUNT; - tests_start (); samples (); - smallexaustive (count >> 4); - twos (count >> 1); - randomwalk (count - (count >> 1)); + twos (); tests_end (); exit (0); diff --git a/gmp/tests/mpz/t-cdiv_ui.c b/gmp/tests/mpz/t-cdiv_ui.c index 39735a92e9..1f6be7fe7a 100644 --- a/gmp/tests/mpz/t-cdiv_ui.c +++ b/gmp/tests/mpz/t-cdiv_ui.c @@ -1,22 +1,22 @@ /* Test mpz_abs, mpz_add, mpz_cmp, mpz_cmp_ui, mpz_cdiv_qr_ui, mpz_cdiv_q_ui, mpz_cdiv_r_ui, , mpz_cdiv_ui, mpz_mul_ui. -Copyright 1993, 1994, 1996, 2000-2002 Free Software Foundation, Inc. +Copyright 1993, 1994, 1996, 2000, 2001, 2002 Free Software Foundation, Inc. -This file is part of the GNU MP Library test suite. +This file is part of the GNU MP Library. -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU 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 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 test suite 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 General -Public License for more details. +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 General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ +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> @@ -25,8 +25,8 @@ the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ #include "gmp-impl.h" #include "tests.h" -void dump_abort (const char *, mpz_t, unsigned long); -void debug_mp (mpz_t, int); +void dump_abort __GMP_PROTO ((char *, mpz_t, unsigned long)); +void debug_mp __GMP_PROTO ((mpz_t, int)); int main (int argc, char **argv) @@ -144,7 +144,7 @@ main (int argc, char **argv) } void -dump_abort (const char *str, mpz_t dividend, unsigned long divisor) +dump_abort (char *str, mpz_t dividend, unsigned long divisor) { fprintf (stderr, "ERROR: %s\n", str); fprintf (stderr, "dividend = "); debug_mp (dividend, -16); diff --git a/gmp/tests/mpz/t-cmp.c b/gmp/tests/mpz/t-cmp.c index cf0474e7f1..40c54a1ff9 100644 --- a/gmp/tests/mpz/t-cmp.c +++ b/gmp/tests/mpz/t-cmp.c @@ -2,20 +2,20 @@ Copyright 2001 Free Software Foundation, Inc. -This file is part of the GNU MP Library test suite. +This file is part of the GNU MP Library. -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU 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 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 test suite 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 General -Public License for more details. +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 General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ +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> diff --git a/gmp/tests/mpz/t-cmp_d.c b/gmp/tests/mpz/t-cmp_d.c index c9877fc521..9cefd20c14 100644 --- a/gmp/tests/mpz/t-cmp_d.c +++ b/gmp/tests/mpz/t-cmp_d.c @@ -1,21 +1,21 @@ /* Test mpz_cmp_d and mpz_cmpabs_d. -Copyright 2001-2003, 2005 Free Software Foundation, Inc. +Copyright 2001, 2002, 2003, 2005 Free Software Foundation, Inc. -This file is part of the GNU MP Library test suite. +This file is part of the GNU MP Library. -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU 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 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 test suite 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 General -Public License for more details. +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 General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ +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> @@ -84,14 +84,11 @@ check_data (void) { "1", 0.0, 1, 1 }, { "-1", 0.0, -1, 1 }, - { "1", 0.5, 1, 1 }, - { "-1", -0.5, -1, 1 }, - { "0", 1.0, -1, -1 }, { "0", -1.0, 1, -1 }, - { "0x1000000000000000000000000000000000000000000000000", 1.0, 1, 1 }, - { "-0x1000000000000000000000000000000000000000000000000", 1.0, -1, 1 }, + { "0x1000000000000000000000000000000000000000000000000", 0.0, 1, 1 }, + { "-0x1000000000000000000000000000000000000000000000000", 0.0, -1, 1 }, { "0", 1e100, -1, -1 }, { "0", -1e100, 1, -1 }, @@ -164,7 +161,7 @@ check_low_z_one (void) mpz_init (x); /* FIXME: It'd be better to base this on the float format. */ -#if defined (__vax) || defined (__vax__) +#ifdef __vax #define LIM 127 /* vax fp numbers have limited range */ #else #define LIM 512 diff --git a/gmp/tests/mpz/t-cmp_si.c b/gmp/tests/mpz/t-cmp_si.c index 97fdbcaae3..25e8a3b381 100644 --- a/gmp/tests/mpz/t-cmp_si.c +++ b/gmp/tests/mpz/t-cmp_si.c @@ -2,20 +2,20 @@ Copyright 2000, 2001 Free Software Foundation, Inc. -This file is part of the GNU MP Library test suite. +This file is part of the GNU MP Library. -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU 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 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 test suite 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 General -Public License for more details. +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 General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ +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> diff --git a/gmp/tests/mpz/t-cong.c b/gmp/tests/mpz/t-cong.c index 1227335ec5..5ef444ca8e 100644 --- a/gmp/tests/mpz/t-cong.c +++ b/gmp/tests/mpz/t-cong.c @@ -1,21 +1,21 @@ /* test mpz_congruent_p and mpz_congruent_ui_p -Copyright 2001, 2002, 2012 Free Software Foundation, Inc. +Copyright 2001, 2002 Free Software Foundation, Inc. -This file is part of the GNU MP Library test suite. +This file is part of the GNU MP Library. -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU 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 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 test suite 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 General -Public License for more details. +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 General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ +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> @@ -34,38 +34,38 @@ check_one (mpz_srcptr a, mpz_srcptr c, mpz_srcptr d, int want) { got = (mpz_congruent_p (a, c, d) != 0); if (want != got) - { - printf ("mpz_congruent_p wrong\n"); - printf (" expected %d got %d\n", want, got); - mpz_trace (" a", a); - mpz_trace (" c", c); - mpz_trace (" d", d); - mp_trace_base = -16; - mpz_trace (" a", a); - mpz_trace (" c", c); - mpz_trace (" d", d); - abort (); - } + { + printf ("mpz_congruent_p wrong\n"); + printf (" expected %d got %d\n", want, got); + mpz_trace (" a", a); + mpz_trace (" c", c); + mpz_trace (" d", d); + mp_trace_base = -16; + mpz_trace (" a", a); + mpz_trace (" c", c); + mpz_trace (" d", d); + abort (); + } if (mpz_fits_ulong_p (c) && mpz_fits_ulong_p (d)) - { - unsigned long uc = mpz_get_ui (c); - unsigned long ud = mpz_get_ui (d); - got = (mpz_congruent_ui_p (a, uc, ud) != 0); - if (want != got) - { - printf ("mpz_congruent_ui_p wrong\n"); - printf (" expected %d got %d\n", want, got); - mpz_trace (" a", a); - printf (" c=%lu\n", uc); - printf (" d=%lu\n", ud); - mp_trace_base = -16; - mpz_trace (" a", a); - printf (" c=0x%lX\n", uc); - printf (" d=0x%lX\n", ud); - abort (); - } - } + { + unsigned long uc = mpz_get_ui (c); + unsigned long ud = mpz_get_ui (d); + got = (mpz_congruent_ui_p (a, uc, ud) != 0); + if (want != got) + { + printf ("mpz_congruent_ui_p wrong\n"); + printf (" expected %d got %d\n", want, got); + mpz_trace (" a", a); + printf (" c=%lu\n", uc); + printf (" d=%lu\n", ud); + mp_trace_base = -16; + mpz_trace (" a", a); + printf (" c=0x%lX\n", uc); + printf (" d=0x%lX\n", ud); + abort (); + } + } MPZ_SRCPTR_SWAP (a, c); } @@ -83,11 +83,6 @@ check_data (void) } data[] = { - /* strict equality mod 0 */ - { "0", "0", "0", 1 }, - { "11", "11", "0", 1 }, - { "3", "11", "0", 0 }, - /* anything congruent mod 1 */ { "0", "0", "1", 1 }, { "1", "0", "1", 1 }, @@ -138,15 +133,11 @@ check_random (int argc, char *argv[]) mpz_t a, c, d, ra, rc; int i; int want; - int reps = 10000; - mpz_t bs; - unsigned long size_range, size; + int reps = 50000; if (argc >= 2) reps = atoi (argv[1]); - mpz_init (bs); - mpz_init (a); mpz_init (c); mpz_init (d); @@ -155,30 +146,11 @@ check_random (int argc, char *argv[]) for (i = 0; i < reps; i++) { - mpz_urandomb (bs, rands, 32); - size_range = mpz_get_ui (bs) % 16 + 1; /* 0..65536 bit operands */ - - mpz_urandomb (bs, rands, size_range); - size = mpz_get_ui (bs); - mpz_rrandomb (a, rands, size); - - mpz_urandomb (bs, rands, 32); - size_range = mpz_get_ui (bs) % 16 + 1; /* 0..65536 bit operands */ - - mpz_urandomb (bs, rands, size_range); - size = mpz_get_ui (bs); - mpz_rrandomb (c, rands, size); - - do - { - mpz_urandomb (bs, rands, 32); - size_range = mpz_get_ui (bs) % 16 + 1; /* 0..65536 bit operands */ - - mpz_urandomb (bs, rands, size_range); - size = mpz_get_ui (bs); - mpz_rrandomb (d, rands, size); - } - while (SIZ(d) == 0); + mpz_errandomb (a, rands, 8*BITS_PER_MP_LIMB); + MPZ_CHECK_FORMAT (a); + mpz_errandomb (c, rands, 8*BITS_PER_MP_LIMB); + MPZ_CHECK_FORMAT (c); + mpz_errandomb_nonzero (d, rands, 8*BITS_PER_MP_LIMB); mpz_negrandom (a, rands); MPZ_CHECK_FORMAT (a); @@ -199,13 +171,11 @@ check_random (int argc, char *argv[]) if (! mpz_pow2abs_p (d)) { - refmpz_combit (a, urandom() % (8*GMP_LIMB_BITS)); - check_one (a, c, d, 0); + refmpz_combit (a, urandom() % (8*BITS_PER_MP_LIMB)); + check_one (a, c, d, 0); } } - mpz_clear (bs); - mpz_clear (a); mpz_clear (c); mpz_clear (d); diff --git a/gmp/tests/mpz/t-cong_2exp.c b/gmp/tests/mpz/t-cong_2exp.c index 3ccb5aab04..478f782317 100644 --- a/gmp/tests/mpz/t-cong_2exp.c +++ b/gmp/tests/mpz/t-cong_2exp.c @@ -1,22 +1,22 @@ /* test mpz_congruent_2exp_p */ /* -Copyright 2001, 2013 Free Software Foundation, Inc. +Copyright 2001 Free Software Foundation, Inc. -This file is part of the GNU MP Library test suite. +This file is part of the GNU MP Library. -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU 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 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 test suite 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 General -Public License for more details. +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 General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ +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> @@ -81,10 +81,8 @@ check_data (void) { "0", "0", 0, 1 }, { "1", "0", 0, 1 }, { "0", "1", 0, 1 }, - { "123", "-456", 0, 1 }, + { "123", "456", 0, 1 }, { "0x123456789123456789", "0x987654321987654321", 0, 1 }, - { "0xfffffffffffffffffffffffffffffff7", "-0x9", 129, 0 }, - { "0xfffffffffffffffffffffffffffffff6", "-0xa", 128, 1 }, }; @@ -107,12 +105,17 @@ check_data (void) void -check_random (int reps) +check_random (int argc, char *argv[]) { gmp_randstate_ptr rands = RANDS; unsigned long d; mpz_t a, c, ra, rc; int i; + int want; + int reps = 5000; + + if (argc >= 2) + reps = atoi (argv[1]); mpz_init (a); mpz_init (c); @@ -121,12 +124,12 @@ check_random (int reps) for (i = 0; i < reps; i++) { - mpz_errandomb (a, rands, 8*GMP_LIMB_BITS); - mpz_errandomb (c, rands, 8*GMP_LIMB_BITS); - d = urandom() % (8*GMP_LIMB_BITS); + mpz_errandomb (a, rands, 8*BITS_PER_MP_LIMB); + mpz_errandomb (c, rands, 8*BITS_PER_MP_LIMB); + d = urandom() % (8*BITS_PER_MP_LIMB); - mpz_mul_2exp (a, a, urandom() % (2*GMP_LIMB_BITS)); - mpz_mul_2exp (c, c, urandom() % (2*GMP_LIMB_BITS)); + mpz_mul_2exp (a, a, urandom() % (2*BITS_PER_MP_LIMB)); + mpz_mul_2exp (c, c, urandom() % (2*BITS_PER_MP_LIMB)); mpz_negrandom (a, rands); mpz_negrandom (c, rands); @@ -134,18 +137,12 @@ check_random (int reps) mpz_fdiv_r_2exp (ra, a, d); mpz_fdiv_r_2exp (rc, c, d); + want = (mpz_cmp (ra, rc) == 0); + check_one (a, c, d, want); + mpz_sub (ra, ra, rc); - if (mpz_cmp_ui (ra, 0) != 0) - { - check_one (a, c, d, 0); - mpz_sub (a, a, ra); - } + mpz_sub (a, a, ra); check_one (a, c, d, 1); - if (d != 0) - { - mpz_combit (a, urandom() % d); - check_one (a, c, d, 0); - } } mpz_clear (a); @@ -154,55 +151,14 @@ check_random (int reps) mpz_clear (rc); } -void -check_random_bits (int reps) -{ - gmp_randstate_ptr rands = RANDS; - mp_bitcnt_t ea, ec, en, d; - mp_bitcnt_t m = 10 * GMP_LIMB_BITS; - mpz_t a, c; - int i; - - mpz_init2 (a, m + 1); - mpz_init2 (c, m); - - for (i = 0; i < reps; i++) - { - d = urandom() % m; - ea = urandom() % m; - ec = urandom() % m; - en = urandom() % m; - - mpz_set_ui (c, 0); - mpz_setbit (c, en); - - mpz_set_ui (a, 0); - mpz_setbit (a, ec); - mpz_sub (c , a, c); - - mpz_set_ui (a, 0); - mpz_setbit (a, ea); - mpz_add (a , a, c); - - check_one (a, c, d, ea >= d); - } - - mpz_clear (a); - mpz_clear (c); -} - int main (int argc, char *argv[]) { - int reps = 5000; - tests_start (); - TESTS_REPS (reps, argv, argc); check_data (); - check_random (reps); - check_random_bits (reps); + check_random (argc, argv); tests_end (); exit (0); diff --git a/gmp/tests/mpz/t-div_2exp.c b/gmp/tests/mpz/t-div_2exp.c index 1620698b12..934ef18e47 100644 --- a/gmp/tests/mpz/t-div_2exp.c +++ b/gmp/tests/mpz/t-div_2exp.c @@ -2,20 +2,20 @@ Copyright 2001 Free Software Foundation, Inc. -This file is part of the GNU MP Library test suite. +This file is part of the GNU MP Library. -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU 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 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 test suite 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 General -Public License for more details. +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 General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ +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> diff --git a/gmp/tests/mpz/t-divis.c b/gmp/tests/mpz/t-divis.c index fdfedc82b3..b5f3750063 100644 --- a/gmp/tests/mpz/t-divis.c +++ b/gmp/tests/mpz/t-divis.c @@ -1,21 +1,22 @@ -/* test mpz_divisible_p and mpz_divisible_ui_p +/* test mpz_divisible_p and mpz_divisible_ui_p */ -Copyright 2001, 2009 Free Software Foundation, Inc. +/* +Copyright 2001 Free Software Foundation, Inc. -This file is part of the GNU MP Library test suite. +This file is part of the GNU MP Library. -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU 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 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 test suite 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 General -Public License for more details. +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 General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ +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> @@ -71,8 +72,6 @@ check_data (void) } data[] = { - { "0", "0", 1 }, - { "17", "0", 0 }, { "0", "1", 1 }, { "123", "1", 1 }, { "-123", "1", 1 }, @@ -126,8 +125,8 @@ check_random (int reps) for (i = 0; i < reps; i++) { - mpz_erandomb (a, rands, 1 << 19); - mpz_erandomb_nonzero (d, rands, 1 << 18); + mpz_erandomb (a, rands, 512); + mpz_erandomb_nonzero (d, rands, 512); mpz_fdiv_r (r, a, d); @@ -153,7 +152,7 @@ check_random (int reps) int main (int argc, char *argv[]) { - int reps = 100; + int reps = 1000; tests_start (); diff --git a/gmp/tests/mpz/t-divis_2exp.c b/gmp/tests/mpz/t-divis_2exp.c index ecd7440eae..88588a3d7e 100644 --- a/gmp/tests/mpz/t-divis_2exp.c +++ b/gmp/tests/mpz/t-divis_2exp.c @@ -3,20 +3,20 @@ /* Copyright 2001 Free Software Foundation, Inc. -This file is part of the GNU MP Library test suite. +This file is part of the GNU MP Library. -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU 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 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 test suite 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 General -Public License for more details. +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 General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ +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> diff --git a/gmp/tests/mpz/t-export.c b/gmp/tests/mpz/t-export.c index d07476486d..f2fb3bd3a7 100644 --- a/gmp/tests/mpz/t-export.c +++ b/gmp/tests/mpz/t-export.c @@ -2,20 +2,20 @@ Copyright 2002, 2003 Free Software Foundation, Inc. -This file is part of the GNU MP Library test suite. +This file is part of the GNU MP Library. -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU 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 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 test suite 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 General -Public License for more details. +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 General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ +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> diff --git a/gmp/tests/mpz/t-fac_ui.c b/gmp/tests/mpz/t-fac_ui.c index 079bdff912..25d746e758 100644 --- a/gmp/tests/mpz/t-fac_ui.c +++ b/gmp/tests/mpz/t-fac_ui.c @@ -1,21 +1,21 @@ -/* Exercise mpz_fac_ui and mpz_2fac_ui. +/* Exercise mpz_fac_ui. -Copyright 2000-2002, 2012 Free Software Foundation, Inc. +Copyright 2000, 2001, 2002 Free Software Foundation, Inc. -This file is part of the GNU MP Library test suite. +This file is part of the GNU MP Library. -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU 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 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 test suite 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 General -Public License for more details. +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 General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ +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> @@ -35,9 +35,9 @@ the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ int main (int argc, char *argv[]) { - unsigned long n, m; - unsigned long limit = 2222; - mpz_t df[2], f, r; + unsigned long n; + unsigned long limit = 1500; + mpz_t f, r; tests_start (); @@ -49,12 +49,10 @@ main (int argc, char *argv[]) /* for small limb testing */ limit = MIN (limit, MP_LIMB_T_MAX); - mpz_init_set_ui (df[0], 1); /* 0!! = 1 */ - mpz_init_set_ui (df[1], 1); /* -1!! = 1 */ mpz_init_set_ui (f, 1); /* 0! = 1 */ mpz_init (r); - for (n = 0, m = 0; n < limit; n++) + for (n = 0; n < limit; n++) { mpz_fac_ui (r, n); MPZ_CHECK_FORMAT (r); @@ -67,36 +65,9 @@ main (int argc, char *argv[]) abort (); } - mpz_2fac_ui (r, n); - MPZ_CHECK_FORMAT (r); - - if (mpz_cmp (df[m], r) != 0) - { - printf ("mpz_2fac_ui(%lu) wrong\n", n); - printf (" got "); mpz_out_str (stdout, 10, r); printf("\n"); - printf (" want "); mpz_out_str (stdout, 10, df[m]); printf("\n"); - abort (); - } - - m ^= 1; - mpz_mul_ui (df[m], df[m], n+1); /* (n+1)!! = (n-1)!! * (n+1) */ - mpz_mul_ui (f, f, n+1); /* (n+1)! = n! * (n+1) */ - } - - n = 1048573; /* a prime */ - if (n > MP_LIMB_T_MAX) - n = 65521; /* a smaller prime :-) */ - mpz_fac_ui (f, n - 1); - m = mpz_fdiv_ui (f, n); - if ( m != n - 1) - { - printf ("mpz_fac_ui(%lu) wrong\n", n - 1); - printf (" Wilson's theorem not verified: got %lu, expected %lu.\n",m ,n - 1); - abort (); + mpz_mul_ui (f, f, n+1); /* (n+1)! = n! * n */ } - mpz_clear (df[0]); - mpz_clear (df[1]); mpz_clear (f); mpz_clear (r); diff --git a/gmp/tests/mpz/t-fdiv.c b/gmp/tests/mpz/t-fdiv.c index a616e5b101..c4053fab90 100644 --- a/gmp/tests/mpz/t-fdiv.c +++ b/gmp/tests/mpz/t-fdiv.c @@ -3,20 +3,20 @@ Copyright 1993, 1994, 1996, 2000, 2001 Free Software Foundation, Inc. -This file is part of the GNU MP Library test suite. +This file is part of the GNU MP Library. -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU 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 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 test suite 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 General -Public License for more details. +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 General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ +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> @@ -25,8 +25,8 @@ the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ #include "gmp-impl.h" #include "tests.h" -void dump_abort (mpz_t, mpz_t); -void debug_mp (mpz_t, int); +void dump_abort __GMP_PROTO ((mpz_t, mpz_t)); +void debug_mp __GMP_PROTO ((mpz_t, int)); int main (int argc, char **argv) diff --git a/gmp/tests/mpz/t-fdiv_ui.c b/gmp/tests/mpz/t-fdiv_ui.c index 031b519f8f..3012d9b112 100644 --- a/gmp/tests/mpz/t-fdiv_ui.c +++ b/gmp/tests/mpz/t-fdiv_ui.c @@ -1,22 +1,22 @@ /* Test mpz_abs, mpz_add, mpz_cmp, mpz_cmp_ui, mpz_fdiv_qr_ui, mpz_fdiv_q_ui, mpz_fdiv_r_ui, mpz_fdiv_ui, mpz_mul_ui. -Copyright 1993, 1994, 1996, 2000-2002 Free Software Foundation, Inc. +Copyright 1993, 1994, 1996, 2000, 2001, 2002 Free Software Foundation, Inc. -This file is part of the GNU MP Library test suite. +This file is part of the GNU MP Library. -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU 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 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 test suite 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 General -Public License for more details. +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 General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ +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> @@ -25,8 +25,8 @@ the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ #include "gmp-impl.h" #include "tests.h" -void dump_abort (const char *, mpz_t, unsigned long); -void debug_mp (mpz_t, int); +void dump_abort __GMP_PROTO ((char *, mpz_t, unsigned long)); +void debug_mp __GMP_PROTO ((mpz_t, int)); int main (int argc, char **argv) @@ -144,7 +144,7 @@ main (int argc, char **argv) } void -dump_abort (const char *str, mpz_t dividend, unsigned long divisor) +dump_abort (char *str, mpz_t dividend, unsigned long divisor) { fprintf (stderr, "ERROR: %s\n", str); fprintf (stderr, "dividend = "); debug_mp (dividend, -16); diff --git a/gmp/tests/mpz/t-fib_ui.c b/gmp/tests/mpz/t-fib_ui.c index a7425b5b89..1e84a288e3 100644 --- a/gmp/tests/mpz/t-fib_ui.c +++ b/gmp/tests/mpz/t-fib_ui.c @@ -1,21 +1,21 @@ /* Test mpz_fib_ui and mpz_fib2_ui. -Copyright 2000-2002 Free Software Foundation, Inc. +Copyright 2000, 2001, 2002 Free Software Foundation, Inc. -This file is part of the GNU MP Library test suite. +This file is part of the GNU MP Library. -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU 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 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 test suite 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 General -Public License for more details. +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 General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ +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> @@ -73,7 +73,7 @@ int main (int argc, char *argv[]) { unsigned long n; - unsigned long limit = 100 * GMP_LIMB_BITS; + unsigned long limit = 100 * BITS_PER_MP_LIMB; mpz_t want_fn, want_fn1, got_fn, got_fn1; tests_start (); diff --git a/gmp/tests/mpz/t-fits.c b/gmp/tests/mpz/t-fits.c index b1db216573..dac0851567 100644 --- a/gmp/tests/mpz/t-fits.c +++ b/gmp/tests/mpz/t-fits.c @@ -3,20 +3,20 @@ /* Copyright 2001 Free Software Foundation, Inc. -This file is part of the GNU MP Library test suite. +This file is part of the GNU MP Library. -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU 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 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 test suite 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 General -Public License for more details. +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 General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ +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> @@ -84,7 +84,7 @@ main (void) EXPECT (mpz_fits_sshort_p, 1); mpz_set_ui (z, 1L); - mpz_mul_2exp (z, z, 5L*GMP_LIMB_BITS); + mpz_mul_2exp (z, z, 5L*BITS_PER_MP_LIMB); expr = "2^(5*BPML)"; EXPECT (mpz_fits_ulong_p, 0); EXPECT (mpz_fits_uint_p, 0); diff --git a/gmp/tests/mpz/t-gcd.c b/gmp/tests/mpz/t-gcd.c index fef4fde0cf..23d7b12d32 100644 --- a/gmp/tests/mpz/t-gcd.c +++ b/gmp/tests/mpz/t-gcd.c @@ -1,22 +1,22 @@ /* Test mpz_gcd, mpz_gcdext, and mpz_gcd_ui. -Copyright 1991, 1993, 1994, 1996, 1997, 2000-2005, 2008, 2009, 2012 Free -Software Foundation, Inc. +Copyright 1991, 1993, 1994, 1996, 1997, 2000, 2001, 2002, 2003, 2004, 2005, +2008, 2009 Free Software Foundation, Inc. -This file is part of the GNU MP Library test suite. +This file is part of the GNU MP Library. -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU 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 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 test suite 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 General -Public License for more details. +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 General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ +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> @@ -25,29 +25,10 @@ the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ #include "gmp-impl.h" #include "tests.h" -void one_test (mpz_t, mpz_t, mpz_t, int); -void debug_mp (mpz_t, int); - -static int gcdext_valid_p (const mpz_t, const mpz_t, const mpz_t, const mpz_t); - -/* Keep one_test's variables global, so that we don't need - to reinitialize them for each test. */ -mpz_t gcd1, gcd2, s, temp1, temp2, temp3; - -#define MAX_SCHOENHAGE_THRESHOLD HGCD_REDUCE_THRESHOLD - -/* Define this to make all operands be large enough for Schoenhage gcd - to be used. */ -#ifndef WHACK_SCHOENHAGE -#define WHACK_SCHOENHAGE 0 -#endif - -#if WHACK_SCHOENHAGE -#define MIN_OPERAND_BITSIZE (MAX_SCHOENHAGE_THRESHOLD * GMP_NUMB_BITS) -#else -#define MIN_OPERAND_BITSIZE 1 -#endif +void one_test __GMP_PROTO ((mpz_t, mpz_t, mpz_t, int)); +void debug_mp __GMP_PROTO ((mpz_t, int)); +static int gcdext_valid_p __GMP_PROTO ((const mpz_t a, const mpz_t b, const mpz_t g, const mpz_t s)); void check_data (void) @@ -66,7 +47,10 @@ check_data (void) mpz_t a, b, got, want; int i; - mpz_inits (a, b, got, want, NULL); + mpz_init (a); + mpz_init (b); + mpz_init (got); + mpz_init (want); for (i = 0; i < numberof (data); i++) { @@ -88,162 +72,77 @@ check_data (void) } } - mpz_clears (a, b, got, want, NULL); -} - -void -make_chain_operands (mpz_t ref, mpz_t a, mpz_t b, gmp_randstate_t rs, int nb1, int nb2, int chain_len) -{ - mpz_t bs, temp1, temp2; - int j; - - mpz_inits (bs, temp1, temp2, NULL); - - /* Generate a division chain backwards, allowing otherwise unlikely huge - quotients. */ - - mpz_set_ui (a, 0); - mpz_urandomb (bs, rs, 32); - mpz_urandomb (bs, rs, mpz_get_ui (bs) % nb1 + 1); - mpz_rrandomb (b, rs, mpz_get_ui (bs)); - mpz_add_ui (b, b, 1); - mpz_set (ref, b); - - for (j = 0; j < chain_len; j++) - { - mpz_urandomb (bs, rs, 32); - mpz_urandomb (bs, rs, mpz_get_ui (bs) % nb2 + 1); - mpz_rrandomb (temp2, rs, mpz_get_ui (bs) + 1); - mpz_add_ui (temp2, temp2, 1); - mpz_mul (temp1, b, temp2); - mpz_add (a, a, temp1); - - mpz_urandomb (bs, rs, 32); - mpz_urandomb (bs, rs, mpz_get_ui (bs) % nb2 + 1); - mpz_rrandomb (temp2, rs, mpz_get_ui (bs) + 1); - mpz_add_ui (temp2, temp2, 1); - mpz_mul (temp1, a, temp2); - mpz_add (b, b, temp1); - } - - mpz_clears (bs, temp1, temp2, NULL); -} - -/* Test operands from a table of seed data. This variant creates the operands - using plain ol' mpz_rrandomb. This is a hack for better coverage of the gcd - code, which depends on that the random number generators give the exact - numbers we expect. */ -void -check_kolmo1 (void) -{ - static const struct { - unsigned int seed; - int nb; - const char *want; - } data[] = { - { 59618, 38208, "5"}, - { 76521, 49024, "3"}, - { 85869, 54976, "1"}, - { 99449, 63680, "1"}, - {112453, 72000, "1"} - }; - - gmp_randstate_t rs; - mpz_t bs, a, b, want; - int i, unb, vnb, nb; - - gmp_randinit_default (rs); - - mpz_inits (bs, a, b, want, NULL); - - for (i = 0; i < numberof (data); i++) - { - nb = data[i].nb; - - gmp_randseed_ui (rs, data[i].seed); - - mpz_urandomb (bs, rs, 32); - unb = mpz_get_ui (bs) % nb; - mpz_urandomb (bs, rs, 32); - vnb = mpz_get_ui (bs) % nb; - - mpz_rrandomb (a, rs, unb); - mpz_rrandomb (b, rs, vnb); - - mpz_set_str_or_abort (want, data[i].want, 0); - - one_test (a, b, want, -1); - } - - mpz_clears (bs, a, b, want, NULL); - gmp_randclear (rs); + mpz_clear (a); + mpz_clear (b); + mpz_clear (got); + mpz_clear (want); } -/* Test operands from a table of seed data. This variant creates the operands - using a division chain. This is a hack for better coverage of the gcd - code, which depends on that the random number generators give the exact - numbers we expect. */ -void -check_kolmo2 (void) -{ - static const struct { - unsigned int seed; - int nb, chain_len; - } data[] = { - { 917, 15, 5 }, - { 1032, 18, 6 }, - { 1167, 18, 6 }, - { 1174, 18, 6 }, - { 1192, 18, 6 }, - }; - - gmp_randstate_t rs; - mpz_t bs, a, b, want; - int i; - - gmp_randinit_default (rs); +/* Keep one_test's variables global, so that we don't need + to reinitialize them for each test. */ +mpz_t gcd1, gcd2, s, t, temp1, temp2, temp3; - mpz_inits (bs, a, b, want, NULL); +#if GCD_DC_THRESHOLD > GCDEXT_DC_THRESHOLD +#define MAX_SCHOENHAGE_THRESHOLD GCD_DC_THRESHOLD +#else +#define MAX_SCHOENHAGE_THRESHOLD GCDEXT_DC_THRESHOLD +#endif - for (i = 0; i < numberof (data); i++) - { - gmp_randseed_ui (rs, data[i].seed); - make_chain_operands (want, a, b, rs, data[i].nb, data[i].nb, data[i].chain_len); - one_test (a, b, want, -1); - } +/* Define this to make all operands be large enough for Schoenhage gcd + to be used. */ +#ifndef WHACK_SCHOENHAGE +#define WHACK_SCHOENHAGE 0 +#endif - mpz_clears (bs, a, b, want, NULL); - gmp_randclear (rs); -} +#if WHACK_SCHOENHAGE +#define MIN_OPERAND_BITSIZE (MAX_SCHOENHAGE_THRESHOLD * GMP_NUMB_BITS) +#else +#define MIN_OPERAND_BITSIZE 1 +#endif int main (int argc, char **argv) { mpz_t op1, op2, ref; - int i, chain_len; + int i, j, chain_len; gmp_randstate_ptr rands; mpz_t bs; unsigned long bsi, size_range; - long int reps = 200; + int reps = 100; - tests_start (); - TESTS_REPS (reps, argv, argc); + if (argc == 2) + reps = atoi (argv[1]); + tests_start (); rands = RANDS; - mpz_inits (bs, op1, op2, ref, gcd1, gcd2, temp1, temp2, temp3, s, NULL); - check_data (); - check_kolmo1 (); - check_kolmo2 (); + + mpz_init (bs); + mpz_init (op1); + mpz_init (op2); + mpz_init (ref); + mpz_init (gcd1); + mpz_init (gcd2); + mpz_init (temp1); + mpz_init (temp2); + mpz_init (temp3); + mpz_init (s); + mpz_init (t); /* Testcase to exercise the u0 == u1 case in mpn_gcdext_lehmer_n. */ - mpz_set_ui (op2, GMP_NUMB_MAX); /* FIXME: Huge limb doesn't always fit */ + mpz_set_ui (op2, GMP_NUMB_MAX); mpz_mul_2exp (op1, op2, 100); mpz_add (op1, op1, op2); mpz_mul_ui (op2, op2, 2); one_test (op1, op2, NULL, -1); +#if 0 + mpz_set_str (op1, "4da8e405e0d2f70d6d679d3de08a5100a81ec2cff40f97b313ae75e1183f1df2b244e194ebb02a4ece50d943640a301f0f6cc7f539117b783c3f3a3f91649f8a00d2e1444d52722810562bce02fccdbbc8fe3276646e306e723dd3b", 16); + mpz_set_str (op2, "76429e12e4fdd8929d89c21657097fbac09d1dc08cf7f1323a34e78ca34226e1a7a29b86fee0fa7fe2cc2a183d46d50df1fe7029590974ad7da77605f35f902cb8b9b8d22dd881eaae5919675d49a337145a029c3b33fc2b0", 16); + one_test (op1, op2, NULL, -1); +#endif + for (i = 0; i < reps; i++) { /* Generate plain operands with unknown gcd. These types of operands @@ -253,12 +152,12 @@ main (int argc, char **argv) of that other ASSERTs are triggered before it. */ mpz_urandomb (bs, rands, 32); - size_range = mpz_get_ui (bs) % 17 + 2; + size_range = mpz_get_ui (bs) % 13 + 2; mpz_urandomb (bs, rands, size_range); - mpz_rrandomb (op1, rands, mpz_get_ui (bs) + MIN_OPERAND_BITSIZE); + mpz_urandomb (op1, rands, mpz_get_ui (bs) + MIN_OPERAND_BITSIZE); mpz_urandomb (bs, rands, size_range); - mpz_rrandomb (op2, rands, mpz_get_ui (bs) + MIN_OPERAND_BITSIZE); + mpz_urandomb (op2, rands, mpz_get_ui (bs) + MIN_OPERAND_BITSIZE); mpz_urandomb (bs, rands, 8); bsi = mpz_get_ui (bs); @@ -278,17 +177,58 @@ main (int argc, char **argv) /* Generate a division chain backwards, allowing otherwise unlikely huge quotients. */ + mpz_set_ui (op1, 0); mpz_urandomb (bs, rands, 32); - chain_len = mpz_get_ui (bs) % LOG2C (GMP_NUMB_BITS * MAX_SCHOENHAGE_THRESHOLD); - mpz_urandomb (bs, rands, 32); - chain_len = mpz_get_ui (bs) % (1 << chain_len) / 32; + mpz_urandomb (bs, rands, mpz_get_ui (bs) % 16 + 1); + mpz_rrandomb (op2, rands, mpz_get_ui (bs)); + mpz_add_ui (op2, op2, 1); + mpz_set (ref, op2); - make_chain_operands (ref, op1, op2, rands, 16, 12, chain_len); +#if WHACK_SCHOENHAGE + chain_len = 1000000; +#else + mpz_urandomb (bs, rands, 32); + chain_len = mpz_get_ui (bs) % (GMP_NUMB_BITS * MAX_SCHOENHAGE_THRESHOLD / 256); +#endif + for (j = 0; j < chain_len; j++) + { + mpz_urandomb (bs, rands, 32); + mpz_urandomb (bs, rands, mpz_get_ui (bs) % 12 + 1); + mpz_rrandomb (temp2, rands, mpz_get_ui (bs) + 1); + mpz_add_ui (temp2, temp2, 1); + mpz_mul (temp1, op2, temp2); + mpz_add (op1, op1, temp1); + + /* Don't generate overly huge operands. */ + if (SIZ (op1) > 3 * MAX_SCHOENHAGE_THRESHOLD) + break; + + mpz_urandomb (bs, rands, 32); + mpz_urandomb (bs, rands, mpz_get_ui (bs) % 12 + 1); + mpz_rrandomb (temp2, rands, mpz_get_ui (bs) + 1); + mpz_add_ui (temp2, temp2, 1); + mpz_mul (temp1, op1, temp2); + mpz_add (op2, op2, temp1); + + /* Don't generate overly huge operands. */ + if (SIZ (op2) > 3 * MAX_SCHOENHAGE_THRESHOLD) + break; + } one_test (op1, op2, ref, i); } - mpz_clears (bs, op1, op2, ref, gcd1, gcd2, temp1, temp2, temp3, s, NULL); + mpz_clear (bs); + mpz_clear (op1); + mpz_clear (op2); + mpz_clear (ref); + mpz_clear (gcd1); + mpz_clear (gcd2); + mpz_clear (temp1); + mpz_clear (temp2); + mpz_clear (temp3); + mpz_clear (s); + mpz_clear (t); tests_end (); exit (0); @@ -304,7 +244,7 @@ void one_test (mpz_t op1, mpz_t op2, mpz_t ref, int i) { /* - printf ("%d %d %d\n", SIZ (op1), SIZ (op2), ref != NULL ? SIZ (ref) : 0); + printf ("%ld %ld %ld\n", SIZ (op1), SIZ (op2), SIZ (ref)); fflush (stdout); */ @@ -431,7 +371,7 @@ gcdext_valid_p (const mpz_t a, const mpz_t b, const mpz_t g, const mpz_t s) if (mpz_cmpabs_ui (s, 1) > 0) { mpz_mul_2exp (temp3, s, 1); - if (mpz_cmpabs (temp3, temp2) >= 0) + if (mpz_cmpabs (temp3, temp2) > 0) return 0; } @@ -447,7 +387,7 @@ gcdext_valid_p (const mpz_t a, const mpz_t b, const mpz_t g, const mpz_t s) if (mpz_cmpabs_ui (temp2, 1) > 0) { mpz_mul_2exp (temp2, temp2, 1); - if (mpz_cmpabs (temp2, temp1) >= 0) + if (mpz_cmpabs (temp2, temp1) > 0) return 0; } return 1; diff --git a/gmp/tests/mpz/t-gcd_ui.c b/gmp/tests/mpz/t-gcd_ui.c index 16f51e11b6..ac6431ceb2 100644 --- a/gmp/tests/mpz/t-gcd_ui.c +++ b/gmp/tests/mpz/t-gcd_ui.c @@ -2,20 +2,20 @@ Copyright 2003 Free Software Foundation, Inc. -This file is part of the GNU MP Library test suite. +This file is part of the GNU MP Library. -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU 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 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 test suite 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 General -Public License for more details. +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 General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ +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> diff --git a/gmp/tests/mpz/t-get_d.c b/gmp/tests/mpz/t-get_d.c index 4a4a930498..41c0ba8d20 100644 --- a/gmp/tests/mpz/t-get_d.c +++ b/gmp/tests/mpz/t-get_d.c @@ -1,21 +1,21 @@ /* Test mpz_get_d. -Copyright 2002, 2012 Free Software Foundation, Inc. +Copyright 2002 Free Software Foundation, Inc. -This file is part of the GNU MP Library test suite. +This file is part of the GNU MP Library. -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU 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 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 test suite 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 General -Public License for more details. +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 General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ +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> @@ -31,8 +31,8 @@ check_onebit (void) mpz_t z; double got, want; /* FIXME: It'd be better to base this on the float format. */ -#if defined (__vax) || defined (__vax__) - int limit = 127 - 1; /* vax fp numbers have limited range */ +#ifdef __vax + int limit = 127; /* vax fp numbers have limited range */ #else int limit = 512; #endif diff --git a/gmp/tests/mpz/t-get_d_2exp.c b/gmp/tests/mpz/t-get_d_2exp.c index 2f5555daf5..3b659f82c9 100644 --- a/gmp/tests/mpz/t-get_d_2exp.c +++ b/gmp/tests/mpz/t-get_d_2exp.c @@ -1,21 +1,21 @@ /* Test mpz_get_d_2exp. -Copyright 2002, 2003, 2012 Free Software Foundation, Inc. +Copyright 2002, 2003 Free Software Foundation, Inc. -This file is part of the GNU MP Library test suite. +This file is part of the GNU MP Library. -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU 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 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 test suite 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 General -Public License for more details. +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 General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ +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> @@ -25,32 +25,6 @@ the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ static void -check_zero (void) -{ - mpz_t z; - double got, want; - long got_exp, want_exp; - - mpz_init_set_ui (z, 0); - - want = 0.0; - want_exp = 0; - got = mpz_get_d_2exp (&got_exp, z); - if (got != want || got_exp != want_exp) - { - printf ("mpz_get_d_2exp wrong on zero\n"); - mpz_trace (" z ", z); - d_trace (" want ", want); - d_trace (" got ", got); - printf (" want exp %ld\n", want_exp); - printf (" got exp %ld\n", got_exp); - abort(); - } - - mpz_clear (z); -} - -static void check_onebit (void) { static const unsigned long data[] = { @@ -213,7 +187,6 @@ main (void) tests_start (); mp_trace_base = -16; - check_zero (); check_onebit (); check_round (); check_rand (); diff --git a/gmp/tests/mpz/t-get_si.c b/gmp/tests/mpz/t-get_si.c index 083ada7f1e..0a9739bf0e 100644 --- a/gmp/tests/mpz/t-get_si.c +++ b/gmp/tests/mpz/t-get_si.c @@ -2,20 +2,20 @@ Copyright 2000, 2001 Free Software Foundation, Inc. -This file is part of the GNU MP Library test suite. +This file is part of the GNU MP Library. -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU 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 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 test suite 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 General -Public License for more details. +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 General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ +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> diff --git a/gmp/tests/mpz/t-hamdist.c b/gmp/tests/mpz/t-hamdist.c index f39c8ab8c2..8109365966 100644 --- a/gmp/tests/mpz/t-hamdist.c +++ b/gmp/tests/mpz/t-hamdist.c @@ -2,20 +2,20 @@ Copyright 2001, 2002 Free Software Foundation, Inc. -This file is part of the GNU MP Library test suite. +This file is part of the GNU MP Library. -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU 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 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 test suite 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 General -Public License for more details. +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 General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ +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> diff --git a/gmp/tests/mpz/t-import.c b/gmp/tests/mpz/t-import.c index 8d10fdc8aa..0c7b929e33 100644 --- a/gmp/tests/mpz/t-import.c +++ b/gmp/tests/mpz/t-import.c @@ -2,20 +2,20 @@ Copyright 2002, 2003 Free Software Foundation, Inc. -This file is part of the GNU MP Library test suite. +This file is part of the GNU MP Library. -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU 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 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 test suite 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 General -Public License for more details. +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 General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ +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> diff --git a/gmp/tests/mpz/t-inp_str.c b/gmp/tests/mpz/t-inp_str.c index f50290bff6..7c0893752b 100644 --- a/gmp/tests/mpz/t-inp_str.c +++ b/gmp/tests/mpz/t-inp_str.c @@ -2,20 +2,20 @@ Copyright 2001, 2002 Free Software Foundation, Inc. -This file is part of the GNU MP Library test suite. +This file is part of the GNU MP Library. -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU 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 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 test suite 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 General -Public License for more details. +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 General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ +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 "config.h" @@ -48,31 +48,21 @@ check_data (void) { "0", 10, "0", 1 }, { "abc", 10, "0", 0 }, - { "0xf", 10, "0", 1 }, { "ghi", 16, "0", 0 }, - { "100", 90, "0", 0 }, { "ff", 16, "255", 2 }, { "-ff", 16, "-255", 3 }, { "FF", 16, "255", 2 }, { "-FF", 16, "-255", 3 }, - { "z", 36, "35", 1 }, - { "Z", 36, "35", 1 }, - { "1B", 59, "70", 2 }, - { "a", 60, "36", 1 }, - { "A", 61, "10", 1 }, + { "z", 36, "35", 1 }, + { "Z", 36, "35", 1 }, { "0x0", 0, "0", 3 }, - { "0X10", 0, "16", 4 }, - { "-0X0", 0, "0", 4 }, + { "0x10", 0, "16", 4 }, + { "-0x0", 0, "0", 4 }, { "-0x10", 0, "-16", 5 }, - { "0b0", 0, "0", 3 }, - { "0B10", 0, "2", 4 }, - { "-0B0", 0, "0", 4 }, - { "-0b10", 0, "-2", 5 }, - { "00", 0, "0", 2 }, { "010", 0, "8", 3 }, { "-00", 0, "0", 3 }, @@ -80,7 +70,6 @@ check_data (void) { "0x", 0, "0", 2 }, { "0", 0, "0", 1 }, - { " 030", 10, "30", 4 }, }; mpz_t got, want; diff --git a/gmp/tests/mpz/t-invert.c b/gmp/tests/mpz/t-invert.c deleted file mode 100644 index a033409a2f..0000000000 --- a/gmp/tests/mpz/t-invert.c +++ /dev/null @@ -1,121 +0,0 @@ -/* Test mpz_invert. - -Copyright 1991, 1993, 1994, 1996, 1997, 2000-2005, 2008, 2009, 2012, 2014 Free -Software Foundation, Inc. - -This file is part of the GNU MP Library test suite. - -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU 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 test suite 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 General -Public License for more details. - -You should have received a copy of the GNU General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ - -#include <stdio.h> -#include <stdlib.h> - -#include "gmp.h" -#include "gmp-impl.h" -#include "tests.h" - -int -main (int argc, char **argv) -{ - mpz_t a, m, ainv, t; - int test, r; - gmp_randstate_ptr rands; - mpz_t bs; - unsigned long bsi, size_range; - int reps = 1000; - - tests_start (); - TESTS_REPS (reps, argv, argc); - - rands = RANDS; - - mpz_init (bs); - mpz_init (a); - mpz_init (m); - mpz_init (ainv); - mpz_init (t); - - for (test = 0; test < reps; test++) - { - mpz_urandomb (bs, rands, 32); - size_range = mpz_get_ui (bs) % 16 + 2; - - mpz_urandomb (bs, rands, size_range); - mpz_rrandomb (a, rands, mpz_get_ui (bs)); - do { - mpz_urandomb (bs, rands, size_range); - mpz_rrandomb (m, rands, mpz_get_ui (bs)); - } while (mpz_sgn (m) == 0); - - mpz_urandomb (bs, rands, 8); - bsi = mpz_get_ui (bs); - - if ((bsi & 1) != 0) - mpz_neg (a, a); - if ((bsi & 2) != 0) - mpz_neg (m, m); - - r = mpz_invert (ainv, a, m); - if (r != 0) - { - MPZ_CHECK_FORMAT (ainv); - - if (mpz_cmp_ui (ainv, 0) < 0 || mpz_cmpabs (ainv, m) >= 0) - { - fprintf (stderr, "ERROR in test %d\n", test); - gmp_fprintf (stderr, "Inverse out of range.\n"); - gmp_fprintf (stderr, "a = %Zx\n", a); - gmp_fprintf (stderr, "1/a = %Zx\n", ainv); - gmp_fprintf (stderr, "m = %Zx\n", m); - abort (); - } - - mpz_mul (t, ainv, a); - mpz_mod (t, t, m); - - if (mpz_cmp_ui (t, mpz_cmpabs_ui (m, 1) != 0) != 0) - { - fprintf (stderr, "ERROR in test %d\n", test); - gmp_fprintf (stderr, "a^(-1)*a != 1 (mod m)\n"); - gmp_fprintf (stderr, "a = %Zx\n", a); - gmp_fprintf (stderr, "m = %Zx\n", m); - abort (); - } - } - else /* Inverse deos not exist */ - { - if (mpz_cmpabs_ui (m, 1) <= 0) - continue; /* OK */ - - mpz_gcd (t, a, m); - if (mpz_cmp_ui (t, 1) == 0) - { - fprintf (stderr, "ERROR in test %d\n", test); - gmp_fprintf (stderr, "Inverse exists, but was not found.\n"); - gmp_fprintf (stderr, "a = %Zx\n", a); - gmp_fprintf (stderr, "m = %Zx\n", m); - abort (); - } - } - } - - mpz_clear (bs); - mpz_clear (a); - mpz_clear (m); - mpz_clear (ainv); - mpz_clear (t); - - tests_end (); - exit (0); -} diff --git a/gmp/tests/mpz/t-io_raw.c b/gmp/tests/mpz/t-io_raw.c index e06e7bb14b..4fd71e4be1 100644 --- a/gmp/tests/mpz/t-io_raw.c +++ b/gmp/tests/mpz/t-io_raw.c @@ -2,20 +2,20 @@ Copyright 2001 Free Software Foundation, Inc. -This file is part of the GNU MP Library test suite. +This file is part of the GNU MP Library. -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU 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 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 test suite 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 General -Public License for more details. +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 General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ +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 "config.h" @@ -233,7 +233,7 @@ check_rand (void) for (i = 0; i < 500; i++) { - mpz_erandomb (want, rands, 10*GMP_LIMB_BITS); + mpz_erandomb (want, rands, 10*BITS_PER_MP_LIMB); mpz_negrandom (want, rands); fp = fopen_wplusb_or_die (FILENAME); diff --git a/gmp/tests/mpz/t-jac.c b/gmp/tests/mpz/t-jac.c index b6a0c33106..1b3e092888 100644 --- a/gmp/tests/mpz/t-jac.c +++ b/gmp/tests/mpz/t-jac.c @@ -1,21 +1,21 @@ /* Exercise mpz_*_kronecker_*() and mpz_jacobi() functions. -Copyright 1999-2004, 2013 Free Software Foundation, Inc. +Copyright 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. -This file is part of the GNU MP Library test suite. +This file is part of the GNU MP Library. -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU 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 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 test suite 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 General -Public License for more details. +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 General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ +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/. */ /* With no arguments the various Kronecker/Jacobi symbol routines are @@ -41,6 +41,7 @@ the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ #include "gmp-impl.h" #include "tests.h" + #ifdef _LONG_LONG_LIMB #define LL(l,ll) ll #else @@ -198,10 +199,6 @@ try_pari (mpz_srcptr a, mpz_srcptr b, int answer) void try_each (mpz_srcptr a, mpz_srcptr b, int answer) { -#if 0 - fprintf(stderr, "asize = %d, bsize = %d\n", - mpz_sizeinbase (a, 2), mpz_sizeinbase (b, 2)); -#endif if (option_pari) { try_pari (a, b, answer); @@ -616,33 +613,6 @@ check_data (void) /* special values inducing a==b==1 at the end of jac_or_kron() */ { "0x10000000000000000000000000000000000000000000000001", "0x10000000000000000000000000000000000000000000000003", 1 }, - - /* Test for previous bugs in jacobi_2. */ - { "0x43900000000", "0x42400000439", -1 }, /* 32-bit limbs */ - { "0x4390000000000000000", "0x4240000000000000439", -1 }, /* 64-bit limbs */ - - { "198158408161039063", "198158360916398807", -1 }, - - /* Some tests involving large quotients in the continued fraction - expansion. */ - { "37200210845139167613356125645445281805", - "451716845976689892447895811408978421929", -1 }, - { "67674091930576781943923596701346271058970643542491743605048620644676477275152701774960868941561652032482173612421015", - "4902678867794567120224500687210807069172039735", 0 }, - { "2666617146103764067061017961903284334497474492754652499788571378062969111250584288683585223600172138551198546085281683283672592", "2666617146103764067061017961903284334497474492754652499788571378062969111250584288683585223600172138551198546085281683290481773", 1 }, - - /* Exercises the case asize == 1, btwos > 0 in mpz_jacobi. */ - { "804609", "421248363205206617296534688032638102314410556521742428832362659824", 1 } , - { "4190209", "2239744742177804210557442048984321017460028974602978995388383905961079286530650825925074203175536427000", 1 }, - - /* Exercises the case asize == 1, btwos = 63 in mpz_jacobi - (relevant when GMP_LIMB_BITS == 64). */ - { "17311973299000934401", "1675975991242824637446753124775689449936871337036614677577044717424700351103148799107651171694863695242089956242888229458836426332300124417011114380886016", 1 }, - { "3220569220116583677", "41859917623035396746", -1 }, - - /* Other test cases that triggered bugs during development. */ - { "37200210845139167613356125645445281805", "340116213441272389607827434472642576514", -1 }, - { "74400421690278335226712251290890563610", "451716845976689892447895811408978421929", -1 }, }; int i; @@ -682,7 +652,7 @@ check_squares_zi (void) for (i = 0; i < 50; i++) { mpz_urandomb (bs, rands, 32); - size_range = mpz_get_ui (bs) % 10 + i/8 + 2; + size_range = mpz_get_ui (bs) % 10 + 2; mpz_urandomb (bs, rands, size_range); an = mpz_get_ui (bs); @@ -749,240 +719,6 @@ check_a_zero (void) } -/* Assumes that b = prod p_k^e_k */ -int -ref_jacobi (mpz_srcptr a, mpz_srcptr b, unsigned nprime, - mpz_t prime[], unsigned *exp) -{ - unsigned i; - int res; - - for (i = 0, res = 1; i < nprime; i++) - if (exp[i]) - { - int legendre = refmpz_legendre (a, prime[i]); - if (!legendre) - return 0; - if (exp[i] & 1) - res *= legendre; - } - return res; -} - -void -check_jacobi_factored (void) -{ -#define PRIME_N 10 -#define PRIME_MAX_SIZE 50 -#define PRIME_MAX_EXP 4 -#define PRIME_A_COUNT 10 -#define PRIME_B_COUNT 5 -#define PRIME_MAX_B_SIZE 2000 - - gmp_randstate_ptr rands = RANDS; - mpz_t prime[PRIME_N]; - unsigned exp[PRIME_N]; - mpz_t a, b, t, bs; - unsigned i; - - mpz_init (a); - mpz_init (b); - mpz_init (t); - mpz_init (bs); - - /* Generate primes */ - for (i = 0; i < PRIME_N; i++) - { - mp_size_t size; - mpz_init (prime[i]); - mpz_urandomb (bs, rands, 32); - size = mpz_get_ui (bs) % PRIME_MAX_SIZE + 2; - mpz_rrandomb (prime[i], rands, size); - if (mpz_cmp_ui (prime[i], 3) <= 0) - mpz_set_ui (prime[i], 3); - else - mpz_nextprime (prime[i], prime[i]); - } - - for (i = 0; i < PRIME_B_COUNT; i++) - { - unsigned j, k; - mp_bitcnt_t bsize; - - mpz_set_ui (b, 1); - bsize = 1; - - for (j = 0; j < PRIME_N && bsize < PRIME_MAX_B_SIZE; j++) - { - mpz_urandomb (bs, rands, 32); - exp[j] = mpz_get_ui (bs) % PRIME_MAX_EXP; - mpz_pow_ui (t, prime[j], exp[j]); - mpz_mul (b, b, t); - bsize = mpz_sizeinbase (b, 2); - } - for (k = 0; k < PRIME_A_COUNT; k++) - { - int answer; - mpz_rrandomb (a, rands, bsize + 2); - answer = ref_jacobi (a, b, j, prime, exp); - try_all (a, b, answer); - } - } - for (i = 0; i < PRIME_N; i++) - mpz_clear (prime[i]); - - mpz_clear (a); - mpz_clear (b); - mpz_clear (t); - mpz_clear (bs); - -#undef PRIME_N -#undef PRIME_MAX_SIZE -#undef PRIME_MAX_EXP -#undef PRIME_A_COUNT -#undef PRIME_B_COUNT -#undef PRIME_MAX_B_SIZE -} - -/* These tests compute (a|n), where the quotient sequence includes - large quotients, and n has a known factorization. Such inputs are - generated as follows. First, construct a large n, as a power of a - prime p of moderate size. - - Next, compute a matrix from factors (q,1;1,0), with q chosen with - uniformly distributed size. We must stop with matrix elements of - roughly half the size of n. Denote elements of M as M = (m00, m01; - m10, m11). - - We now look for solutions to - - n = m00 x + m01 y - a = m10 x + m11 y - - with x,y > 0. Since n >= m00 * m01, there exists a positive - solution to the first equation. Find those x, y, and substitute in - the second equation to get a. Then the quotient sequence for (a|n) - is precisely the quotients used when constructing M, followed by - the quotient sequence for (x|y). - - Numbers should also be large enough that we exercise hgcd_jacobi, - which means that they should be larger than - - max (GCD_DC_THRESHOLD, 3 * HGCD_THRESHOLD) - - With an n of roughly 40000 bits, this should hold on most machines. -*/ - -void -check_large_quotients (void) -{ -#define COUNT 50 -#define PBITS 200 -#define PPOWER 201 -#define MAX_QBITS 500 - - gmp_randstate_ptr rands = RANDS; - - mpz_t p, n, q, g, s, t, x, y, bs; - mpz_t M[2][2]; - mp_bitcnt_t nsize; - unsigned i; - - mpz_init (p); - mpz_init (n); - mpz_init (q); - mpz_init (g); - mpz_init (s); - mpz_init (t); - mpz_init (x); - mpz_init (y); - mpz_init (bs); - mpz_init (M[0][0]); - mpz_init (M[0][1]); - mpz_init (M[1][0]); - mpz_init (M[1][1]); - - /* First generate a number with known factorization, as a random - smallish prime raised to an odd power. Then (a|n) = (a|p). */ - mpz_rrandomb (p, rands, PBITS); - mpz_nextprime (p, p); - mpz_pow_ui (n, p, PPOWER); - - nsize = mpz_sizeinbase (n, 2); - - for (i = 0; i < COUNT; i++) - { - int answer; - mp_bitcnt_t msize; - - mpz_set_ui (M[0][0], 1); - mpz_set_ui (M[0][1], 0); - mpz_set_ui (M[1][0], 0); - mpz_set_ui (M[1][1], 1); - - for (msize = 1; 2*(msize + MAX_QBITS) + 1 < nsize ;) - { - unsigned i; - mpz_rrandomb (bs, rands, 32); - mpz_rrandomb (q, rands, 1 + mpz_get_ui (bs) % MAX_QBITS); - - /* Multiply by (q, 1; 1,0) from the right */ - for (i = 0; i < 2; i++) - { - mp_bitcnt_t size; - mpz_swap (M[i][0], M[i][1]); - mpz_addmul (M[i][0], M[i][1], q); - size = mpz_sizeinbase (M[i][0], 2); - if (size > msize) - msize = size; - } - } - mpz_gcdext (g, s, t, M[0][0], M[0][1]); - ASSERT_ALWAYS (mpz_cmp_ui (g, 1) == 0); - - /* Solve n = M[0][0] * x + M[0][1] * y */ - if (mpz_sgn (s) > 0) - { - mpz_mul (x, n, s); - mpz_fdiv_qr (q, x, x, M[0][1]); - mpz_mul (y, q, M[0][0]); - mpz_addmul (y, t, n); - ASSERT_ALWAYS (mpz_sgn (y) > 0); - } - else - { - mpz_mul (y, n, t); - mpz_fdiv_qr (q, y, y, M[0][0]); - mpz_mul (x, q, M[0][1]); - mpz_addmul (x, s, n); - ASSERT_ALWAYS (mpz_sgn (x) > 0); - } - mpz_mul (x, x, M[1][0]); - mpz_addmul (x, y, M[1][1]); - - /* Now (x|n) has the selected large quotients */ - answer = refmpz_legendre (x, p); - try_zi_zi (x, n, answer); - } - mpz_clear (p); - mpz_clear (n); - mpz_clear (q); - mpz_clear (g); - mpz_clear (s); - mpz_clear (t); - mpz_clear (x); - mpz_clear (y); - mpz_clear (bs); - mpz_clear (M[0][0]); - mpz_clear (M[0][1]); - mpz_clear (M[1][0]); - mpz_clear (M[1][1]); -#undef COUNT -#undef PBITS -#undef PPOWER -#undef MAX_QBITS -} - int main (int argc, char *argv[]) { @@ -1005,8 +741,7 @@ try(a,b,answer) =\n\ check_data (); check_squares_zi (); check_a_zero (); - check_jacobi_factored (); - check_large_quotients (); + tests_end (); exit (0); } diff --git a/gmp/tests/mpz/t-lcm.c b/gmp/tests/mpz/t-lcm.c index 3cc41483ef..195f0ee2f8 100644 --- a/gmp/tests/mpz/t-lcm.c +++ b/gmp/tests/mpz/t-lcm.c @@ -2,20 +2,20 @@ Copyright 2001 Free Software Foundation, Inc. -This file is part of the GNU MP Library test suite. +This file is part of the GNU MP Library. -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU 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 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 test suite 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 General -Public License for more details. +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 General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ +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> @@ -111,13 +111,6 @@ check_primes (void) mpz_init (x); mpz_init (y); - /* Check zeros. */ - mpz_set_ui (want, 0); - mpz_set_ui (x, 1); - check_all (want, want, want); - check_all (want, want, x); - check_all (want, x, want); - /* New prime each time. */ mpz_set_ui (want, 1L); for (i = 0; i < numberof (prime); i++) diff --git a/gmp/tests/mpz/t-limbs.c b/gmp/tests/mpz/t-limbs.c deleted file mode 100644 index 43bcfb03e8..0000000000 --- a/gmp/tests/mpz/t-limbs.c +++ /dev/null @@ -1,233 +0,0 @@ -/* Test mpz_limbs_* functions - -Copyright 2013 Free Software Foundation, Inc. - -This file is part of the GNU MP Library test suite. - -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU 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 test suite 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 General -Public License for more details. - -You should have received a copy of the GNU General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ - -#include <stdlib.h> -#include <stdio.h> - -#include "gmp.h" -#include "gmp-impl.h" -#include "tests.h" - -#define COUNT 100 -#define BITSIZE 500 - -/* Like mpz_add. For simplicity, support positive inputs only. */ -static void -alt_add (mpz_ptr r, mpz_srcptr a, mpz_srcptr b) -{ - mp_size_t an = mpz_size (a); - mp_size_t bn = mpz_size (b); - mp_ptr rp; - - ASSERT (an > 0); - ASSERT (bn > 0); - if (an < bn) - { - MP_SIZE_T_SWAP (an, bn); - MPZ_SRCPTR_SWAP (a, b); - } - rp = mpz_limbs_modify (r, an + 1); - rp[an] = mpn_add (rp, mpz_limbs_read (a), an, mpz_limbs_read (b), bn); - mpz_limbs_finish (r, an + 1); -} - -static void -check_funcs (const char *name, - void (*f)(mpz_ptr, mpz_srcptr, mpz_srcptr), - void (*ref_f)(mpz_ptr, mpz_srcptr, mpz_srcptr), - mpz_srcptr a, mpz_srcptr b) -{ - mpz_t r, ref; - mpz_inits (r, ref, NULL); - - ref_f (ref, a, b); - MPZ_CHECK_FORMAT (ref); - f (r, a, b); - MPZ_CHECK_FORMAT (r); - - if (mpz_cmp (r, ref) != 0) - { - printf ("%s failed, abits %u, bbits %u\n", - name, - (unsigned) mpz_sizeinbase (a, 2), - (unsigned) mpz_sizeinbase (b, 2)); - gmp_printf ("a = %Zx\n", a); - gmp_printf ("b = %Zx\n", b); - gmp_printf ("r = %Zx (bad)\n", r); - gmp_printf ("ref = %Zx\n", ref); - abort (); - } - mpz_clears (r, ref, NULL); -} - -static void -check_add (void) -{ - gmp_randstate_ptr rands = RANDS; - mpz_t bs, a, b; - unsigned i; - mpz_inits (bs, a, b, NULL); - for (i = 0; i < COUNT; i++) - { - mpz_urandomb (bs, rands, 32); - mpz_rrandomb (a, rands, 1 + mpz_get_ui (bs) % BITSIZE); - mpz_urandomb (bs, rands, 32); - mpz_rrandomb (b, rands, 1 + mpz_get_ui (bs) % BITSIZE); - - check_funcs ("add", alt_add, mpz_add, a, b); - } - mpz_clears (bs, a, b, NULL); -} - -static void -alt_mul (mpz_ptr r, mpz_srcptr a, mpz_srcptr b) -{ - mp_size_t an = mpz_size (a); - mp_size_t bn = mpz_size (b); - mp_srcptr ap, bp; - TMP_DECL; - - TMP_MARK; - - ASSERT (an > 0); - ASSERT (bn > 0); - if (an < bn) - { - MP_SIZE_T_SWAP (an, bn); - MPZ_SRCPTR_SWAP (a, b); - } - /* NOTE: This copying seems unnecessary; better to allocate new - result area, and free the old area when done. */ - if (r == a) - { - mp_ptr tp = TMP_ALLOC_LIMBS (an); - MPN_COPY (tp, mpz_limbs_read (a), an); - ap = tp; - bp = (a == b) ? ap : mpz_limbs_read (b); - } - else if (r == b) - { - mp_ptr tp = TMP_ALLOC_LIMBS (bn); - MPN_COPY (tp, mpz_limbs_read (b), bn); - bp = tp; - ap = mpz_limbs_read (a); - } - else - { - ap = mpz_limbs_read (a); - bp = mpz_limbs_read (b); - } - mpn_mul (mpz_limbs_write (r, an + bn), - ap, an, bp, bn); - - mpz_limbs_finish (r, an + bn); -} - -void -check_mul (void) -{ - gmp_randstate_ptr rands = RANDS; - mpz_t bs, a, b; - unsigned i; - mpz_inits (bs, a, b, NULL); - for (i = 0; i < COUNT; i++) - { - mpz_urandomb (bs, rands, 32); - mpz_rrandomb (a, rands, 1 + mpz_get_ui (bs) % BITSIZE); - mpz_urandomb (bs, rands, 32); - mpz_rrandomb (b, rands, 1 + mpz_get_ui (bs) % BITSIZE); - - check_funcs ("mul", alt_mul, mpz_mul, a, b); - } - mpz_clears (bs, a, b, NULL); -} - -#define MAX_SIZE 100 - -static void -check_roinit (void) -{ - gmp_randstate_ptr rands = RANDS; - mpz_t bs, a, b, r, ref; - unsigned i; - - mpz_inits (bs, a, b, r, ref, NULL); - - for (i = 0; i < COUNT; i++) - { - mp_srcptr ap, bp; - mp_size_t an, bn; - mpz_urandomb (bs, rands, 32); - mpz_rrandomb (a, rands, 1 + mpz_get_ui (bs) % BITSIZE); - mpz_urandomb (bs, rands, 32); - mpz_rrandomb (b, rands, 1 + mpz_get_ui (bs) % BITSIZE); - - an = mpz_size (a); - ap = mpz_limbs_read (a); - bn = mpz_size (b); - bp = mpz_limbs_read (b); - - mpz_add (ref, a, b); - { - mpz_t a1, b1; -#if __STDC_VERSION__ >= 199901 - const mpz_t a2 = MPZ_ROINIT_N ( (mp_ptr) ap, an); - const mpz_t b2 = MPZ_ROINIT_N ( (mp_ptr) bp, bn); - - mpz_set_ui (r, 0); - mpz_add (r, a2, b2); - if (mpz_cmp (r, ref) != 0) - { - printf ("MPZ_ROINIT_N failed\n"); - gmp_printf ("a = %Zx\n", a); - gmp_printf ("b = %Zx\n", b); - gmp_printf ("r = %Zx (bad)\n", r); - gmp_printf ("ref = %Zx\n", ref); - abort (); - } -#endif - mpz_set_ui (r, 0); - mpz_add (r, mpz_roinit_n (a1, ap, an), mpz_roinit_n (b1, bp, bn)); - if (mpz_cmp (r, ref) != 0) - { - printf ("mpz_roinit_n failed\n"); - gmp_printf ("a = %Zx\n", a); - gmp_printf ("b = %Zx\n", b); - gmp_printf ("r = %Zx (bad)\n", r); - gmp_printf ("ref = %Zx\n", ref); - abort (); - } - } - } - mpz_clears (bs, a, b, r, ref, NULL); -} - -int -main (int argc, char *argv[]) -{ - tests_start (); - tests_end (); - - check_add (); - check_mul (); - check_roinit (); - - return 0; - -} diff --git a/gmp/tests/mpz/t-lucnum_ui.c b/gmp/tests/mpz/t-lucnum_ui.c index 7cb734195b..83f0d93b40 100644 --- a/gmp/tests/mpz/t-lucnum_ui.c +++ b/gmp/tests/mpz/t-lucnum_ui.c @@ -2,20 +2,20 @@ Copyright 2001 Free Software Foundation, Inc. -This file is part of the GNU MP Library test suite. +This file is part of the GNU MP Library. -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU 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 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 test suite 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 General -Public License for more details. +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 General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ +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> @@ -35,7 +35,7 @@ void check_sequence (int argc, char *argv[]) { unsigned long n; - unsigned long limit = 100 * GMP_LIMB_BITS; + unsigned long limit = 100 * BITS_PER_MP_LIMB; mpz_t want_ln, want_ln1, got_ln, got_ln1; if (argc > 1 && argv[1][0] == 'x') diff --git a/gmp/tests/mpz/t-mfac_uiui.c b/gmp/tests/mpz/t-mfac_uiui.c deleted file mode 100644 index 7bf51a5dac..0000000000 --- a/gmp/tests/mpz/t-mfac_uiui.c +++ /dev/null @@ -1,136 +0,0 @@ -/* Exercise mpz_mfac_uiui. - -Copyright 2000-2002, 2012 Free Software Foundation, Inc. - -This file is part of the GNU MP Library test suite. - -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU 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 test suite 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 General -Public License for more details. - -You should have received a copy of the GNU General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ - -#include <stdio.h> -#include <stdlib.h> -#include "gmp.h" -#include "gmp-impl.h" -#include "tests.h" - - -/* Usage: t-mfac_uiui [x|num] - - With no arguments testing goes up to the initial value of "limit" below. - With a number argument tests are carried that far, or with a literal "x" - tests are continued without limit (this being meant only for development - purposes). */ - -#define MULTIFAC_WHEEL (2*3*11) -#define MULTIFAC_WHEEL2 (5*13) - -int -main (int argc, char *argv[]) -{ - mpz_t ref[MULTIFAC_WHEEL], ref2[MULTIFAC_WHEEL2], res; - unsigned long n, j, m, m2; - unsigned long limit = 2222, step = 1; - - tests_start (); - - if (argc > 1 && argv[1][0] == 'x') - limit = ULONG_MAX; - else if (argc > 1) - limit = atoi (argv[1]); - - /* for small limb testing */ - limit = MIN (limit, MP_LIMB_T_MAX); - - for (m = 0; m < MULTIFAC_WHEEL; m++) - mpz_init_set_ui(ref [m],1); - for (m2 = 0; m2 < MULTIFAC_WHEEL2; m2++) - mpz_init_set_ui(ref2 [m2],1); - - mpz_init (res); - - m = 0; - m2 = 0; - for (n = 0; n <= limit;) - { - mpz_mfac_uiui (res, n, MULTIFAC_WHEEL); - MPZ_CHECK_FORMAT (res); - if (mpz_cmp (ref[m], res) != 0) - { - printf ("mpz_mfac_uiui(%lu,%d) wrong\n", n, MULTIFAC_WHEEL); - printf (" got "); mpz_out_str (stdout, 10, res); printf("\n"); - printf (" want "); mpz_out_str (stdout, 10, ref[m]); printf("\n"); - abort (); - } - mpz_mfac_uiui (res, n, MULTIFAC_WHEEL2); - MPZ_CHECK_FORMAT (res); - if (mpz_cmp (ref2[m2], res) != 0) - { - printf ("mpz_mfac_uiui(%lu,%d) wrong\n", n, MULTIFAC_WHEEL2); - printf (" got "); mpz_out_str (stdout, 10, res); printf("\n"); - printf (" want "); mpz_out_str (stdout, 10, ref2[m2]); printf("\n"); - abort (); - } - if (n + step <= limit) - for (j = 0; j < step; j++) { - n++; m++; m2++; - if (m >= MULTIFAC_WHEEL) m -= MULTIFAC_WHEEL; - if (m2 >= MULTIFAC_WHEEL2) m2 -= MULTIFAC_WHEEL2; - mpz_mul_ui (ref[m], ref[m], n); /* Compute a reference, with current library */ - mpz_mul_ui (ref2[m2], ref2[m2], n); /* Compute a reference, with current library */ - } - else n += step; - } - mpz_fac_ui (ref[0], n); - mpz_mfac_uiui (res, n, 1); - MPZ_CHECK_FORMAT (res); - if (mpz_cmp (ref[0], res) != 0) - { - printf ("mpz_mfac_uiui(%lu,1) wrong\n", n); - printf (" got "); mpz_out_str (stdout, 10, res); printf("\n"); - printf (" want "); mpz_out_str (stdout, 10, ref[0]); printf("\n"); - abort (); - } - - mpz_2fac_ui (ref[0], n); - mpz_mfac_uiui (res, n, 2); - MPZ_CHECK_FORMAT (res); - if (mpz_cmp (ref[0], res) != 0) - { - printf ("mpz_mfac_uiui(%lu,1) wrong\n", n); - printf (" got "); mpz_out_str (stdout, 10, res); printf("\n"); - printf (" want "); mpz_out_str (stdout, 10, ref[0]); printf("\n"); - abort (); - } - - n++; - mpz_2fac_ui (ref[0], n); - mpz_mfac_uiui (res, n, 2); - MPZ_CHECK_FORMAT (res); - if (mpz_cmp (ref[0], res) != 0) - { - printf ("mpz_mfac_uiui(%lu,2) wrong\n", n); - printf (" got "); mpz_out_str (stdout, 10, res); printf("\n"); - printf (" want "); mpz_out_str (stdout, 10, ref[0]); printf("\n"); - abort (); - } - - for (m = 0; m < MULTIFAC_WHEEL; m++) - mpz_clear (ref[m]); - for (m2 = 0; m2 < MULTIFAC_WHEEL2; m2++) - mpz_clear (ref2[m2]); - mpz_clear (res); - - tests_end (); - - exit (0); -} diff --git a/gmp/tests/mpz/t-mul.c b/gmp/tests/mpz/t-mul.c index 690b89f7fd..fd8d4ec2b7 100644 --- a/gmp/tests/mpz/t-mul.c +++ b/gmp/tests/mpz/t-mul.c @@ -1,22 +1,22 @@ /* Test mpz_cmp, mpz_mul. -Copyright 1991, 1993, 1994, 1996, 1997, 2000-2004 Free Software Foundation, -Inc. +Copyright 1991, 1993, 1994, 1996, 1997, 2000, 2001, 2002, 2003, 2004 Free +Software Foundation, Inc. -This file is part of the GNU MP Library test suite. +This file is part of the GNU MP Library. -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU 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 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 test suite 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 General -Public License for more details. +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 General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ +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> @@ -26,9 +26,10 @@ the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ #include "longlong.h" #include "tests.h" -void debug_mp (mpz_t); -static void refmpz_mul (mpz_t, const mpz_t, const mpz_t); -void dump_abort (int, const char *, mpz_t, mpz_t, mpz_t, mpz_t); +void debug_mp __GMP_PROTO ((mpz_t)); +static void ref_mpn_mul __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t)); +static void ref_mpz_mul __GMP_PROTO ((mpz_t, const mpz_t, const mpz_t)); +void dump_abort __GMP_PROTO ((int, char *, mpz_t, mpz_t, mpz_t, mpz_t)); #define FFT_MIN_BITSIZE 100000 @@ -38,13 +39,15 @@ void one (int i, mpz_t multiplicand, mpz_t multiplier) { mpz_t product, ref_product; + mpz_t quotient; mpz_init (product); mpz_init (ref_product); + mpz_init (quotient); /* Test plain multiplication comparing results against reference code. */ mpz_mul (product, multiplier, multiplicand); - refmpz_mul (ref_product, multiplier, multiplicand); + ref_mpz_mul (ref_product, multiplier, multiplicand); if (mpz_cmp (product, ref_product)) dump_abort (i, "incorrect plain product", multiplier, multiplicand, product, ref_product); @@ -59,6 +62,7 @@ one (int i, mpz_t multiplicand, mpz_t multiplier) mpz_clear (product); mpz_clear (ref_product); + mpz_clear (quotient); } int @@ -137,7 +141,7 @@ main (int argc, char **argv) } static void -refmpz_mul (mpz_t w, const mpz_t u, const mpz_t v) +ref_mpz_mul (mpz_t w, const mpz_t u, const mpz_t v) { mp_size_t usize = u->_mp_size; mp_size_t vsize = v->_mp_size; @@ -165,9 +169,9 @@ refmpz_mul (mpz_t w, const mpz_t u, const mpz_t v) wp = __GMP_ALLOCATE_FUNC_LIMBS (talloc); if (usize > vsize) - refmpn_mul (wp, up, usize, vp, vsize); + ref_mpn_mul (wp, up, usize, vp, vsize); else - refmpn_mul (wp, vp, vsize, up, usize); + ref_mpn_mul (wp, vp, vsize, up, usize); wsize = usize + vsize; wsize -= wp[wsize - 1] == 0; MPZ_REALLOC (w, wsize); @@ -177,8 +181,123 @@ refmpz_mul (mpz_t w, const mpz_t u, const mpz_t v) __GMP_FREE_FUNC_LIMBS (wp, talloc); } +static void mul_basecase __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t)); + +#define TOOM3_THRESHOLD (MAX (MUL_TOOM3_THRESHOLD, SQR_TOOM3_THRESHOLD)) +#define FFT_THRESHOLD (MAX (MUL_FFT_THRESHOLD, SQR_FFT_THRESHOLD)) + +static void +ref_mpn_mul (mp_ptr wp, mp_srcptr up, mp_size_t un, mp_srcptr vp, mp_size_t vn) +{ + mp_ptr tp; + mp_size_t tn; + mp_limb_t cy; + + if (vn < TOOM3_THRESHOLD) + { + /* In the mpn_mul_basecase and mpn_kara_mul_n range, use our own + mul_basecase. */ + if (vn != 0) + mul_basecase (wp, up, un, vp, vn); + else + MPN_ZERO (wp, un); + return; + } + + if (vn < FFT_THRESHOLD) + { + /* In the mpn_toom3_mul_n range, use mpn_kara_mul_n. */ + tn = 2 * vn + MPN_KARA_MUL_N_TSIZE (vn); + tp = __GMP_ALLOCATE_FUNC_LIMBS (tn); + mpn_kara_mul_n (tp, up, vp, vn, tp + 2 * vn); + } + else + { + /* Finally, for the largest operands, use mpn_toom3_mul_n. */ + /* The "- 63 + 255" tweaks the allocation to allow for huge operands. + See the definition of this macro in gmp-impl.h to understand this. */ + tn = 2 * vn + MPN_TOOM3_MUL_N_TSIZE (vn) - 63 + 255; + tp = __GMP_ALLOCATE_FUNC_LIMBS (tn); + mpn_toom3_mul_n (tp, up, vp, vn, tp + 2 * vn); + } + + if (un != vn) + { + if (un - vn < vn) + ref_mpn_mul (wp + vn, vp, vn, up + vn, un - vn); + else + ref_mpn_mul (wp + vn, up + vn, un - vn, vp, vn); + + MPN_COPY (wp, tp, vn); + cy = mpn_add_n (wp + vn, wp + vn, tp + vn, vn); + mpn_incr_u (wp + 2 * vn, cy); + } + else + { + MPN_COPY (wp, tp, 2 * vn); + } + + __GMP_FREE_FUNC_LIMBS (tp, tn); +} + +static void +mul_basecase (mp_ptr wp, mp_srcptr up, mp_size_t un, mp_srcptr vp, mp_size_t vn) +{ + mp_size_t i, j; + mp_limb_t prod_low, prod_high; + mp_limb_t cy_dig; + mp_limb_t v_limb; + + /* Multiply by the first limb in V separately, as the result can + be stored (not added) to PROD. We also avoid a loop for zeroing. */ + v_limb = vp[0]; + cy_dig = 0; + for (j = un; j > 0; j--) + { + mp_limb_t u_limb, w_limb; + u_limb = *up++; + umul_ppmm (prod_high, prod_low, u_limb, v_limb << GMP_NAIL_BITS); + add_ssaaaa (cy_dig, w_limb, prod_high, prod_low, 0, cy_dig << GMP_NAIL_BITS); + *wp++ = w_limb >> GMP_NAIL_BITS; + } + + *wp++ = cy_dig; + wp -= un; + up -= un; + + /* For each iteration in the outer loop, multiply one limb from + U with one limb from V, and add it to PROD. */ + for (i = 1; i < vn; i++) + { + v_limb = vp[i]; + cy_dig = 0; + + for (j = un; j > 0; j--) + { + mp_limb_t u_limb, w_limb; + u_limb = *up++; + umul_ppmm (prod_high, prod_low, u_limb, v_limb << GMP_NAIL_BITS); + w_limb = *wp; + add_ssaaaa (prod_high, prod_low, prod_high, prod_low, 0, w_limb << GMP_NAIL_BITS); + prod_low >>= GMP_NAIL_BITS; + prod_low += cy_dig; +#if GMP_NAIL_BITS == 0 + cy_dig = prod_high + (prod_low < cy_dig); +#else + cy_dig = prod_high; + cy_dig += prod_low >> GMP_NUMB_BITS; +#endif + *wp++ = prod_low & GMP_NUMB_MASK; + } + + *wp++ = cy_dig; + wp -= un; + up -= un; + } +} + void -dump_abort (int i, const char *s, +dump_abort (int i, char *s, mpz_t op1, mpz_t op2, mpz_t product, mpz_t ref_product) { mp_size_t b, e; diff --git a/gmp/tests/mpz/t-mul_i.c b/gmp/tests/mpz/t-mul_i.c index cbbe54d40d..bf95a153ac 100644 --- a/gmp/tests/mpz/t-mul_i.c +++ b/gmp/tests/mpz/t-mul_i.c @@ -2,20 +2,20 @@ Copyright 2001, 2002 Free Software Foundation, Inc. -This file is part of the GNU MP Library test suite. +This file is part of the GNU MP Library. -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU 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 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 test suite 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 General -Public License for more details. +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 General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ +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> diff --git a/gmp/tests/mpz/t-nextprime.c b/gmp/tests/mpz/t-nextprime.c index 6e291c334d..1734f61496 100644 --- a/gmp/tests/mpz/t-nextprime.c +++ b/gmp/tests/mpz/t-nextprime.c @@ -2,20 +2,20 @@ Copyright 2009 Free Software Foundation, Inc. -This file is part of the GNU MP Library test suite. +This file is part of the GNU MP Library. -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU 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 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 test suite 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 General -Public License for more details. +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 General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ +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> @@ -34,7 +34,7 @@ refmpz_nextprime (mpz_ptr p, mpz_srcptr t) } void -run (const char *start, int reps, const char *end, short diffs[]) +run (char *start, int reps, char *end, short diffs[]) { mpz_t x, y; int i; diff --git a/gmp/tests/mpz/t-oddeven.c b/gmp/tests/mpz/t-oddeven.c index 107f2436ab..09e2c93871 100644 --- a/gmp/tests/mpz/t-oddeven.c +++ b/gmp/tests/mpz/t-oddeven.c @@ -2,20 +2,20 @@ Copyright 2000, 2001 Free Software Foundation, Inc. -This file is part of the GNU MP Library test suite. +This file is part of the GNU MP Library. -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU 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 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 test suite 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 General -Public License for more details. +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 General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ +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> diff --git a/gmp/tests/mpz/t-perfpow.c b/gmp/tests/mpz/t-perfpow.c index 72fe5c519d..aebe1b57b1 100644 --- a/gmp/tests/mpz/t-perfpow.c +++ b/gmp/tests/mpz/t-perfpow.c @@ -1,23 +1,21 @@ /* Test mpz_perfect_power_p. - Contributed to the GNU project by Torbjorn Granlund and Martin Boij. +Copyright 2008 Free Software Foundation, Inc. -Copyright 2008-2010 Free Software Foundation, Inc. +This file is part of the GNU MP Library. -This file is part of the GNU MP Library test suite. +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 test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU 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. -The GNU MP Library test suite 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 General -Public License for more details. - -You should have received a copy of the GNU General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ +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> @@ -28,7 +26,7 @@ the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ struct { - const char *num_as_str; + char *num_as_str; char want; } tests[] = { @@ -102,125 +100,44 @@ check_tests () mpz_clear (x); } -#define NRP 15 - void -check_random (int reps) +check_random (int n_tests) { - mpz_t n, np, temp, primes[NRP]; - int i, j, k, unique, destroy, res; - unsigned long int nrprimes, primebits; - mp_limb_t g, exp[NRP], e; + int test; + mpz_t bs, op1, op2, x; gmp_randstate_ptr rands; + unsigned long ex; rands = RANDS; - mpz_init (n); - mpz_init (np); - mpz_init (temp); - - for (i = 0; i < NRP; i++) - mpz_init (primes[i]); + mpz_init (bs); + mpz_init (op1); + mpz_init (op2); + mpz_init (x); - for (i = 0; i < reps; i++) + for (test = 0; test < n_tests; test++) { - mpz_urandomb (np, rands, 32); - nrprimes = mpz_get_ui (np) % NRP + 1; /* 1-NRP unique primes */ - - mpz_urandomb (np, rands, 32); - g = mpz_get_ui (np) % 32 + 2; /* gcd 2-33 */ - - for (j = 0; j < nrprimes;) - { - mpz_urandomb (np, rands, 32); - primebits = mpz_get_ui (np) % 100 + 3; /* 3-102 bit primes */ - mpz_urandomb (primes[j], rands, primebits); - mpz_nextprime (primes[j], primes[j]); - unique = 1; - for (k = 0; k < j; k++) - { - if (mpz_cmp (primes[j], primes[k]) == 0) - { - unique = 0; - break; - } - } - if (unique) - { - mpz_urandomb (np, rands, 32); - e = 371 / (10 * primebits) + mpz_get_ui (np) % 11 + 1; /* Magic constants */ - exp[j++] = g * e; - } - } - - if (nrprimes > 1) - { - /* Destroy d exponents, d in [1, nrprimes - 1] */ - if (nrprimes == 2) - { - destroy = 1; - } - else - { - mpz_urandomb (np, rands, 32); - destroy = mpz_get_ui (np) % (nrprimes - 2) + 1; - } - - g = exp[destroy]; - for (k = destroy + 1; k < nrprimes; k++) - g = mpn_gcd_1 (&g, 1, exp[k]); - - for (j = 0; j < destroy; j++) - { - mpz_urandomb (np, rands, 32); - e = mpz_get_ui (np) % 50 + 1; - while (mpn_gcd_1 (&g, 1, e) > 1) - e++; - - exp[j] = e; - } - } - - /* Compute n */ - mpz_pow_ui (n, primes[0], exp[0]); - for (j = 1; j < nrprimes; j++) - { - mpz_pow_ui (temp, primes[j], exp[j]); - mpz_mul (n, n, temp); - } + mpz_urandomb (bs, rands, 32); + mpz_rrandomb (op1, rands, mpz_get_ui (bs) % 32); + if (test & 1) + mpz_neg (op1, op1); + mpz_rrandomb (op2, rands, (mpz_get_ui (bs) >> 5) % 8); - res = mpz_perfect_power_p (n); + ex = mpz_get_ui (op2) + 2; + mpz_pow_ui (x, op1, ex); - if (nrprimes == 1) + if (! mpz_perfect_power_p (x)) { - if (res == 0 && exp[0] > 1) - { - printf("n is a perfect power, perfpow_p disagrees\n"); - gmp_printf("n = %Zu\nprimes[0] = %Zu\nexp[0] = %lu\n", n, primes[0], exp[0]); - abort (); - } - else if (res == 1 && exp[0] == 1) - { - gmp_printf("n = %Zu\n", n); - printf("n is now a prime number, but perfpow_p still believes n is a perfect power\n"); - abort (); - } - } - else - { - if (res == 1) - { - gmp_printf("n = %Zu\nn was destroyed, but perfpow_p still believes n is a perfect power\n", n); - abort (); - } + gmp_fprintf (stderr, "mpz_perfect_power_p rejects perfect power %Zd^%ld\n", op1, ex); + gmp_fprintf (stderr, "fault operand: %Zx\n", x); + abort (); } } - mpz_clear (n); - mpz_clear (np); - mpz_clear (temp); - for (i = 0; i < NRP; i++) - mpz_clear (primes[i]); + mpz_clear (bs); + mpz_clear (op1); + mpz_clear (op2); + mpz_clear (x); } int @@ -233,7 +150,7 @@ main (int argc, char **argv) check_tests (); - n_tests = 500; + n_tests = 100000; if (argc == 2) n_tests = atoi (argv[1]); check_random (n_tests); diff --git a/gmp/tests/mpz/t-perfsqr.c b/gmp/tests/mpz/t-perfsqr.c index 2a54e59e65..f5fa15bfaa 100644 --- a/gmp/tests/mpz/t-perfsqr.c +++ b/gmp/tests/mpz/t-perfsqr.c @@ -1,21 +1,21 @@ /* Test mpz_perfect_square_p. -Copyright 2000-2002 Free Software Foundation, Inc. +Copyright 2000, 2001, 2002 Free Software Foundation, Inc. -This file is part of the GNU MP Library test suite. +This file is part of the GNU MP Library. -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU 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 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 test suite 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 General -Public License for more details. +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 General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ +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> diff --git a/gmp/tests/mpz/t-popcount.c b/gmp/tests/mpz/t-popcount.c index c27c4efda9..da7487d606 100644 --- a/gmp/tests/mpz/t-popcount.c +++ b/gmp/tests/mpz/t-popcount.c @@ -2,20 +2,20 @@ Copyright 2001, 2005 Free Software Foundation, Inc. -This file is part of the GNU MP Library test suite. +This file is part of the GNU MP Library. -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU 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 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 test suite 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 General -Public License for more details. +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 General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ +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> @@ -32,7 +32,7 @@ check_onebit (void) unsigned long i, got; mpz_init (n); - for (i = 0; i < 5 * GMP_LIMB_BITS; i++) + for (i = 0; i < 5 * BITS_PER_MP_LIMB; i++) { mpz_setbit (n, i); got = mpz_popcount (n); @@ -84,7 +84,7 @@ check_data (void) printf (" 0x"); mpz_out_str (stdout, 16, n); printf ("\n"); printf (" got %lu\n", got); printf (" want %lu\n", data[i].want); - abort (); + abort(); } } mpz_clear (n); @@ -147,6 +147,7 @@ check_random (void) printf (" 0x"); mpz_out_str (stdout, 16, arg); printf ("\n"); printf (" got %lu\n", got); printf (" want %lu\n", ref); + abort(); abort (); } } diff --git a/gmp/tests/mpz/t-pow.c b/gmp/tests/mpz/t-pow.c index 312ef98884..d6373ea9af 100644 --- a/gmp/tests/mpz/t-pow.c +++ b/gmp/tests/mpz/t-pow.c @@ -1,21 +1,21 @@ /* Test mpz_pow_ui and mpz_ui_pow_ui. -Copyright 1997, 1999-2001 Free Software Foundation, Inc. +Copyright 1997, 1999, 2000, 2001 Free Software Foundation, Inc. -This file is part of the GNU MP Library test suite. +This file is part of the GNU MP Library. -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU 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 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 test suite 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 General -Public License for more details. +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 General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ +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> diff --git a/gmp/tests/mpz/t-powm.c b/gmp/tests/mpz/t-powm.c index 240e1c89b9..662080acfe 100644 --- a/gmp/tests/mpz/t-powm.c +++ b/gmp/tests/mpz/t-powm.c @@ -1,47 +1,31 @@ /* Test mpz_powm, mpz_mul, mpz_mod, mpz_mod_ui, mpz_div_ui. -Copyright 1991, 1993, 1994, 1996, 1999-2001, 2009, 2012 Free Software +Copyright 1991, 1993, 1994, 1996, 1999, 2000, 2001, 2009 Free Software Foundation, Inc. -This file is part of the GNU MP Library test suite. +This file is part of the GNU MP Library. -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU 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 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 test suite 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 General -Public License for more details. +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 General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ +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 <string.h> #include "gmp.h" #include "gmp-impl.h" #include "tests.h" -void debug_mp (mpz_t, int); - -#define SIZEM 13 - -/* Check that all sizes up to just above MUL_TOOM22_THRESHOLD have been tested - a few times. FIXME: If SIZEM is set too low, this will never happen. */ -int -allsizes_seen (unsigned int *allsizes) -{ - mp_size_t i; - - for (i = 1; i < MUL_TOOM22_THRESHOLD + 4; i++) - if (allsizes[i] < 4) - return 0; - return 1; -} +void debug_mp __GMP_PROTO ((mpz_t, int)); int main (int argc, char **argv) @@ -54,15 +38,15 @@ main (int argc, char **argv) gmp_randstate_ptr rands; mpz_t bs; unsigned long bsi, size_range; - unsigned int allsizes[1 << (SIZEM + 2 - 1)]; tests_start (); - TESTS_REPS (reps, argv, argc); - rands = RANDS; mpz_init (bs); + if (argc == 2) + reps = atoi (argv[1]); + mpz_init (base); mpz_init (exp); mpz_init (mod); @@ -72,12 +56,10 @@ main (int argc, char **argv) mpz_init (exp2); mpz_init (base2); - memset (allsizes, 0, (1 << (SIZEM + 2 - 1)) * sizeof (int)); - - for (i = 0; i < reps || ! allsizes_seen (allsizes); i++) + for (i = 0; i < reps; i++) { mpz_urandomb (bs, rands, 32); - size_range = mpz_get_ui (bs) % SIZEM + 2; + size_range = mpz_get_ui (bs) % 13 + 2; do /* Loop until mathematically well-defined. */ { @@ -99,8 +81,6 @@ main (int argc, char **argv) } while (mpz_cmp_ui (mod, 0) == 0); - allsizes[SIZ(mod)] += 1; - mpz_urandomb (bs, rands, 2); bsi = mpz_get_ui (bs); if ((bsi & 1) != 0) @@ -108,6 +88,9 @@ main (int argc, char **argv) /* printf ("%ld %ld %ld\n", SIZ (base), SIZ (exp), SIZ (mod)); */ + mpz_powm (r1, base, exp, mod); + MPZ_CHECK_FORMAT (r1); + mpz_set_ui (r2, 1); mpz_mod (base2, base, mod); mpz_set (exp2, exp); @@ -127,9 +110,6 @@ main (int argc, char **argv) mpz_tdiv_q_2exp (exp2, exp2, 1); } - mpz_powm (r1, base, exp, mod); - MPZ_CHECK_FORMAT (r1); - if (mpz_cmp (r1, r2) != 0) { fprintf (stderr, "\nIncorrect results in test %d for operands:\n", i); @@ -142,25 +122,6 @@ main (int argc, char **argv) debug_mp (r2, -16); abort (); } - - if (mpz_tdiv_ui (mod, 2) == 0) - continue; - - mpz_powm_sec (r1, base, exp, mod); - MPZ_CHECK_FORMAT (r1); - - if (mpz_cmp (r1, r2) != 0) - { - fprintf (stderr, "\nIncorrect results in test %d for operands:\n", i); - debug_mp (base, -16); - debug_mp (exp, -16); - debug_mp (mod, -16); - fprintf (stderr, "mpz_powm_sec result:\n"); - debug_mp (r1, -16); - fprintf (stderr, "reference result:\n"); - debug_mp (r2, -16); - abort (); - } } mpz_clear (bs); diff --git a/gmp/tests/mpz/t-powm_ui.c b/gmp/tests/mpz/t-powm_ui.c index a95e473c32..224e60481e 100644 --- a/gmp/tests/mpz/t-powm_ui.c +++ b/gmp/tests/mpz/t-powm_ui.c @@ -1,22 +1,22 @@ /* Test mpz_powm_ui, mpz_mul, mpz_mod. -Copyright 1991, 1993, 1994, 1996, 1997, 2000-2002, 2013 Free Software +Copyright 1991, 1993, 1994, 1996, 1997, 2000, 2001, 2002 Free Software Foundation, Inc. -This file is part of the GNU MP Library test suite. +This file is part of the GNU MP Library. -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU 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 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 test suite 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 General -Public License for more details. +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 General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ +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> @@ -25,6 +25,9 @@ the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ #include "gmp-impl.h" #include "tests.h" +void dump_abort __GMP_PROTO ((mpz_t, mpz_t)); +void debug_mp __GMP_PROTO ((mpz_t, int)); + int main (int argc, char **argv) { @@ -33,7 +36,7 @@ main (int argc, char **argv) mp_size_t base_size, exp_size, mod_size; unsigned long int exp2; int i; - int reps = 100; + int reps = 1000; gmp_randstate_ptr rands; mpz_t bs; unsigned long bsi, size_range; @@ -41,14 +44,22 @@ main (int argc, char **argv) tests_start (); rands = RANDS; - TESTS_REPS (reps, argv, argc); + mpz_init (bs); + + if (argc == 2) + reps = atoi (argv[1]); - mpz_inits (bs, base, exp, mod, r1, r2, base2, NULL); + mpz_init (base); + mpz_init (exp); + mpz_init (mod); + mpz_init (r1); + mpz_init (r2); + mpz_init (base2); for (i = 0; i < reps; i++) { mpz_urandomb (bs, rands, 32); - size_range = mpz_get_ui (bs) % 18 + 2; + size_range = mpz_get_ui (bs) % 13 + 2; do /* Loop until mathematically well-defined. */ { @@ -80,13 +91,16 @@ main (int argc, char **argv) #if 0 putc ('\n', stderr); - gmp_fprintf (stderr, "B = 0x%Zx\n", base); - gmp_fprintf (stderr, "M = 0x%Zx\n", mod); + debug_mp (base, -16); + debug_mp (mod, -16); #endif - exp2 = mpz_getlimbn (exp, (mp_size_t) 0); + mpz_powm_ui (r1, base, exp2, mod); + MPZ_CHECK_FORMAT (r1); + mpz_set_ui (r2, 1); mpz_set (base2, base); + mpz_mod (r2, r2, mod); /* needed when exp==0 and mod==1 */ while (exp2 != 0) { @@ -100,29 +114,48 @@ main (int argc, char **argv) exp2 = exp2 / 2; } - exp2 = mpz_getlimbn (exp, (mp_size_t) 0); - mpz_powm_ui (r1, base, exp2, mod); - MPZ_CHECK_FORMAT (r1); - #if 0 - gmp_fprintf (stderr, "R = 0x%Zx\n", r1); - gmp_fprintf (stderr, "REF = 0x%Zx\n", r2); + debug_mp (r1, -16); + debug_mp (r2, -16); #endif if (mpz_cmp (r1, r2) != 0) { fprintf (stderr, "\ntest %d: Incorrect results for operands:\n", i); - gmp_fprintf (stderr, "B = 0x%Zx\n", base); - gmp_fprintf (stderr, "E = 0x%Zx\n", exp); - gmp_fprintf (stderr, "M = 0x%Zx\n", mod); - gmp_fprintf (stderr, "R = 0x%Zx\n", r1); - gmp_fprintf (stderr, "REF = 0x%Zx\n", r2); + debug_mp (base, -16); + debug_mp (exp, -16); + debug_mp (mod, -16); + fprintf (stderr, "mpz_powm_ui result:\n"); + debug_mp (r1, -16); + fprintf (stderr, "reference result:\n"); + debug_mp (r2, -16); abort (); } } - mpz_clears (bs, base, exp, mod, r1, r2, base2, NULL); + mpz_clear (bs); + mpz_clear (base); + mpz_clear (exp); + mpz_clear (mod); + mpz_clear (r1); + mpz_clear (r2); + mpz_clear (base2); tests_end (); exit (0); } + +void +dump_abort (mpz_t dividend, mpz_t divisor) +{ + fprintf (stderr, "ERROR\n"); + fprintf (stderr, "dividend = "); debug_mp (dividend, -16); + fprintf (stderr, "divisor = "); debug_mp (divisor, -16); + abort(); +} + +void +debug_mp (mpz_t x, int base) +{ + mpz_out_str (stderr, base, x); fputc ('\n', stderr); +} diff --git a/gmp/tests/mpz/t-pprime_p.c b/gmp/tests/mpz/t-pprime_p.c index d437299e53..0907379681 100644 --- a/gmp/tests/mpz/t-pprime_p.c +++ b/gmp/tests/mpz/t-pprime_p.c @@ -2,20 +2,20 @@ Copyright 2002 Free Software Foundation, Inc. -This file is part of the GNU MP Library test suite. +This file is part of the GNU MP Library. -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU 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 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 test suite 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 General -Public License for more details. +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 General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ +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> @@ -101,89 +101,12 @@ check_small (void) mpz_clear (n); } -void -check_composites (int count) -{ - int i; - mpz_t a, b, n, bs; - unsigned long size_range, size; - gmp_randstate_ptr rands = RANDS; - - mpz_init (a); - mpz_init (b); - mpz_init (n); - mpz_init (bs); - - for (i = 0; i < count; i++) - { - mpz_urandomb (bs, rands, 32); - size_range = mpz_get_ui (bs) % 13 + 1; /* 0..8192 bit operands */ - - mpz_urandomb (bs, rands, size_range); - size = mpz_get_ui (bs); - mpz_rrandomb (a, rands, size); - - mpz_urandomb (bs, rands, 32); - size_range = mpz_get_ui (bs) % 13 + 1; /* 0..8192 bit operands */ - mpz_rrandomb (b, rands, size); - - /* Exclude trivial factors */ - if (mpz_cmp_ui (a, 1) == 0) - mpz_set_ui (a, 2); - if (mpz_cmp_ui (b, 1) == 0) - mpz_set_ui (b, 2); - - mpz_mul (n, a, b); - - check_pn (n, 0); - } - mpz_clear (a); - mpz_clear (b); - mpz_clear (n); - mpz_clear (bs); -} - -static void -check_primes (void) -{ - static const char * const primes[] = { - "2", "17", "65537", - /* diffie-hellman-group1-sha1, also "Well known group 2" in RFC - 2412, 2^1024 - 2^960 - 1 + 2^64 * { [2^894 pi] + 129093 } */ - "0xFFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1" - "29024E088A67CC74020BBEA63B139B22514A08798E3404DD" - "EF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245" - "E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED" - "EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE65381" - "FFFFFFFFFFFFFFFF", - NULL - }; - - mpz_t n; - int i; - - mpz_init (n); - - for (i = 0; primes[i]; i++) - { - mpz_set_str_or_abort (n, primes[i], 0); - check_one (n, 1); - } - mpz_clear (n); -} - int -main (int argc, char **argv) +main (void) { - int count = 1000; - - TESTS_REPS (count, argv, argc); - tests_start (); check_small (); - check_composites (count); - check_primes (); tests_end (); exit (0); diff --git a/gmp/tests/mpz/t-primorial_ui.c b/gmp/tests/mpz/t-primorial_ui.c deleted file mode 100644 index 253040ca1e..0000000000 --- a/gmp/tests/mpz/t-primorial_ui.c +++ /dev/null @@ -1,97 +0,0 @@ -/* Exercise mpz_primorial_ui. - -Copyright 2000-2002, 2012 Free Software Foundation, Inc. - -This file is part of the GNU MP Library test suite. - -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU 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 test suite 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 General -Public License for more details. - -You should have received a copy of the GNU General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ - -#include <stdio.h> -#include <stdlib.h> -#include "gmp.h" -#include "gmp-impl.h" -#include "tests.h" - - -/* Usage: t-primorial_ui [x|num] - - With no arguments testing goes up to the initial value of "limit" below. - With a number argument tests are carried that far, or with a literal "x" - tests are continued without limit (this being meant only for development - purposes). */ - -static int isprime (unsigned long int t); - -int -main (int argc, char *argv[]) -{ - unsigned long n; - unsigned long limit = 2222; - mpz_t f, r; - - tests_start (); - - if (argc > 1 && argv[1][0] == 'x') - limit = ULONG_MAX; - else if (argc > 1) - limit = atoi (argv[1]); - - /* for small limb testing */ - limit = MIN (limit, MP_LIMB_T_MAX); - - mpz_init_set_ui (f, 1); /* 0# = 1 */ - mpz_init (r); - - for (n = 0; n < limit; n++) - { - mpz_primorial_ui (r, n); - MPZ_CHECK_FORMAT (r); - - if (mpz_cmp (f, r) != 0) - { - printf ("mpz_primorial_ui(%lu) wrong\n", n); - printf (" got "); mpz_out_str (stdout, 10, r); printf("\n"); - printf (" want "); mpz_out_str (stdout, 10, f); printf("\n"); - abort (); - } - - if (isprime (n+1)) - mpz_mul_ui (f, f, n+1); /* p# = (p-1)# * (p) */ - } - - mpz_clear (f); - mpz_clear (r); - - tests_end (); - - exit (0); -} - -static int -isprime (unsigned long int t) -{ - unsigned long int q, r, d; - - if (t < 3 || (t & 1) == 0) - return t == 2; - - for (d = 3, r = 1; r != 0; d += 2) - { - q = t / d; - r = t - q * d; - if (q < d) - return 1; - } - return 0; -} diff --git a/gmp/tests/mpz/t-remove.c b/gmp/tests/mpz/t-remove.c deleted file mode 100644 index 4de74675fd..0000000000 --- a/gmp/tests/mpz/t-remove.c +++ /dev/null @@ -1,147 +0,0 @@ -/* Test mpz_remove. - -Copyright 1991, 1993, 1994, 1996, 1997, 2000, 2001, 2009, 2012, 2013 Free -Software Foundation, Inc. - -This file is part of the GNU MP Library test suite. - -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU 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 test suite 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 General -Public License for more details. - -You should have received a copy of the GNU General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ - -#include <stdio.h> -#include <stdlib.h> - -#include "gmp.h" -#include "gmp-impl.h" -#include "tests.h" - -void debug_mp (mpz_t); -unsigned long int mpz_refremove (mpz_t, const mpz_t, const mpz_t); - -int -main (int argc, char **argv) -{ - unsigned long int exp; - mpz_t t, dest, refdest, dividend, divisor; - mp_size_t dividend_size, divisor_size; - int i; - int reps = 1000; - unsigned long int pwr, refpwr; - gmp_randstate_ptr rands; - mpz_t bs; - unsigned long size_range; - - tests_start (); - rands = RANDS; - - if (argc == 2) - reps = atoi (argv[1]); - - mpz_inits (bs, t, dest, refdest, dividend, divisor, NULL); - - for (i = 0; i < reps; i++) - { - mpz_urandomb (bs, rands, 32); - size_range = mpz_get_ui (bs) % 18 + 1; /* 1..524288 bit operands */ - - do - { - mpz_urandomb (bs, rands, size_range); - divisor_size = mpz_get_ui (bs); - mpz_rrandomb (divisor, rands, divisor_size); - } - while (mpz_sgn (divisor) == 0); - - mpz_urandomb (bs, rands, size_range); - dividend_size = mpz_get_ui (bs) + divisor_size; - mpz_rrandomb (dividend, rands, dividend_size); - - mpz_urandomb (bs, rands, 32); - exp = mpz_get_ui (bs) % (5 + 10000 / mpz_sizeinbase (divisor, 2)); - if (mpz_get_ui (bs) & 2) - mpz_neg (divisor, divisor); - mpz_pow_ui (t, divisor, exp); - mpz_mul (dividend, dividend, t); - - refpwr = mpz_refremove (refdest, dividend, divisor); - pwr = mpz_remove (dest, dividend, divisor); - - if (refpwr != pwr || mpz_cmp (refdest, dest) != 0) - { - fprintf (stderr, "ERROR after %d tests\n", i); - fprintf (stderr, "refpower = %lu\n", refpwr); - fprintf (stderr, " power = %lu\n", pwr); - fprintf (stderr, " op1 = "); debug_mp (dividend); - fprintf (stderr, " op2 = "); debug_mp (divisor); - fprintf (stderr, "refdest = "); debug_mp (refdest); - fprintf (stderr, " dest = "); debug_mp (dest); - abort (); - } - } - - mpz_clears (bs, t, dest, refdest, dividend, divisor, NULL); - - tests_end (); - exit (0); -} - -unsigned long int -mpz_refremove (mpz_t dest, const mpz_t src, const mpz_t f) -{ - unsigned long int pwr; - - pwr = 0; - - mpz_set (dest, src); - if (mpz_cmpabs_ui (f, 1) > 0) - { - mpz_t rem, x; - - mpz_init (x); - mpz_init (rem); - - for (;; pwr++) - { - mpz_tdiv_qr (x, rem, dest, f); - if (mpz_cmp_ui (rem, 0) != 0) - break; - mpz_swap (dest, x); - } - - mpz_clear (x); - mpz_clear (rem); - } - - return pwr; -} - -void -debug_mp (mpz_t x) -{ - size_t siz = mpz_sizeinbase (x, 16); - - if (siz > 65) - { - mpz_t q; - mpz_init (q); - mpz_tdiv_q_2exp (q, x, 4 * (mpz_sizeinbase (x, 16) - 25)); - gmp_fprintf (stderr, "%ZX...", q); - mpz_tdiv_r_2exp (q, x, 4 * 25); - gmp_fprintf (stderr, "%025ZX [%d]\n", q, (int) siz); - mpz_clear (q); - } - else - { - gmp_fprintf (stderr, "%ZX\n", x); - } -} diff --git a/gmp/tests/mpz/t-root.c b/gmp/tests/mpz/t-root.c index 17efe4cca8..22fd31c7f8 100644 --- a/gmp/tests/mpz/t-root.c +++ b/gmp/tests/mpz/t-root.c @@ -2,20 +2,20 @@ Copyright 1991, 1993, 1994, 1996, 2000, 2001, 2009 Free Software Foundation, Inc. -This file is part of the GNU MP Library test suite. +This file is part of the GNU MP Library. -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU 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 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 test suite 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 General -Public License for more details. +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 General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ +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> @@ -24,7 +24,7 @@ the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ #include "gmp-impl.h" #include "tests.h" -void debug_mp (mpz_t, int); +void debug_mp __GMP_PROTO ((mpz_t, int)); void check_one (mpz_t root1, mpz_t x2, unsigned long nth, int i) @@ -49,7 +49,7 @@ check_one (mpz_t root1, mpz_t x2, unsigned long nth, int i) mpz_add (temp2, temp, rem2); /* Is power of result > argument? */ - if (mpz_cmp (root1, root2) != 0 || mpz_cmp (x2, temp2) != 0 || mpz_cmpabs (temp, x2) > 0) + if (mpz_cmp (root1, root2) != 0 || mpz_cmp (x2, temp2) != 0 || mpz_cmp (temp, x2) > 0) { fprintf (stderr, "ERROR after test %d\n", i); debug_mp (x2, 10); @@ -68,7 +68,7 @@ check_one (mpz_t root1, mpz_t x2, unsigned long nth, int i) abort (); } - if (nth <= 10000 && mpz_sgn(x2) > 0) /* skip too expensive test */ + if (nth <= 10000) /* skip too expensive test */ { mpz_add_ui (temp2, root1, 1L); mpz_pow_ui (temp2, temp2, nth); @@ -98,19 +98,20 @@ main (int argc, char **argv) mpz_t root1; mp_size_t x2_size; int i; - int reps = 500; + int reps = 5000; unsigned long nth; gmp_randstate_ptr rands; mpz_t bs; unsigned long bsi, size_range; tests_start (); - TESTS_REPS (reps, argv, argc); - rands = RANDS; mpz_init (bs); + if (argc == 2) + reps = atoi (argv[1]); + mpz_init (x2); mpz_init (root1); @@ -122,7 +123,7 @@ main (int argc, char **argv) for (i = 0; i < reps; i++) { mpz_urandomb (bs, rands, 32); - size_range = mpz_get_ui (bs) % 17 + 2; + size_range = mpz_get_ui (bs) % 12 + 2; mpz_urandomb (bs, rands, size_range); x2_size = mpz_get_ui (bs) + 10; @@ -150,13 +151,6 @@ main (int argc, char **argv) } check_one (root1, x2, nth, i); - - if (((nth & 1) != 0) && ((bsi & 2) != 0)) - { - mpz_neg (x2, x2); - mpz_neg (root1, root1); - check_one (root1, x2, nth, i); - } } mpz_clear (bs); diff --git a/gmp/tests/mpz/t-scan.c b/gmp/tests/mpz/t-scan.c index 95b896b1be..6598ed9639 100644 --- a/gmp/tests/mpz/t-scan.c +++ b/gmp/tests/mpz/t-scan.c @@ -1,21 +1,21 @@ /* Tests of mpz_scan0 and mpz_scan1. -Copyright 2000-2003 Free Software Foundation, Inc. +Copyright 2000, 2001, 2002, 2003 Free Software Foundation, Inc. -This file is part of the GNU MP Library test suite. +This file is part of the GNU MP Library. -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU 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 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 test suite 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 General -Public License for more details. +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 General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ +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> @@ -79,7 +79,7 @@ check_ref (void) for (isize = 0; isize <= size; isize++) { - for (oindex = 0; oindex < numberof (offset); oindex++) + for (oindex = 0; oindex <= numberof (offset); oindex++) { o = offset[oindex]; if ((int) isize*GMP_NUMB_BITS < -o) diff --git a/gmp/tests/mpz/t-set_d.c b/gmp/tests/mpz/t-set_d.c index d587e65442..c4d646dad1 100644 --- a/gmp/tests/mpz/t-set_d.c +++ b/gmp/tests/mpz/t-set_d.c @@ -1,21 +1,21 @@ /* Test mpz_set_d and mpz_init_set_d. -Copyright 2000-2003, 2006 Free Software Foundation, Inc. +Copyright 2000, 2001, 2002, 2003, 2006 Free Software Foundation, Inc. -This file is part of the GNU MP Library test suite. +This file is part of the GNU MP Library. -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU 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 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 test suite 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 General -Public License for more details. +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 General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ +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> diff --git a/gmp/tests/mpz/t-set_f.c b/gmp/tests/mpz/t-set_f.c index 38b5a2c438..764006fd32 100644 --- a/gmp/tests/mpz/t-set_f.c +++ b/gmp/tests/mpz/t-set_f.c @@ -2,20 +2,20 @@ Copyright 2001 Free Software Foundation, Inc. -This file is part of the GNU MP Library test suite. +This file is part of the GNU MP Library. -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU 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 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 test suite 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 General -Public License for more details. +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 General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ +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> @@ -28,7 +28,7 @@ void check_one (mpz_srcptr z) { static const int shift[] = { - 0, 1, GMP_LIMB_BITS, 2*GMP_LIMB_BITS, 5*GMP_LIMB_BITS + 0, 1, BITS_PER_MP_LIMB, 2*BITS_PER_MP_LIMB, 5*BITS_PER_MP_LIMB }; int sh, shneg, neg; @@ -101,10 +101,10 @@ check_various (void) mpz_set_si (z, 123L); check_one (z); - mpz_rrandomb (z, RANDS, 2*GMP_LIMB_BITS); + mpz_rrandomb (z, RANDS, 2*BITS_PER_MP_LIMB); check_one (z); - mpz_rrandomb (z, RANDS, 5*GMP_LIMB_BITS); + mpz_rrandomb (z, RANDS, 5*BITS_PER_MP_LIMB); check_one (z); mpz_clear (z); diff --git a/gmp/tests/mpz/t-set_si.c b/gmp/tests/mpz/t-set_si.c index b1e55ede33..7af40e1b72 100644 --- a/gmp/tests/mpz/t-set_si.c +++ b/gmp/tests/mpz/t-set_si.c @@ -1,21 +1,21 @@ /* Test mpz_set_si and mpz_init_set_si. -Copyright 2000-2002 Free Software Foundation, Inc. +Copyright 2000, 2001, 2002 Free Software Foundation, Inc. -This file is part of the GNU MP Library test suite. +This file is part of the GNU MP Library. -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU 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 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 test suite 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 General -Public License for more details. +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 General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ +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> diff --git a/gmp/tests/mpz/t-set_str.c b/gmp/tests/mpz/t-set_str.c index c6a59f2fed..cb589ca9da 100644 --- a/gmp/tests/mpz/t-set_str.c +++ b/gmp/tests/mpz/t-set_str.c @@ -2,20 +2,20 @@ Copyright 2001 Free Software Foundation, Inc. -This file is part of the GNU MP Library test suite. +This file is part of the GNU MP Library. -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU 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 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 test suite 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 General -Public License for more details. +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 General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ +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> @@ -25,7 +25,7 @@ the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ void -check_one (mpz_srcptr want, int fail, int base, const char *str) +check_one (mpz_srcptr want, int base, const char *str) { mpz_t got; @@ -34,7 +34,7 @@ check_one (mpz_srcptr want, int fail, int base, const char *str) mpz_init (got); - if (mpz_set_str (got, str, base) != fail) + if (mpz_set_str (got, str, base) != 0) { printf ("mpz_set_str unexpectedly failed\n"); printf (" base %d\n", base); @@ -43,7 +43,7 @@ check_one (mpz_srcptr want, int fail, int base, const char *str) } MPZ_CHECK_FORMAT (got); - if (fail == 0 && mpz_cmp (got, want) != 0) + if (mpz_cmp (got, want) != 0) { printf ("mpz_set_str wrong\n"); printf (" base %d\n", base); @@ -64,35 +64,21 @@ check_samples (void) mpz_init (z); mpz_set_ui (z, 0L); - check_one (z, 0, 0, "0 "); - check_one (z, 0, 0, " 0 0 0 "); - check_one (z, 0, 0, " -0B 0 "); - check_one (z, 0, 0, " 0X 0 "); - check_one (z, 0, 10, "0 "); - check_one (z, 0, 10, "-0 "); - check_one (z, 0, 10, " 0 000 000 "); + check_one (z, 0, "0 "); + check_one (z, 0, "0 "); + check_one (z, 10, "0 "); + check_one (z, 10, "0 "); + check_one (z, 10, "0000000 "); mpz_set_ui (z, 123L); - check_one (z, 0, 0, "123 "); - check_one (z, 0, 0, "123 "); - check_one (z, 0, 0, "0173 "); - check_one (z, 0, 0, " 0b 1 11 10 11 "); - check_one (z, 0, 0, " 0x 7b "); - check_one (z, 0, 0, "0x7B"); - check_one (z, 0, 10, "123 "); - check_one (z, 0, 10, "123 "); - check_one (z, 0, 0, " 123 "); - check_one (z, 0, 0, " 123 "); - check_one (z, 0, 10, " 0000123 "); - check_one (z, 0, 10, " 123 "); - check_one (z,-1, 10, "1%"); - check_one (z,-1, 0, "3!"); - check_one (z,-1, 0, "0123456789"); - check_one (z,-1, 0, "13579BDF"); - check_one (z,-1, 0, "0b0102"); - check_one (z,-1, 0, "0x010G"); - check_one (z,-1, 37,"0x010G"); - check_one (z,-1, 99,"0x010G"); + check_one (z, 0, "123 "); + check_one (z, 0, "123 "); + check_one (z, 10, "123 "); + check_one (z, 10, "123 "); + check_one (z, 0, " 123 "); + check_one (z, 0, " 123 "); + check_one (z, 10, " 0000123 "); + check_one (z, 10, " 123 "); mpz_clear (z); } diff --git a/gmp/tests/mpz/t-sizeinbase.c b/gmp/tests/mpz/t-sizeinbase.c index b5eab8846f..c9d0f6c98c 100644 --- a/gmp/tests/mpz/t-sizeinbase.c +++ b/gmp/tests/mpz/t-sizeinbase.c @@ -2,20 +2,20 @@ Copyright 2001, 2002 Free Software Foundation, Inc. -This file is part of the GNU MP Library test suite. +This file is part of the GNU MP Library. -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU 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 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 test suite 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 General -Public License for more details. +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 General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ +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> diff --git a/gmp/tests/mpz/t-sqrtrem.c b/gmp/tests/mpz/t-sqrtrem.c index 9aeb233890..976b9a6e09 100644 --- a/gmp/tests/mpz/t-sqrtrem.c +++ b/gmp/tests/mpz/t-sqrtrem.c @@ -1,21 +1,22 @@ /* Test mpz_add, mpz_add_ui, mpz_cmp, mpz_cmp, mpz_mul, mpz_sqrtrem. -Copyright 1991, 1993, 1994, 1996, 2000-2002 Free Software Foundation, Inc. +Copyright 1991, 1993, 1994, 1996, 2000, 2001, 2002 Free Software Foundation, +Inc. -This file is part of the GNU MP Library test suite. +This file is part of the GNU MP Library. -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU 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 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 test suite 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 General -Public License for more details. +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 General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ +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> @@ -24,8 +25,8 @@ the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ #include "gmp-impl.h" #include "tests.h" -void dump_abort (mpz_t, mpz_t, mpz_t); -void debug_mp (mpz_t, int); +void dump_abort __GMP_PROTO ((mpz_t, mpz_t, mpz_t)); +void debug_mp __GMP_PROTO ((mpz_t, int)); int main (int argc, char **argv) @@ -35,18 +36,19 @@ main (int argc, char **argv) mpz_t temp, temp2; mp_size_t x2_size; int i; - int reps = 1000; + int reps = 200000; gmp_randstate_ptr rands; mpz_t bs; unsigned long size_range; tests_start (); - TESTS_REPS (reps, argv, argc); - rands = RANDS; mpz_init (bs); + if (argc == 2) + reps = atoi (argv[1]); + mpz_init (x2); mpz_init (x); mpz_init (rem); @@ -56,7 +58,7 @@ main (int argc, char **argv) for (i = 0; i < reps; i++) { mpz_urandomb (bs, rands, 32); - size_range = mpz_get_ui (bs) % 17 + 2; /* 0..262144 bit operands */ + size_range = mpz_get_ui (bs) % 12 + 2; /* 0..8191 bit operands */ mpz_urandomb (bs, rands, size_range); x2_size = mpz_get_ui (bs); diff --git a/gmp/tests/mpz/t-tdiv.c b/gmp/tests/mpz/t-tdiv.c index 902b51c003..f9e2042a64 100644 --- a/gmp/tests/mpz/t-tdiv.c +++ b/gmp/tests/mpz/t-tdiv.c @@ -3,20 +3,20 @@ Copyright 1991, 1993, 1994, 1996, 1997, 2000, 2001 Free Software Foundation, Inc. -This file is part of the GNU MP Library test suite. +This file is part of the GNU MP Library. -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU 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 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 test suite 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 General -Public License for more details. +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 General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ +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> @@ -25,8 +25,8 @@ the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ #include "gmp-impl.h" #include "tests.h" -void dump_abort (mpz_t, mpz_t); -void debug_mp (mpz_t, int); +void dump_abort __GMP_PROTO ((mpz_t, mpz_t)); +void debug_mp __GMP_PROTO ((mpz_t, int)); int main (int argc, char **argv) @@ -43,12 +43,13 @@ main (int argc, char **argv) unsigned long bsi, size_range; tests_start (); - TESTS_REPS (reps, argv, argc); - rands = RANDS; mpz_init (bs); + if (argc == 2) + reps = atoi (argv[1]); + mpz_init (dividend); mpz_init (divisor); mpz_init (quotient); @@ -60,7 +61,7 @@ main (int argc, char **argv) for (i = 0; i < reps; i++) { mpz_urandomb (bs, rands, 32); - size_range = mpz_get_ui (bs) % 18 + 2; /* 0..524288 bit operands */ + size_range = mpz_get_ui (bs) % 16 + 2; /* 0..131071 bit operands */ do { diff --git a/gmp/tests/mpz/t-tdiv_ui.c b/gmp/tests/mpz/t-tdiv_ui.c index db266eb9d0..8ceaac1e7c 100644 --- a/gmp/tests/mpz/t-tdiv_ui.c +++ b/gmp/tests/mpz/t-tdiv_ui.c @@ -1,22 +1,22 @@ /* Test mpz_abs, mpz_add, mpz_cmp, mpz_cmp_ui, mpz_tdiv_qr_ui, mpz_tdiv_q_ui, mpz_tdiv_r_ui, mpz_tdiv_ui, mpz_mul_ui. -Copyright 1993, 1994, 1996, 2000-2002 Free Software Foundation, Inc. +Copyright 1993, 1994, 1996, 2000, 2001, 2002 Free Software Foundation, Inc. -This file is part of the GNU MP Library test suite. +This file is part of the GNU MP Library. -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU 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 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 test suite 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 General -Public License for more details. +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 General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ +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> @@ -25,8 +25,8 @@ the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ #include "gmp-impl.h" #include "tests.h" -void dump_abort (const char *, mpz_t, unsigned long); -void debug_mp (mpz_t, int); +void dump_abort __GMP_PROTO ((char *, mpz_t, unsigned long)); +void debug_mp __GMP_PROTO ((mpz_t, int)); int main (int argc, char **argv) @@ -144,7 +144,7 @@ main (int argc, char **argv) } void -dump_abort (const char *str, mpz_t dividend, unsigned long divisor) +dump_abort (char *str, mpz_t dividend, unsigned long divisor) { fprintf (stderr, "ERROR: %s\n", str); fprintf (stderr, "dividend = "); debug_mp (dividend, -16); |