summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Kahle <tomka@gentoo.org>2015-04-03 10:03:43 +0000
committerThomas Kahle <tomka@gentoo.org>2015-04-03 10:03:43 +0000
commit2f50ca506cd1058302fcf03dbacc7539c6e062f5 (patch)
treef3ac26158538f3570c314152a7bf8b9b96a2175c /sci-mathematics
parentkeyword arm/arm64, tested on cortex-a9/cortex-a53 hardware (diff)
downloadgentoo-2-2f50ca506cd1058302fcf03dbacc7539c6e062f5.tar.gz
gentoo-2-2f50ca506cd1058302fcf03dbacc7539c6e062f5.tar.bz2
gentoo-2-2f50ca506cd1058302fcf03dbacc7539c6e062f5.zip
Fix tests with gmp-6 (bug 545378)
(Portage version: 2.2.14/cvs/Linux x86_64, signed Manifest commit with key 565C32BC)
Diffstat (limited to 'sci-mathematics')
-rw-r--r--sci-mathematics/flint/ChangeLog6
-rw-r--r--sci-mathematics/flint/files/flint-2.4.5-gmp6-compat.patch115
-rw-r--r--sci-mathematics/flint/flint-2.4.5.ebuild5
3 files changed, 123 insertions, 3 deletions
diff --git a/sci-mathematics/flint/ChangeLog b/sci-mathematics/flint/ChangeLog
index 8881e00b9f47..1541422fc069 100644
--- a/sci-mathematics/flint/ChangeLog
+++ b/sci-mathematics/flint/ChangeLog
@@ -1,6 +1,10 @@
# ChangeLog for sci-mathematics/flint
# Copyright 1999-2015 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/sci-mathematics/flint/ChangeLog,v 1.12 2015/04/03 06:29:57 patrick Exp $
+# $Header: /var/cvsroot/gentoo-x86/sci-mathematics/flint/ChangeLog,v 1.13 2015/04/03 10:03:43 tomka Exp $
+
+ 03 Apr 2015; Thomas Kahle <tomka@gentoo.org>
+ +files/flint-2.4.5-gmp6-compat.patch, flint-2.4.5.ebuild:
+ Fix tests with gmp-6 (bug 545378)
03 Apr 2015; Patrick Lauer <patrick@gentoo.org> flint-2.4.5.ebuild:
Restrict ntl dep #545318
diff --git a/sci-mathematics/flint/files/flint-2.4.5-gmp6-compat.patch b/sci-mathematics/flint/files/flint-2.4.5-gmp6-compat.patch
new file mode 100644
index 000000000000..559cbe51fb28
--- /dev/null
+++ b/sci-mathematics/flint/files/flint-2.4.5-gmp6-compat.patch
@@ -0,0 +1,115 @@
+From a7f911140e7d0a0125653a40aa2c5fe257bd78f5 Mon Sep 17 00:00:00 2001
+From: Fredrik Johansson <fredrik.johansson@gmail.com>
+Date: Thu, 18 Sep 2014 14:49:05 +0200
+Subject: [PATCH] redefine fmpz_invmod to consider any integer invertible mod 1
+ (for gmp 6.0 compatibility)
+
+---
+ fmpz/doc/fmpz.txt | 3 ++-
+ fmpz/invmod.c | 11 +++++++++--
+ fmpz/test/t-invmod.c | 21 +++++++++++++++++----
+ 3 files changed, 28 insertions(+), 7 deletions(-)
+
+diff --git a/fmpz/doc/fmpz.txt b/fmpz/doc/fmpz.txt
+index fb422d8..2ada719 100644
+--- a/fmpz/doc/fmpz.txt
++++ b/fmpz/doc/fmpz.txt
+@@ -899,7 +899,8 @@ int fmpz_invmod(fmpz_t f, const fmpz_t g, const fmpz_t h)
+ Sets $f$ to the inverse of $g$ modulo $h$. The value of $h$ may
+ not be $0$ otherwise an exception results. If the inverse exists
+ the return value will be non-zero, otherwise the return value will
+- be $0$ and the value of $f$ undefined.
++ be $0$ and the value of $f$ undefined. As a special case, we
++ consider any number invertible modulo $h = \pm 1$, with inverse 0.
+
+ void fmpz_negmod(fmpz_t f, const fmpz_t g, const fmpz_t h)
+
+diff --git a/fmpz/invmod.c b/fmpz/invmod.c
+index a0cf601..0e20f39 100644
+--- a/fmpz/invmod.c
++++ b/fmpz/invmod.c
+@@ -67,7 +67,11 @@ fmpz_invmod(fmpz_t f, const fmpz_t g, const fmpz_t h)
+ if (c2 < WORD(0))
+ c2 = -c2;
+ if (c2 == WORD(1))
+- return 0; /* special case not handled by n_invmod */
++ {
++ fmpz_zero(f);
++ return 1; /* special case not handled by n_invmod */
++ }
++
+ gcd = z_gcdinv(&inv, c1, c2);
+
+ return (gcd == UWORD(1) ? fmpz_set_si(f, inv), 1 : 0);
+@@ -106,7 +110,10 @@ fmpz_invmod(fmpz_t f, const fmpz_t g, const fmpz_t h)
+ if (c2 < WORD(0))
+ c2 = -c2;
+ if (c2 == WORD(1))
+- return 0; /* special case not handled by z_gcd_invert */
++ {
++ fmpz_zero(f);
++ return 1; /* special case not handled by z_gcd_invert */
++ }
+ /* reduce g mod h first */
+
+ r = flint_mpz_fdiv_ui(COEFF_TO_PTR(c1), c2);
+diff --git a/fmpz/test/t-invmod.c b/fmpz/test/t-invmod.c
+index aea236e..8ff1c7f 100644
+--- a/fmpz/test/t-invmod.c
++++ b/fmpz/test/t-invmod.c
+@@ -30,6 +30,19 @@
+ #include "ulong_extras.h"
+ #include "fmpz.h"
+
++/* Use the definiton of GMP versions >= 6.0 */
++int
++mpz_invert2(mpz_t a, const mpz_t b, const mpz_t c)
++{
++ if (mpz_cmpabs_ui(c, 1) == 0)
++ {
++ mpz_set_ui(a, 0);
++ return 1;
++ }
++ else
++ return mpz_invert(a, b, c);
++}
++
+ int
+ main(void)
+ {
+@@ -63,7 +76,7 @@ main(void)
+ fmpz_get_mpz(e, b);
+
+ r1 = fmpz_invmod(c, a, b);
+- r2 = mpz_invert(f, d, e);
++ r2 = mpz_invert2(f, d, e);
+
+ fmpz_get_mpz(g, c);
+
+@@ -106,7 +119,7 @@ main(void)
+ fmpz_get_mpz(d, a);
+
+ r1 = fmpz_invmod(c, a, a);
+- r2 = mpz_invert(f, d, d);
++ r2 = mpz_invert2(f, d, d);
+
+ fmpz_get_mpz(g, c);
+
+@@ -149,7 +162,7 @@ main(void)
+ fmpz_get_mpz(e, b);
+
+ r1 = fmpz_invmod(a, a, b);
+- r2 = mpz_invert(f, d, e);
++ r2 = mpz_invert2(f, d, e);
+
+ fmpz_get_mpz(g, a);
+
+@@ -192,7 +205,7 @@ main(void)
+ fmpz_get_mpz(e, b);
+
+ r1 = fmpz_invmod(b, a, b);
+- r2 = mpz_invert(f, d, e);
++ r2 = mpz_invert2(f, d, e);
+
+ fmpz_get_mpz(g, b);
+
diff --git a/sci-mathematics/flint/flint-2.4.5.ebuild b/sci-mathematics/flint/flint-2.4.5.ebuild
index 9546fcfe7328..76fe6e9fb607 100644
--- a/sci-mathematics/flint/flint-2.4.5.ebuild
+++ b/sci-mathematics/flint/flint-2.4.5.ebuild
@@ -1,6 +1,6 @@
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sci-mathematics/flint/flint-2.4.5.ebuild,v 1.2 2015/04/03 06:29:57 patrick Exp $
+# $Header: /var/cvsroot/gentoo-x86/sci-mathematics/flint/flint-2.4.5.ebuild,v 1.3 2015/04/03 10:03:43 tomka Exp $
EAPI="5"
@@ -31,7 +31,8 @@ src_prepare() {
epatch "${FILESDIR}"/${PN}-2.4.3-libdir.patch \
"${FILESDIR}"/${PN}-2.4.3-whitespaces.patch \
"${FILESDIR}"/${PN}-2.4.3-cflags-ldflags.patch \
- "${FILESDIR}"/${PN}-2.4.4-test.patch
+ "${FILESDIR}"/${PN}-2.4.4-test.patch \
+ "${FILESDIR}"/${PN}-2.4.5-gmp6-compat.patch
}
src_configure() {