[Gmp-commit] /var/hg/gmp-proj/mini-gmp: mpz_gcd_ui: return value in g iif != ...
mercurial at gmplib.org
mercurial at gmplib.org
Thu Jan 12 08:27:34 CET 2012
details: /var/hg/gmp-proj/mini-gmp/rev/e6a42a9149a0
changeset: 65:e6a42a9149a0
user: Marco Bodrato <bodrato at mail.dm.unipi.it>
date: Thu Jan 12 08:27:28 2012 +0100
description:
mpz_gcd_ui: return value in g iif != NULL.
diffstat:
mini-gmp.c | 15 ++++++++-------
1 files changed, 8 insertions(+), 7 deletions(-)
diffs (36 lines):
diff -r 88847f9b41b6 -r e6a42a9149a0 mini-gmp.c
--- a/mini-gmp.c Wed Jan 11 23:29:06 2012 +0100
+++ b/mini-gmp.c Thu Jan 12 08:27:28 2012 +0100
@@ -44,7 +44,6 @@
mpz_lcm_ui
mpz_scan0
mpz_scan1.
- mpz_ui_sub
*/
#include <assert.h>
@@ -2381,16 +2380,18 @@
{
if (g)
mpz_abs (g, u);
- return 0;
}
- un = GMP_ABS (u->_mp_size);
- if (un == 0)
+ else
{
- mpz_set_ui (g, v);
- return v;
+ un = GMP_ABS (u->_mp_size);
+ if (un != 0)
+ v = mpn_gcd_11 (mpn_div_qr_1 (NULL, u->_mp_d, un, v), v);
+
+ if (g)
+ mpz_set_ui (g, v);
}
- return mpn_gcd_11 (mpn_div_qr_1 (NULL, u->_mp_d, un, v), v);
+ return v;
}
static mp_bitcnt_t
More information about the gmp-commit
mailing list