[Gmp-commit] /var/hg/gmp: Reduce the number of worker functions in __gmp_bina...
mercurial at gmplib.org
mercurial at gmplib.org
Thu Feb 14 19:32:54 CET 2013
details: /var/hg/gmp/rev/d50118f7f9e2
changeset: 15434:d50118f7f9e2
user: Marc Glisse <marc.glisse at inria.fr>
date: Thu Feb 14 19:32:51 2013 +0100
description:
Reduce the number of worker functions in __gmp_binary_equal (forward
instead of duplicating the code).
diffstat:
ChangeLog | 1 +
gmpxx.h | 16 ++++++++--------
2 files changed, 9 insertions(+), 8 deletions(-)
diffs (66 lines):
diff -r 69f663664fcb -r d50118f7f9e2 ChangeLog
--- a/ChangeLog Thu Feb 14 18:54:58 2013 +0100
+++ b/ChangeLog Thu Feb 14 19:32:51 2013 +0100
@@ -1,6 +1,7 @@
2013-02-14 Marc Glisse <marc.glisse at inria.fr>
* gmpxx.h (__gmp_binary_greater): Forward to __gmp_binary_less.
+ (__gmp_binary_equal): Forward to itself after swapping operands.
2013-02-14 Marco Bodrato <bodrato at mail.dm.unipi.it>
diff -r 69f663664fcb -r d50118f7f9e2 gmpxx.h
--- a/gmpxx.h Thu Feb 14 18:54:58 2013 +0100
+++ b/gmpxx.h Thu Feb 14 19:32:51 2013 +0100
@@ -885,15 +885,15 @@
static bool eval(mpz_srcptr z, unsigned long int l)
{ return mpz_cmp_ui(z, l) == 0; }
static bool eval(unsigned long int l, mpz_srcptr z)
- { return mpz_cmp_ui(z, l) == 0; }
+ { return eval(z, l); }
static bool eval(mpz_srcptr z, signed long int l)
{ return mpz_cmp_si(z, l) == 0; }
static bool eval(signed long int l, mpz_srcptr z)
- { return mpz_cmp_si(z, l) == 0; }
+ { return eval(z, l); }
static bool eval(mpz_srcptr z, double d)
{ return mpz_cmp_d(z, d) == 0; }
static bool eval(double d, mpz_srcptr z)
- { return mpz_cmp_d(z, d) == 0; }
+ { return eval(z, d); }
static bool eval(mpq_srcptr q, mpq_srcptr r)
{ return mpq_equal(q, r) != 0; }
@@ -901,11 +901,11 @@
static bool eval(mpq_srcptr q, unsigned long int l)
{ return mpq_cmp_ui(q, l, 1) == 0; }
static bool eval(unsigned long int l, mpq_srcptr q)
- { return mpq_cmp_ui(q, l, 1) == 0; }
+ { return eval(q, l); }
static bool eval(mpq_srcptr q, signed long int l)
{ return mpq_cmp_si(q, l, 1) == 0; }
static bool eval(signed long int l, mpq_srcptr q)
- { return mpq_cmp_si(q, l, 1) == 0; }
+ { return eval(q, l); }
static bool eval(mpq_srcptr q, double d)
{
bool b;
@@ -926,15 +926,15 @@
static bool eval(mpf_srcptr f, unsigned long int l)
{ return mpf_cmp_ui(f, l) == 0; }
static bool eval(unsigned long int l, mpf_srcptr f)
- { return mpf_cmp_ui(f, l) == 0; }
+ { return eval(f, l); }
static bool eval(mpf_srcptr f, signed long int l)
{ return mpf_cmp_si(f, l) == 0; }
static bool eval(signed long int l, mpf_srcptr f)
- { return mpf_cmp_si(f, l) == 0; }
+ { return eval(f, l); }
static bool eval(mpf_srcptr f, double d)
{ return mpf_cmp_d(f, d) == 0; }
static bool eval(double d, mpf_srcptr f)
- { return mpf_cmp_d(f, d) == 0; }
+ { return eval(f, d); }
};
struct __gmp_binary_less
More information about the gmp-commit
mailing list