diff options
author | Marco Bodrato <bodrato@mail.dm.unipi.it> | 2015-08-25 20:23:35 +0200 |
---|---|---|
committer | Marco Bodrato <bodrato@mail.dm.unipi.it> | 2015-08-25 20:23:35 +0200 |
commit | 9be72c58d283a7e88a1cc50fd11811f15c53535a (patch) | |
tree | ef8b15482ffa64b22bc6e40ef28105826aa38e00 /mpf | |
parent | bc7cb9d8487076ca2d81c3cf577b35a9a05903be (diff) | |
download | gmp-9be72c58d283a7e88a1cc50fd11811f15c53535a.tar.gz |
mpf/cmp.c: Remove uneeded branches.
Diffstat (limited to 'mpf')
-rw-r--r-- | mpf/cmp.c | 15 |
1 files changed, 8 insertions, 7 deletions
@@ -1,6 +1,6 @@ /* mpf_cmp -- Compare two floats. -Copyright 1993, 1994, 1996, 2001 Free Software Foundation, Inc. +Copyright 1993, 1994, 1996, 2001, 2015 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -45,6 +45,7 @@ mpf_cmp (mpf_srcptr u, mpf_srcptr v) __GMP_NOTHROW usize = u->_mp_size; vsize = v->_mp_size; + usign = usize >= 0 ? 1 : -1; /* 1. Are the signs different? */ if ((usize ^ vsize) >= 0) @@ -61,12 +62,11 @@ mpf_cmp (mpf_srcptr u, mpf_srcptr v) __GMP_NOTHROW else { /* Either U or V is negative, but not both. */ - return usize >= 0 ? 1 : -1; + return usign; } /* U and V have the same sign and are both non-zero. */ - usign = usize >= 0 ? 1 : -1; /* 2. Are the exponents different? */ if (uexp > vexp) @@ -98,14 +98,15 @@ mpf_cmp (mpf_srcptr u, mpf_srcptr v) __GMP_NOTHROW if (usize > vsize) { cmp = mpn_cmp (up + usize - vsize, vp, vsize); - if (cmp == 0) - return usign; + /* if (cmp == 0) */ + /* return usign; */ + ++cmp; } else if (vsize > usize) { cmp = mpn_cmp (up, vp + vsize - usize, usize); - if (cmp == 0) - return -usign; + /* if (cmp == 0) */ + /* return -usign; */ } else { |