[Gmp-commit] /var/hg/gmp: 2 new changesets
mercurial at gmplib.org
mercurial at gmplib.org
Sun Oct 30 18:16:06 UTC 2016
details: /var/hg/gmp/rev/83f0363b194e
changeset: 17085:83f0363b194e
user: Torbjorn Granlund <tg at gmplib.org>
date: Mon Oct 24 23:41:57 2016 +0200
description:
Recognise Itanium Poulson.
details: /var/hg/gmp/rev/56c5f7d560f1
changeset: 17086:56c5f7d560f1
user: Torbjorn Granlund <tg at gmplib.org>
date: Sun Oct 30 19:16:04 2016 +0100
description:
Trivial merge.
diffstat:
ChangeLog | 5 +++++
config.guess | 3 ++-
gmpxx.h | 29 +++++++++++++++++++++++++++--
tests/cxx/t-ops.cc | 10 ++++++++++
4 files changed, 44 insertions(+), 3 deletions(-)
diffs (91 lines):
diff -r d2b8c42756bb -r 56c5f7d560f1 ChangeLog
--- a/ChangeLog Sat Oct 15 14:07:20 2016 +0200
+++ b/ChangeLog Sun Oct 30 19:16:04 2016 +0100
@@ -1,3 +1,8 @@
+2016-10-28 Marc Glisse <marc.glisse at inria.fr>
+
+ * gmpxx.h (__gmp_binary_divides): Let 1/q call mpq_inv.
+ * tests/cxx/t-ops.cc (check_mpq): Test it.
+
2016-08-29 Torbjörn Granlund <tg at gmplib.org>
* All C files: Include just gmp-impl.h, make gmp-impl.h grab gmp.h.
diff -r d2b8c42756bb -r 56c5f7d560f1 config.guess
--- a/config.guess Sat Oct 15 14:07:20 2016 +0200
+++ b/config.guess Sun Oct 30 19:16:04 2016 +0100
@@ -257,7 +257,8 @@
switch ((getcpuid(3LL) >> 24) & 0xFF) {
case 0x07: puts ("itanium"); break;
case 0x1F: puts ("itanium2"); break; /* McKinley, Madison */
- case 0x20: puts ("itanium2"); break; /* Montecito */
+ case 0x20: puts ("itanium2"); break; /* Montecito, Montvale, Tukwila */
+ case 0x21: puts ("itanium2"); break; /* Poulson */
}
}
return 0;
diff -r d2b8c42756bb -r 56c5f7d560f1 gmpxx.h
--- a/gmpxx.h Sat Oct 15 14:07:20 2016 +0200
+++ b/gmpxx.h Sun Oct 30 19:16:04 2016 +0100
@@ -689,7 +689,17 @@
}
}
static void eval(mpq_ptr q, unsigned long int l, mpq_srcptr r)
- { __GMPXX_TMPQ_UI; mpq_div (q, temp, r); }
+ {
+ if (__GMPXX_CONSTANT_TRUE(l == 0))
+ mpq_set_ui(q, 0, 1);
+ else if (__GMPXX_CONSTANT_TRUE(l == 1))
+ mpq_inv(q, r);
+ else
+ {
+ __GMPXX_TMPQ_UI;
+ mpq_div (q, temp, r);
+ }
+ }
static void eval(mpq_ptr q, mpq_srcptr r, signed long int l)
{
if (__GMPXX_CONSTANT_TRUE(l >= 0))
@@ -706,7 +716,22 @@
}
}
static void eval(mpq_ptr q, signed long int l, mpq_srcptr r)
- { __GMPXX_TMPQ_SI; mpq_div (q, temp, r); }
+ {
+ if (__GMPXX_CONSTANT_TRUE(l == 0))
+ mpq_set_ui(q, 0, 1);
+ else if (__GMPXX_CONSTANT_TRUE(l == 1))
+ mpq_inv(q, r);
+ else if (__GMPXX_CONSTANT_TRUE(l == -1))
+ {
+ mpq_inv(q, r);
+ mpq_neg(q, q);
+ }
+ else
+ {
+ __GMPXX_TMPQ_SI;
+ mpq_div (q, temp, r);
+ }
+ }
static void eval(mpq_ptr q, mpq_srcptr r, double d)
{ __GMPXX_TMPQ_D; mpq_div (q, r, temp); }
static void eval(mpq_ptr q, double d, mpq_srcptr r)
diff -r d2b8c42756bb -r 56c5f7d560f1 tests/cxx/t-ops.cc
--- a/tests/cxx/t-ops.cc Sat Oct 15 14:07:20 2016 +0200
+++ b/tests/cxx/t-ops.cc Sun Oct 30 19:16:04 2016 +0100
@@ -502,6 +502,16 @@
mpq_class c;
c = a / b; ASSERT_ALWAYS(c == 0.75);
}
+ {
+ mpq_class one = 1;
+ mpq_class x(2, 5);
+ ASSERT_ALWAYS(1 / x == one / x);
+ ASSERT_ALWAYS(1u / x == one / x);
+ x = (-1) / x;
+ ASSERT_ALWAYS(x == -2.5);
+ ASSERT_ALWAYS(0 / x == 0);
+ ASSERT_ALWAYS(0u / x == 0);
+ }
// operator<<
// operator>>
More information about the gmp-commit
mailing list