summaryrefslogtreecommitdiff
path: root/cmp.c
diff options
context:
space:
mode:
authorzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2001-01-18 08:42:27 +0000
committerzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2001-01-18 08:42:27 +0000
commitbaad37cb1975dd5791ba85b70d6b919ec888e33c (patch)
tree5777d8ce5a212d122f364d8d34000602791cc802 /cmp.c
parentf9c0329541bcc19a0ee318c0fbecb2cf0c6f9176 (diff)
downloadmpfr-baad37cb1975dd5791ba85b70d6b919ec888e33c.tar.gz
fixed bug in mpfr_cmp2 (found on the IA64)
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@981 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'cmp.c')
-rw-r--r--cmp.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/cmp.c b/cmp.c
index d0cb175db..5b7b73cf5 100644
--- a/cmp.c
+++ b/cmp.c
@@ -185,7 +185,10 @@ mpfr_cmp2(b, c)
/* bn < 0; if some limb of c is nonzero, return k+1, otherwise return k*/
- if (cn>=0 && (cp[cn--] << (BITS_PER_MP_LIMB - d))) { return k+1; }
+ /* if d < BITS_PER_MP_LIMB, only the last d bits of cp[cn] have to be
+ considered, otherwise all bits */
+ if (d < BITS_PER_MP_LIMB)
+ if (cn>=0 && (cp[cn--] << (BITS_PER_MP_LIMB - d))) { return k+1; }
while (cn >= 0)
if (cp[cn--]) return k+1;