[Gmp-commit] /var/hg/gmp: mini-gmp/tests/t-root.c: Use mpz_ui_pow_ui, when ba...
mercurial at gmplib.org
mercurial at gmplib.org
Sat Jan 12 16:53:51 CET 2013
details: /var/hg/gmp/rev/f56b9aa645e5
changeset: 15263:f56b9aa645e5
user: Marco Bodrato <bodrato at mail.dm.unipi.it>
date: Sat Jan 12 16:36:20 2013 +0100
description:
mini-gmp/tests/t-root.c: Use mpz_ui_pow_ui, when base fits an ui.
diffstat:
ChangeLog | 2 ++
mini-gmp/tests/t-root.c | 7 +++++--
2 files changed, 7 insertions(+), 2 deletions(-)
diffs (35 lines):
diff -r ff47d4b1f1f2 -r f56b9aa645e5 ChangeLog
--- a/ChangeLog Sat Jan 12 13:03:04 2013 +0100
+++ b/ChangeLog Sat Jan 12 16:36:20 2013 +0100
@@ -12,6 +12,8 @@
* mini-gmp/mini-gmp.c (mpz_set_si, mpz_cmp_si): Simplify by using
the _ui variant.
+
+ * mini-gmp/tests/t-root.c: Use mpz_ui_pow_ui, when base fits an ui.
2013-01-10 Marco Bodrato <bodrato at mail.dm.unipi.it>
diff -r ff47d4b1f1f2 -r f56b9aa645e5 mini-gmp/tests/t-root.c
--- a/mini-gmp/tests/t-root.c Sat Jan 12 13:03:04 2013 +0100
+++ b/mini-gmp/tests/t-root.c Sat Jan 12 16:36:20 2013 +0100
@@ -1,6 +1,6 @@
/*
-Copyright 2012, Free Software Foundation, Inc.
+Copyright 2012, 2013 Free Software Foundation, Inc.
This file is part of the GNU MP Library test suite.
@@ -41,7 +41,10 @@
mpz_t t;
mpz_init (t);
- mpz_pow_ui (t, s, z);
+ if (mpz_fits_ulong_p (s))
+ mpz_ui_pow_ui (t, mpz_get_ui (s), z);
+ else
+ mpz_pow_ui (t, s, z);
mpz_sub (t, u, t);
if (mpz_sgn (t) != mpz_sgn(u) || mpz_cmp (t, r) != 0)
{
More information about the gmp-commit
mailing list