summaryrefslogtreecommitdiff
path: root/mpf
diff options
context:
space:
mode:
authorMarco Bodrato <bodrato@mail.dm.unipi.it>2015-08-25 20:24:19 +0200
committerMarco Bodrato <bodrato@mail.dm.unipi.it>2015-08-25 20:24:19 +0200
commit96f598f5057819d5fbf38a3744af7f3fcfb2aa0c (patch)
tree58ac312dc023b1e1393ff0b7666732a1c33c8c16 /mpf
parent9be72c58d283a7e88a1cc50fd11811f15c53535a (diff)
downloadgmp-96f598f5057819d5fbf38a3744af7f3fcfb2aa0c.tar.gz
mpf/cmp.c: Use macros.
Diffstat (limited to 'mpf')
-rw-r--r--mpf/cmp.c30
1 files changed, 13 insertions, 17 deletions
diff --git a/mpf/cmp.c b/mpf/cmp.c
index 2d291c80f..7486a3d36 100644
--- a/mpf/cmp.c
+++ b/mpf/cmp.c
@@ -40,11 +40,8 @@ mpf_cmp (mpf_srcptr u, mpf_srcptr v) __GMP_NOTHROW
int cmp;
int usign;
- uexp = u->_mp_exp;
- vexp = v->_mp_exp;
-
- usize = u->_mp_size;
- vsize = v->_mp_size;
+ usize = SIZ(u);
+ vsize = SIZ(v);
usign = usize >= 0 ? 1 : -1;
/* 1. Are the signs different? */
@@ -67,6 +64,8 @@ mpf_cmp (mpf_srcptr u, mpf_srcptr v) __GMP_NOTHROW
/* U and V have the same sign and are both non-zero. */
+ uexp = EXP(u);
+ vexp = EXP(v);
/* 2. Are the exponents different? */
if (uexp > vexp)
@@ -77,22 +76,19 @@ mpf_cmp (mpf_srcptr u, mpf_srcptr v) __GMP_NOTHROW
usize = ABS (usize);
vsize = ABS (vsize);
- up = u->_mp_d;
- vp = v->_mp_d;
+ up = PTR (u);
+ vp = PTR (v);
#define STRICT_MPF_NORMALIZATION 0
#if ! STRICT_MPF_NORMALIZATION
/* Ignore zeroes at the low end of U and V. */
- while (up[0] == 0)
- {
- up++;
- usize--;
- }
- while (vp[0] == 0)
- {
- vp++;
- vsize--;
- }
+ do {
+ mp_limb_t tl;
+ tl = up[0];
+ MPN_STRIP_LOW_ZEROS_NOT_ZERO (up, usize, tl);
+ tl = vp[0];
+ MPN_STRIP_LOW_ZEROS_NOT_ZERO (vp, vsize, tl);
+ } while (0);
#endif
if (usize > vsize)