[Gmp-commit] /var/hg/gmp: Update some old uses of __GMPXX_CONSTANT to bring t...
mercurial at gmplib.org
mercurial at gmplib.org
Sun Feb 17 23:51:54 CET 2013
details: /var/hg/gmp/rev/cae094572e5f
changeset: 15455:cae094572e5f
user: Marc Glisse <marc.glisse at inria.fr>
date: Sun Feb 17 23:51:51 2013 +0100
description:
Update some old uses of __GMPXX_CONSTANT to bring them in line with the new ones.
diffstat:
ChangeLog | 3 +++
gmpxx.h | 43 +++++++++++++++++--------------------------
2 files changed, 20 insertions(+), 26 deletions(-)
diffs (94 lines):
diff -r 7081a2d8e439 -r cae094572e5f ChangeLog
--- a/ChangeLog Sun Feb 17 22:23:22 2013 +0100
+++ b/ChangeLog Sun Feb 17 23:51:51 2013 +0100
@@ -20,6 +20,9 @@
__gmp_cmp_function): Use __GMPXX_TMPQ_D.
* tests/cxx/t-ops2.cc: Test __GMPXX_TMPQ_D on DBL_MIN, DBL_MAX.
+ * gmpxx.h (__gmp_binary_multiplies, __gmp_binary_divides): Use
+ __GMPXX_CONSTANT_TRUE.
+
2013-02-16 Marc Glisse <marc.glisse at inria.fr>
* gmpxx.h: Include <algorithm>.
diff -r 7081a2d8e439 -r cae094572e5f gmpxx.h
--- a/gmpxx.h Sun Feb 17 22:23:22 2013 +0100
+++ b/gmpxx.h Sun Feb 17 23:51:51 2013 +0100
@@ -497,16 +497,13 @@
{ eval(z, w, l); }
static void eval(mpz_ptr z, mpz_srcptr w, signed long int l)
{
- if (__GMPXX_CONSTANT(l))
- {
- if (l >= 0)
- eval(z, w, static_cast<unsigned long>(l));
- else
+ if (__GMPXX_CONSTANT_TRUE(l >= 0))
+ eval(z, w, static_cast<unsigned long>(l));
+ else if (__GMPXX_CONSTANT_TRUE(l <= 0))
{
eval(z, w, -static_cast<unsigned long>(l));
mpz_neg(z, z);
}
- }
else
mpz_mul_si (z, w, l);
}
@@ -545,21 +542,18 @@
{ eval(q, r, l); }
static void eval(mpq_ptr q, mpq_srcptr r, signed long int l)
{
- if (__GMPXX_CONSTANT(l))
- {
- if (l >= 0)
- eval(q, r, static_cast<unsigned long>(l));
- else
+ if (__GMPXX_CONSTANT_TRUE(l >= 0))
+ eval(q, r, static_cast<unsigned long>(l));
+ else if (__GMPXX_CONSTANT_TRUE(l <= 0))
{
eval(q, r, -static_cast<unsigned long>(l));
mpq_neg(q, q);
}
- }
else
- {
- __GMPXX_TMPQ_SI;
- mpq_mul (q, r, temp);
- }
+ {
+ __GMPXX_TMPQ_SI;
+ mpq_mul (q, r, temp);
+ }
}
static void eval(mpq_ptr q, signed long int l, mpq_srcptr r)
{ eval(q, r, l); }
@@ -688,21 +682,18 @@
{ __GMPXX_TMPQ_UI; mpq_div (q, temp, r); }
static void eval(mpq_ptr q, mpq_srcptr r, signed long int l)
{
- if (__GMPXX_CONSTANT(l))
- {
- if (l >= 0)
- eval(q, r, static_cast<unsigned long>(l));
- else
+ if (__GMPXX_CONSTANT_TRUE(l >= 0))
+ eval(q, r, static_cast<unsigned long>(l));
+ else if (__GMPXX_CONSTANT_TRUE(l <= 0))
{
eval(q, r, -static_cast<unsigned long>(l));
mpq_neg(q, q);
}
- }
else
- {
- __GMPXX_TMPQ_SI;
- mpq_div (q, r, temp);
- }
+ {
+ __GMPXX_TMPQ_SI;
+ mpq_div (q, r, temp);
+ }
}
static void eval(mpq_ptr q, signed long int l, mpq_srcptr r)
{ __GMPXX_TMPQ_SI; mpq_div (q, temp, r); }
More information about the gmp-commit
mailing list