[flint] 06/06: Use a better patch to handle GMP >= 6
Julien Puydt
julien.puydt at laposte.net
Sat Aug 9 09:26:37 UTC 2014
This is an automated email from the git hooks/post-receive script.
jpuydt-guest pushed a commit to branch master
in repository flint.
commit 90b70c2cce0b4d6018172db5b1aabfe7577397ec
Author: Julien Puydt <julien.puydt at laposte.net>
Date: Sat Aug 9 09:48:17 2014 +0200
Use a better patch to handle GMP >= 6
---
...-Disable-a-test-that-fails-with-GMP-6.0.0.patch | 26 -------------------
debian/patches/handle_all_gmp_versions.patch | 30 ++++++++++++++++++++++
debian/patches/series | 2 +-
fmpz/invmod.c | 4 +++
fmpz/test/t-invmod.c | 3 +--
5 files changed, 36 insertions(+), 29 deletions(-)
diff --git a/debian/patches/0001-Description-Disable-a-test-that-fails-with-GMP-6.0.0.patch b/debian/patches/0001-Description-Disable-a-test-that-fails-with-GMP-6.0.0.patch
deleted file mode 100644
index 8a51b17..0000000
--- a/debian/patches/0001-Description-Disable-a-test-that-fails-with-GMP-6.0.0.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-From a8280e6099abd71422ab7c3278f455b1901cccf8 Mon Sep 17 00:00:00 2001
-From: Julien Puydt <julien.puydt at laposte.net>
-Date: Fri, 23 May 2014 22:05:29 +0200
-Subject: =?UTF-8?q?Description:=20Disable=20a=20test=20that=20fails=20with?=
- =?UTF-8?q?=20GMP=20>=3D=206.0.0=20(making=20it=20possible=20to=20build=20?=
- =?UTF-8?q?with=20it)=0AForwarded:=20not-needed?=
-
----
- fmpz/test/t-invmod.c | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/fmpz/test/t-invmod.c b/fmpz/test/t-invmod.c
-index aea236e..a0040e4 100644
---- a/fmpz/test/t-invmod.c
-+++ b/fmpz/test/t-invmod.c
-@@ -36,8 +36,9 @@ main(void)
- int i, result;
- FLINT_TEST_INIT(state);
-
-- flint_printf("invmod....");
-+ flint_printf("invmod.... (disabled)");
- fflush(stdout);
-+ return 0;
-
-
-
diff --git a/debian/patches/handle_all_gmp_versions.patch b/debian/patches/handle_all_gmp_versions.patch
new file mode 100644
index 0000000..ea5b8eb
--- /dev/null
+++ b/debian/patches/handle_all_gmp_versions.patch
@@ -0,0 +1,30 @@
+Description: Make the invmod code handle all GMP versions
+Author: user jix on github
+Forwarded: William Hart said he would put it in the next release
+
+diff --git a/fmpz/invmod.c b/fmpz/invmod.c
+index a0cf601..0c692d4 100644
+--- a/fmpz/invmod.c
++++ b/fmpz/invmod.c
+@@ -66,8 +66,10 @@ fmpz_invmod(fmpz_t f, const fmpz_t g, const fmpz_t h)
+ ulong inv, gcd;
+ if (c2 < WORD(0))
+ c2 = -c2;
++#if __GNU_MP_VERSION < 6
+ if (c2 == WORD(1))
+ return 0; /* special case not handled by n_invmod */
++#endif
+ gcd = z_gcdinv(&inv, c1, c2);
+
+ return (gcd == UWORD(1) ? fmpz_set_si(f, inv), 1 : 0);
+@@ -105,8 +107,10 @@ fmpz_invmod(fmpz_t f, const fmpz_t g, const fmpz_t h)
+ ulong gcd, inv, r;
+ if (c2 < WORD(0))
+ c2 = -c2;
++#if __GNU_MP_VERSION < 6
+ if (c2 == WORD(1))
+ return 0; /* special case not handled by z_gcd_invert */
++#endif
+ /* reduce g mod h first */
+
+ r = flint_mpz_fdiv_ui(COEFF_TO_PTR(c1), c2);
diff --git a/debian/patches/series b/debian/patches/series
index 78b7e3a..a1c2f3a 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1 @@
-0001-Description-Disable-a-test-that-fails-with-GMP-6.0.0.patch
+handle_all_gmp_versions.patch
diff --git a/fmpz/invmod.c b/fmpz/invmod.c
index a0cf601..0c692d4 100644
--- a/fmpz/invmod.c
+++ b/fmpz/invmod.c
@@ -66,8 +66,10 @@ fmpz_invmod(fmpz_t f, const fmpz_t g, const fmpz_t h)
ulong inv, gcd;
if (c2 < WORD(0))
c2 = -c2;
+#if __GNU_MP_VERSION < 6
if (c2 == WORD(1))
return 0; /* special case not handled by n_invmod */
+#endif
gcd = z_gcdinv(&inv, c1, c2);
return (gcd == UWORD(1) ? fmpz_set_si(f, inv), 1 : 0);
@@ -105,8 +107,10 @@ fmpz_invmod(fmpz_t f, const fmpz_t g, const fmpz_t h)
ulong gcd, inv, r;
if (c2 < WORD(0))
c2 = -c2;
+#if __GNU_MP_VERSION < 6
if (c2 == WORD(1))
return 0; /* special case not handled by z_gcd_invert */
+#endif
/* 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 a0040e4..aea236e 100644
--- a/fmpz/test/t-invmod.c
+++ b/fmpz/test/t-invmod.c
@@ -36,9 +36,8 @@ main(void)
int i, result;
FLINT_TEST_INIT(state);
- flint_printf("invmod.... (disabled)");
+ flint_printf("invmod....");
fflush(stdout);
- return 0;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/flint.git
More information about the debian-science-commits
mailing list