diff options
author | Marc Glisse <marc.glisse@inria.fr> | 2013-02-14 19:32:51 +0100 |
---|---|---|
committer | Marc Glisse <marc.glisse@inria.fr> | 2013-02-14 19:32:51 +0100 |
commit | 95517b30a76950f8a91e57a972c948d5c034548d (patch) | |
tree | 26b0c12917867f77b7dba21916a877621c178493 | |
parent | 6af6384ec1f6c04f9cca11240f87c1ed60392721 (diff) | |
download | gmp-95517b30a76950f8a91e57a972c948d5c034548d.tar.gz |
Reduce the number of worker functions in __gmp_binary_equal (forward
instead of duplicating the code).
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | gmpxx.h | 16 |
2 files changed, 9 insertions, 8 deletions
@@ -1,6 +1,7 @@ 2013-02-14 Marc Glisse <marc.glisse@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@mail.dm.unipi.it> @@ -885,15 +885,15 @@ struct __gmp_binary_equal 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 @@ struct __gmp_binary_equal 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 @@ struct __gmp_binary_equal 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 |