summaryrefslogtreecommitdiff
path: root/mpq/cmp_ui.c
diff options
context:
space:
mode:
authortege <tege@gmplib.org>2000-12-06 13:06:12 +0100
committertege <tege@gmplib.org>2000-12-06 13:06:12 +0100
commitd8bc1e86aae386d3884b2bb323c767c749358d15 (patch)
tree91c144d9f378d5a493392b5ec953c1febd4d9afd /mpq/cmp_ui.c
parent60d4f67acad807243f0258d97da243684eafe8f1 (diff)
downloadgmp-d8bc1e86aae386d3884b2bb323c767c749358d15.tar.gz
Streamline.
Diffstat (limited to 'mpq/cmp_ui.c')
-rw-r--r--mpq/cmp_ui.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/mpq/cmp_ui.c b/mpq/cmp_ui.c
index f572d4a0d..30a7a9d20 100644
--- a/mpq/cmp_ui.c
+++ b/mpq/cmp_ui.c
@@ -38,7 +38,6 @@ _mpq_cmp_ui (op1, num2, den2)
mp_size_t den1_size = op1->_mp_den._mp_size;
mp_size_t tmp1_size, tmp2_size;
mp_ptr tmp1_ptr, tmp2_ptr;
- mp_size_t num1_sign;
mp_limb_t cy_limb;
int cc;
TMP_DECL (marker);
@@ -50,17 +49,14 @@ _mpq_cmp_ui (op1, num2, den2)
if (num2 == 0)
return num1_size;
- num1_sign = num1_size;
- num1_size = ABS (num1_size);
-
/* NUM1 x DEN2 is either TMP1_SIZE limbs or TMP1_SIZE-1 limbs.
Same for NUM1 x DEN1 with respect to TMP2_SIZE. */
if (num1_size > den1_size + 1)
/* NUM1 x DEN2 is surely larger in magnitude than NUM2 x DEN1. */
- return num1_sign;
- if (den1_size > num1_sign + 1)
+ return num1_size;
+ if (den1_size > num1_size + 1)
/* NUM1 x DEN2 is surely smaller in magnitude than NUM2 x DEN1. */
- return -num1_sign;
+ return -num1_size;
TMP_MARK (marker);
tmp1_ptr = (mp_ptr) TMP_ALLOC ((num1_size + 1) * BYTES_PER_MP_LIMB);
@@ -77,5 +73,5 @@ _mpq_cmp_ui (op1, num2, den2)
cc = tmp1_size - tmp2_size != 0
? tmp1_size - tmp2_size : mpn_cmp (tmp1_ptr, tmp2_ptr, tmp1_size);
TMP_FREE (marker);
- return (num1_sign < 0) ? -cc : cc;
+ return cc;
}