diff options
author | Mike Frysinger <vapier@gentoo.org> | 2009-02-21 22:06:16 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2009-02-21 22:06:16 +0000 |
commit | c07f3b22c8fcb032de7b1e15d630512f99c05a06 (patch) | |
tree | 0f0ee1a99a15a0f770f4e4caa0f7f9b6b58457ec /dev-libs/gmp | |
parent | m68k stable (diff) | |
download | historical-c07f3b22c8fcb032de7b1e15d630512f99c05a06.tar.gz historical-c07f3b22c8fcb032de7b1e15d630512f99c05a06.tar.bz2 historical-c07f3b22c8fcb032de7b1e15d630512f99c05a06.zip |
Grab fixes from upstream.
Package-Manager: portage-2.2_rc23/cvs/Linux x86_64
Diffstat (limited to 'dev-libs/gmp')
-rw-r--r-- | dev-libs/gmp/ChangeLog | 6 | ||||
-rw-r--r-- | dev-libs/gmp/Manifest | 23 | ||||
-rw-r--r-- | dev-libs/gmp/files/4.2.4/mpf_eq.diff | 308 | ||||
-rw-r--r-- | dev-libs/gmp/files/4.2.4/mpf_set_str.c.4.diff | 32 | ||||
-rw-r--r-- | dev-libs/gmp/files/4.2.4/perfpow.c.diff | 169 |
5 files changed, 529 insertions, 9 deletions
diff --git a/dev-libs/gmp/ChangeLog b/dev-libs/gmp/ChangeLog index 25b23d3f99d2..e5b4d8d0e03b 100644 --- a/dev-libs/gmp/ChangeLog +++ b/dev-libs/gmp/ChangeLog @@ -1,6 +1,10 @@ # ChangeLog for dev-libs/gmp # Copyright 1999-2009 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/dev-libs/gmp/ChangeLog,v 1.111 2009/02/06 16:13:20 armin76 Exp $ +# $Header: /var/cvsroot/gentoo-x86/dev-libs/gmp/ChangeLog,v 1.112 2009/02/21 22:06:16 vapier Exp $ + + 21 Feb 2009; Mike Frysinger <vapier@gentoo.org> +files/4.2.4/mpf_eq.diff, + +files/4.2.4/mpf_set_str.c.4.diff, +files/4.2.4/perfpow.c.diff: + Grab fixes from upstream. 06 Feb 2009; Raúl Porcel <armin76@gentoo.org> gmp-4.2.4.ebuild: arm/ia64/s390/sh/sparc stable wrt #255703 diff --git a/dev-libs/gmp/Manifest b/dev-libs/gmp/Manifest index 1cd639d766ac..97104cfc5608 100644 --- a/dev-libs/gmp/Manifest +++ b/dev-libs/gmp/Manifest @@ -1,13 +1,20 @@ -AUX 4.2.2/mpf_set_str.c.diff 1062 RMD160 455375f049ff8ef809e796441ec7a83ec648287b SHA1 8e5133ec2dbf4c19738faf90f8df5343cf2533f1 SHA256 245601a618cc7fd52e11495ace7d5183dc4822eb7e8089bb5175ec519fc786cd +-----BEGIN PGP SIGNED MESSAGE----- +Hash: SHA1 + +AUX 4.2.4/mpf_eq.diff 9252 RMD160 52036e74d5d118db1fd0ad844ba871249fdbaefc SHA1 5fe6dd4dba6574baf3db8f3d2a16fbd73dc295e1 SHA256 8d82a1ce2e891e689da2cad1d4536090b7cd73b1201cb431b53f721f7485771f +AUX 4.2.4/mpf_set_str.c.4.diff 860 RMD160 03015e15518bdd5887d09f8b3fb12f9c8d2b4beb SHA1 b14fc8b7644183e021406f05b5e168589d9acd1d SHA256 57d84908888f71e6cb282fce869b588bcd1051aa779cc692a62496d50ed3df58 +AUX 4.2.4/perfpow.c.diff 4335 RMD160 92f72686e91a9224bc743080dafbc501a8421e01 SHA1 e8602c1d481016e4e92d74441310ec5f1cefde83 SHA256 3a097f48b62d3b9f377df82c6cae7ea46191818c355d4dade89eaef1a14defeb AUX gmp-4.1.4-noexecstack.patch 474 RMD160 22aa94eded1650432202b93a79900be1c85a779b SHA1 fd7ca0feb59aa319ba30bdbc71b7796a0a457d76 SHA256 68601777151a1628d7bc839eddd037685c5d2e76c9453166890a5eb3cf6000c3 AUX gmp-4.2.1-s390.diff 1848 RMD160 04eecb2aaae4c444841e40b33abd38a662254632 SHA1 38ba90ffd6cd9d66e07c5f71b4608e3ad9d32a6b SHA256 13c6b01e71534af2c353d79b7afd171f158b8fa6e3299e0f7c0335e516ce67ec -AUX gmp-4.2.2-ABI-multilib.patch 12425 RMD160 b30e1a237252663199457f5f020de7fb81118e2a SHA1 d716749bad6f7996f6862bc8468eb2c7b6c89c42 SHA256 deac10a8fd120e3b8d2a566c5babfea3cf7e6ecf6cc234fe7787b4ffecacb521 -AUX gmp-4.2.2-cstdio-stdfile.patch 263 RMD160 53e172ee3824899f765eee3ea8a042ac59b18b7e SHA1 5c8ec47a99c2652c466df3b9a281852c59fc3565 SHA256 469816f18dc19de304e932304c78f01f54b8960b98dd27bd10a984a0f515e733 AUX gmp-4.2.3-ABI-multilib.patch 12456 RMD160 d225bac7ea2d152bfecf8ce3b887b35a70f09eb4 SHA1 8b9ec5d278db0d1c925c8eff337126c4f9986547 SHA256 5656454b0330686984e012129c0d5889ab9d161e514d69de34b5a2eaa7383d6a -DIST gmp-4.2.2.tar.bz2 1747068 RMD160 4021720f78b02244197c0c49522289e7fe81aad9 SHA1 8c5f9798956f9b0162a25a56477a3566a92abc72 SHA256 2b2c0aacafa2dc41f4604b381349d49596921e38a58bf782b0d70b33f548657b DIST gmp-4.2.4.tar.bz2 1710660 RMD160 15c6c40c377088a3bcf9d432bcc27c777991cb12 SHA1 bb721f94fbeeb8c609104540b408da6707c370ec SHA256 5420b0e558a69a53b36f2b2c70a69f547e075d98366a585fc80cbbcce1efe368 -DIST gmp-man-4.2.2.pdf 1002466 RMD160 20b37f581d5c993fcc3e092123d5554efc8b2a81 SHA1 706dfd027e208b089f95bf9ff494d298dfa5b4b7 SHA256 44a5dcfbf1bef54c5244e2a1960c479e18b9740849daffb844472c60bc8e962c -EBUILD gmp-4.2.2-r2.ebuild 2116 RMD160 a218a7d342b4741df1fe685558fcd061a4d6fd76 SHA1 d228c5901c10a98a412f3b278fd9fca113781f35 SHA256 b98d3505f6f53db1ab1cce702ceb0aa6054f7f2c15d031673d381e90dfff054c -EBUILD gmp-4.2.4.ebuild 2075 RMD160 87014379b1e37c88255d01b78d11cc2fb633fbf9 SHA1 3de1266cdd418f5abb5367f5715f29aff3c95d9d SHA256 5ec8bcf2741a6d225430c6ebacd91192ad472a8e708698fba48c2a0bd1c03cdd -MISC ChangeLog 14887 RMD160 0b4945cbf5897bd8f079babf4af6d29ca0ffaa71 SHA1 7acff2d536b63bd8d836c2d84dd59d617a8ef699 SHA256 f4a63a3ae8be4a5f2a011ce5fded4de567c23a88b8074171f4d6540b2c2479a9 +EBUILD gmp-4.2.4.ebuild 2073 RMD160 31473b5a0825b9a2aacade71a20dc87ae3be6b27 SHA1 b6337e0a67968bca81487a2231612f2559d84c8d SHA256 5facb82c69681fa4cd1259aaa5542c5d9e30c07b4e1925a7e7f3631d5ec73ed3 +MISC ChangeLog 15057 RMD160 3b4d404987829107c7c0c459608bc4295d17bf01 SHA1 78e86d1ce719b45b2b51a79d41c6b81962d58443 SHA256 9e0ba2016ca3cb211481d012dff9b3f219d9221e35dae3a36b822f487fbbc4eb MISC metadata.xml 162 RMD160 d002486a43522f2116b1d9d59828c484956d66e2 SHA1 d6b4923897f6ae673b4f93646f5b4ba61d5a2c3c SHA256 65a915d44de1f01d4b7f72d313b4192c38374a9835d24988c00c1e73dca5805a +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v2.0.9 (GNU/Linux) + +iEYEARECAAYFAkmget0ACgkQn/5bYzqsSmGE8ACgr2HhGuZyhs+rV/wE+VHqpy/p +NboAoMtE4yCJCCtwQq5NVMJEdJeq3IcS +=U2qx +-----END PGP SIGNATURE----- diff --git a/dev-libs/gmp/files/4.2.4/mpf_eq.diff b/dev-libs/gmp/files/4.2.4/mpf_eq.diff new file mode 100644 index 000000000000..5510cb852685 --- /dev/null +++ b/dev-libs/gmp/files/4.2.4/mpf_eq.diff @@ -0,0 +1,308 @@ +Index: doc/gmp.texi +=================================================================== +RCS file: /home/cvsfiles/gmp42/doc/gmp.texi,v +retrieving revision 1.25 +retrieving revision 1.28 +diff -p -2 -r1.25 -r1.28 +*** doc/gmp.texi 18 Sep 2008 15:36:28 -0000 1.25 +--- doc/gmp.texi 8 Nov 2008 23:38:20 -0000 1.28 +*************** equal, zero otherwise. I.e., test if @v +*** 4850,4856 **** + equal. + +! Caution: Currently only whole limbs are compared, and only in an exact +! fashion. In the future values like 1000 and 0111 may be considered the same +! to 3 bits (on the basis that their difference is that small). + @end deftypefun + +--- 4850,4859 ---- + equal. + +! Caution 1: All version of GMP up to version 4.2.4 compared just whole limbs, +! meaning sometimes more than @var{op3} bits, sometimes fewer. +! +! Caution 2: This function will consider XXX11...111 and XX100...000 different, +! even if ... is replaced by a semi-infinite number of bits. Such numbers are +! really just one ulp off, and should be considered equal. + @end deftypefun + +Index: mpf/eq.c +=================================================================== +RCS file: /home/cvsfiles/gmp42/mpf/eq.c,v +retrieving revision 1.2 +retrieving revision 1.5 +diff -p -2 -r1.2 -r1.5 +*** mpf/eq.c 30 Aug 2007 18:19:40 -0000 1.2 +--- mpf/eq.c 8 Nov 2008 23:31:18 -0000 1.5 +*************** +*** 1,5 **** + /* mpf_eq -- Compare two floats up to a specified bit #. + +! Copyright 1993, 1995, 1996, 2001, 2002 Free Software Foundation, Inc. + + This file is part of the GNU MP Library. +--- 1,5 ---- + /* mpf_eq -- Compare two floats up to a specified bit #. + +! Copyright 1993, 1995, 1996, 2001, 2002, 2008 Free Software Foundation, Inc. + + This file is part of the GNU MP Library. +*************** along with the GNU MP Library. If not, +*** 20,23 **** +--- 20,24 ---- + #include "gmp.h" + #include "gmp-impl.h" ++ #include "longlong.h" + + int +*************** mpf_eq (mpf_srcptr u, mpf_srcptr v, unsi +*** 27,30 **** +--- 28,33 ---- + mp_size_t usize, vsize, size, i; + mp_exp_t uexp, vexp; ++ mp_limb_t diff; ++ int cnt; + + uexp = u->_mp_exp; +*************** mpf_eq (mpf_srcptr u, mpf_srcptr v, unsi +*** 54,61 **** + + /* 2. Are the exponents different? */ +! if (uexp > vexp) +! return 0; /* ??? handle (uexp = vexp + 1) */ +! if (vexp > uexp) +! return 0; /* ??? handle (vexp = uexp + 1) */ + + usize = ABS (usize); +--- 57,62 ---- + + /* 2. Are the exponents different? */ +! if (uexp != vexp) +! return 0; + + usize = ABS (usize); +*************** mpf_eq (mpf_srcptr u, mpf_srcptr v, unsi +*** 94,104 **** + } + +! if (size > (n_bits + GMP_NUMB_BITS - 1) / GMP_NUMB_BITS) +! size = (n_bits + GMP_NUMB_BITS - 1) / GMP_NUMB_BITS; + +! up += usize - size; +! vp += vsize - size; + +! for (i = size - 1; i >= 0; i--) + { + if (up[i] != vp[i]) +--- 95,113 ---- + } + +! up += usize; /* point just above most significant limb */ +! vp += vsize; /* point just above most significant limb */ + +! count_leading_zeros (cnt, up[-1]); +! if ((vp[-1] >> (GMP_LIMB_BITS - 1 - cnt)) != 1) +! return 0; /* msb positions different */ + +! n_bits += cnt - GMP_NAIL_BITS; +! +! size = MIN (size, (n_bits + GMP_NUMB_BITS - 1) / GMP_NUMB_BITS); +! +! up -= size; /* point at least significant relevant limb */ +! vp -= size; /* point at least significant relevant limb */ +! +! for (i = size - 1; i > 0; i--) + { + if (up[i] != vp[i]) +*************** mpf_eq (mpf_srcptr u, mpf_srcptr v, unsi +*** 106,109 **** + } + +! return 1; + } +--- 115,119 ---- + } + +! diff = (up[0] ^ vp[0]) >> GMP_NUMB_BITS - 1 - (n_bits - 1) % GMP_NUMB_BITS; +! return diff == 0; + } +Index: tests/cxx/t-prec.cc +=================================================================== +RCS file: /home/cvsfiles/gmp42/tests/cxx/t-prec.cc,v +retrieving revision 1.4 +retrieving revision 1.5 +diff -p -2 -r1.4 -r1.5 +*** tests/cxx/t-prec.cc 30 Aug 2007 23:14:40 -0000 1.4 +--- tests/cxx/t-prec.cc 8 Nov 2008 23:33:02 -0000 1.5 +*************** +*** 1,5 **** + /* Test precision of mpf_class expressions. + +! Copyright 2001, 2002, 2003 Free Software Foundation, Inc. + + This file is part of the GNU MP Library. +--- 1,5 ---- + /* Test precision of mpf_class expressions. + +! Copyright 2001, 2002, 2003, 2008 Free Software Foundation, Inc. + + This file is part of the GNU MP Library. +*************** check_mpf (void) +*** 62,66 **** + ASSERT_ALWAYS_PREC + (g, "0.11111 11111 11111 11111 11111 11111 11111 11111 11111 11111" +! " 11111 11111 11111 11111 11111 11", very_large_prec); + } + { +--- 62,66 ---- + ASSERT_ALWAYS_PREC + (g, "0.11111 11111 11111 11111 11111 11111 11111 11111 11111 11111" +! " 11111 11111 11111 11111 11111 111", very_large_prec); + } + { +*************** check_mpf (void) +*** 70,74 **** + ASSERT_ALWAYS_PREC + (g, "0.06666 66666 66666 66666 66666 66666 66666 66666 66666 66666" +! " 66666 66666 66666 66666 66666 67", very_large_prec); + } + +--- 70,74 ---- + ASSERT_ALWAYS_PREC + (g, "0.06666 66666 66666 66666 66666 66666 66666 66666 66666 66666" +! " 66666 66666 66666 66666 66666 667", very_large_prec); + } + +*************** check_mpf (void) +*** 95,99 **** + ASSERT_ALWAYS_PREC + (i, "15.33333 33333 33333 33333 33333 33333 33333 33333 33333 33333" +! " 33333 33333 33333 333", very_large_prec); + } + { +--- 95,99 ---- + ASSERT_ALWAYS_PREC + (i, "15.33333 33333 33333 33333 33333 33333 33333 33333 33333 33333" +! " 33333 33333 33333 33333 33333 3", very_large_prec); + } + { +*************** check_mpf (void) +*** 102,106 **** + ASSERT_ALWAYS_PREC + (g, "-1.33333 33333 33333 33333 33333 33333 33333 33333 33333 33333" +! " 33333 33333 33333 333", very_large_prec); + } + { +--- 102,106 ---- + ASSERT_ALWAYS_PREC + (g, "-1.33333 33333 33333 33333 33333 33333 33333 33333 33333 33333" +! " 33333 33333 33333 33333 33333 33", very_large_prec); + } + { +*************** check_mpf (void) +*** 118,122 **** + ASSERT_ALWAYS_PREC + (g, "1.66666 66666 66666 66666 66666 66666 66666 66666 66666 66666" +! " 66666 66666 66666 667", very_large_prec); + } + +--- 118,122 ---- + ASSERT_ALWAYS_PREC + (g, "1.66666 66666 66666 66666 66666 66666 66666 66666 66666 66666" +! " 66666 66666 66666 66666 66666 67", very_large_prec); + } + +*************** check_mpf (void) +*** 143,147 **** + g = mpf_class(1 / f); + ASSERT_ALWAYS_PREC +! (g, "0.11111 11111 11111 11111 11111 11111 11111 111", medium_prec); + } + { +--- 143,147 ---- + g = mpf_class(1 / f); + ASSERT_ALWAYS_PREC +! (g, "0.11111 11111 11111 11111 11111 11111 11111 1111", medium_prec); + } + { +*************** check_mpf (void) +*** 151,155 **** + ASSERT_ALWAYS_PREC + (g, "0.06666 66666 66666 66666 66666 66666 66666 66666 66666 66666" +! " 66666 667", large_prec); + } + +--- 151,155 ---- + ASSERT_ALWAYS_PREC + (g, "0.06666 66666 66666 66666 66666 66666 66666 66666 66666 66666" +! " 66666 6667", large_prec); + } + +*************** check_mpf (void) +*** 159,163 **** + h = mpf_class(f / g + 1, large_prec); + ASSERT_ALWAYS_PREC +! (h, "1.33333 33333 33333 33333 33333 33333 33333 33333 33333 3333", + large_prec); + } +--- 159,164 ---- + h = mpf_class(f / g + 1, large_prec); + ASSERT_ALWAYS_PREC +! (h, "1.33333 33333 33333 33333 33333 33333 33333 33333 33333 33333" +! " 33333 333", + large_prec); + } +*************** check_mpf (void) +*** 171,175 **** + ASSERT_ALWAYS_PREC + (g, "2.66666 66666 66666 66666 66666 66666 66666 66666 66666 66666" +! " 66666 66666 66666 667", very_large_prec); + } + +--- 172,176 ---- + ASSERT_ALWAYS_PREC + (g, "2.66666 66666 66666 66666 66666 66666 66666 66666 66666 66666" +! " 66666 66666 66666 66666 66666 67", very_large_prec); + } + +*************** check_mpf (void) +*** 180,184 **** + g = mpf_class(f - q, large_prec); + ASSERT_ALWAYS_PREC +! (g, "2.66666 66666 66666 66666 66666 66666 66666 66666 66666 6667", + large_prec); + } +--- 181,186 ---- + g = mpf_class(f - q, large_prec); + ASSERT_ALWAYS_PREC +! (g, "2.66666 66666 66666 66666 66666 66666 66666 66666 66666 66666" +! " 66666 667", + large_prec); + } +*************** check_mpf (void) +*** 189,193 **** + g = mpf_class(f - q); + ASSERT_ALWAYS_PREC +! (g, "2.66666 66666 66666 66666 66666 6667", medium_prec); + } + { +--- 191,195 ---- + g = mpf_class(f - q); + ASSERT_ALWAYS_PREC +! (g, "2.66666 66666 66666 66666 66666 66666 66666 667", medium_prec); + } + { +*************** check_mpf (void) +*** 197,201 **** + g = mpf_class(f + q); + ASSERT_ALWAYS_PREC +! (g, "15.33333 33333 33333 33333 33333 33333 33333 33333 33333 3333", + large_prec); + } +--- 199,204 ---- + g = mpf_class(f + q); + ASSERT_ALWAYS_PREC +! (g, "15.33333 33333 33333 33333 33333 33333 33333 33333 33333 33333" +! " 33333 33", + large_prec); + } diff --git a/dev-libs/gmp/files/4.2.4/mpf_set_str.c.4.diff b/dev-libs/gmp/files/4.2.4/mpf_set_str.c.4.diff new file mode 100644 index 000000000000..287ee585b281 --- /dev/null +++ b/dev-libs/gmp/files/4.2.4/mpf_set_str.c.4.diff @@ -0,0 +1,32 @@ +Index: mpf/set_str.c +=================================================================== +RCS file: /home/cvsfiles/gmp42/mpf/set_str.c,v +retrieving revision 1.6 +retrieving revision 1.7 +diff -p -2 -r1.6 -r1.7 +*** mpf/set_str.c 25 Aug 2008 14:13:11 -0000 1.6 +--- mpf/set_str.c 9 Nov 2008 00:28:18 -0000 1.7 +*************** mpf_set_str (mpf_ptr x, const char *str, +*** 138,142 **** +--- 138,147 ---- + } + ++ /* Default base to decimal. */ ++ if (base == 0) ++ base = 10; ++ + exp_base = base; ++ + if (base < 0) + { +*************** mpf_set_str (mpf_ptr x, const char *str, +*** 166,173 **** + } + +- /* Default base to decimal. */ +- if (base == 0) +- base = 10; +- + /* Locate exponent part of the input. Look from the right of the string, + since the exponent is usually a lot shorter than the mantissa. */ +--- 171,174 ---- diff --git a/dev-libs/gmp/files/4.2.4/perfpow.c.diff b/dev-libs/gmp/files/4.2.4/perfpow.c.diff new file mode 100644 index 000000000000..4c55678147a8 --- /dev/null +++ b/dev-libs/gmp/files/4.2.4/perfpow.c.diff @@ -0,0 +1,169 @@ +Copyright 1998, 1999, 2000, 2001, 2005, 2008 Free Software Foundation, Inc. + +This file is part of the GNU MP Library. + +The GNU MP Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MP Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. + +Index: mpz/perfpow.c +=================================================================== +RCS file: /home/cvsfiles/gmp42/mpz/perfpow.c,v +retrieving revision 1.2 +retrieving revision 1.3 +diff -p -2 -r1.2 -r1.3 +*** mpz/perfpow.c 30 Aug 2007 18:19:44 -0000 1.2 +--- mpz/perfpow.c 26 Dec 2008 19:46:24 -0000 1.3 +*************** +*** 2,6 **** + zero otherwise. + +! Copyright 1998, 1999, 2000, 2001, 2005 Free Software Foundation, Inc. + + This file is part of the GNU MP Library. +--- 2,6 ---- + zero otherwise. + +! Copyright 1998, 1999, 2000, 2001, 2005, 2008 Free Software Foundation, Inc. + + This file is part of the GNU MP Library. +*************** static const unsigned short primes[] = +*** 60,63 **** +--- 60,65 ---- + + ++ #define POW2P(a) (((a) & ((a) - 1)) == 0) ++ + int + mpz_perfect_power_p (mpz_srcptr u) +*************** mpz_perfect_power_p (mpz_srcptr u) +*** 73,78 **** + TMP_DECL; + +! if (usize == 0) +! return 1; /* consider 0 a perfect power */ + + n2 = mpz_scan1 (u, 0); +--- 75,80 ---- + TMP_DECL; + +! if (mpz_cmpabs_ui (u, 1) <= 0) +! return 1; /* -1, 0, and +1 are perfect powers */ + + n2 = mpz_scan1 (u, 0); +*************** mpz_perfect_power_p (mpz_srcptr u) +*** 80,86 **** + return 0; /* 2 divides exactly once. */ + +- if (n2 != 0 && (n2 & 1) == 0 && usize < 0) +- return 0; /* 2 has even multiplicity with negative U */ +- + TMP_MARK; + +--- 82,85 ---- +*************** mpz_perfect_power_p (mpz_srcptr u) +*** 90,93 **** +--- 89,100 ---- + + mpz_tdiv_q_2exp (u2, u, n2); ++ mpz_abs (u2, u2); ++ ++ if (mpz_cmp_ui (u2, 1) == 0) ++ { ++ TMP_FREE; ++ /* factoring completed; consistent power */ ++ return ! (usize < 0 && POW2P(n2)); ++ } + + if (isprime (n2)) +*************** mpz_perfect_power_p (mpz_srcptr u) +*** 98,101 **** +--- 105,111 ---- + prime = primes[i]; + ++ if (mpz_cmp_ui (u2, prime) < 0) ++ break; ++ + if (mpz_divisible_ui_p (u2, prime)) /* divisible by this prime? */ + { +*************** mpz_perfect_power_p (mpz_srcptr u) +*** 116,125 **** + } + +- if ((n & 1) == 0 && usize < 0) +- { +- TMP_FREE; +- return 0; /* even multiplicity with negative U, reject */ +- } +- + n2 = gcd (n2, n); + if (n2 == 1) +--- 126,129 ---- +*************** mpz_perfect_power_p (mpz_srcptr u) +*** 129,136 **** + } + +! if (mpz_cmpabs_ui (u2, 1) == 0) + { + TMP_FREE; +! return 1; /* factoring completed; consistent power */ + } + +--- 133,141 ---- + } + +! if (mpz_cmp_ui (u2, 1) == 0) + { + TMP_FREE; +! /* factoring completed; consistent power */ +! return ! (usize < 0 && POW2P(n2)); + } + +*************** mpz_perfect_power_p (mpz_srcptr u) +*** 170,173 **** +--- 175,182 ---- + { + unsigned long int nth; ++ ++ if (usize < 0 && POW2P(n2)) ++ return 0; ++ + /* We found some factors above. We just need to consider values of n + that divides n2. */ +*************** mpz_perfect_power_p (mpz_srcptr u) +*** 185,190 **** + if (exact) + { +! TMP_FREE; +! return 1; + } + if (mpz_cmp_ui (q, SMALLEST_OMITTED_PRIME) < 0) +--- 194,202 ---- + if (exact) + { +! if (! (usize < 0 && POW2P(nth))) +! { +! TMP_FREE; +! return 1; +! } + } + if (mpz_cmp_ui (q, SMALLEST_OMITTED_PRIME) < 0) +*************** mpz_perfect_power_p (mpz_srcptr u) +*** 200,203 **** +--- 212,218 ---- + + n2prime: ++ if (usize < 0 && POW2P(n2)) ++ return 0; ++ + exact = mpz_root (NULL, u2, n2); + TMP_FREE; |