From 96f598f5057819d5fbf38a3744af7f3fcfb2aa0c Mon Sep 17 00:00:00 2001 From: Marco Bodrato Date: Tue, 25 Aug 2015 20:24:19 +0200 Subject: mpf/cmp.c: Use macros. --- mpf/cmp.c | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) (limited to 'mpf') 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) -- cgit v1.2.1