[flint] 02/03: Make fmpz_invmod behave like mpz_invert

Julien Puydt julien.puydt at laposte.net
Mon Aug 11 08:36:41 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 7266a720ae80afd0aeefb35eaa7ba31f1ab8a45e
Author: Jannis Harder <jix at jixco.de>
Date:   Tue Jun 24 21:19:13 2014 +0200

    Make fmpz_invmod behave like mpz_invert
    
    The fmpz_invmod behaviour now mirrors the GMP version used.
    This fixes the tests when compling against GMP 6.
---
 fmpz/invmod.c | 4 ++++
 1 file changed, 4 insertions(+)

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);

-- 
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