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 | 69bd3194dacd9be7bdf72da959b6a88d10f77dd7 (patch) | |
tree | 9b74bdaee380fc446c6bcad4ea63cea6b81bdc3c /dev-libs | |
parent | m68k stable (diff) | |
download | gentoo-2-69bd3194dacd9be7bdf72da959b6a88d10f77dd7.tar.gz gentoo-2-69bd3194dacd9be7bdf72da959b6a88d10f77dd7.tar.bz2 gentoo-2-69bd3194dacd9be7bdf72da959b6a88d10f77dd7.zip |
Grab fixes from upstream.
(Portage version: 2.2_rc23/cvs/Linux x86_64)
Diffstat (limited to 'dev-libs')
-rw-r--r-- | dev-libs/gmp/ChangeLog | 6 | ||||
-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 |
4 files changed, 514 insertions, 1 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/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; |