summaryrefslogtreecommitdiffstats
path: root/generic/tclExecute.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2018-02-27 20:48:00 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2018-02-27 20:48:00 (GMT)
commit9a809e614ae7603730d8cc5f60b454b66dffa972 (patch)
tree4df7f67a7ff3133e363a264c3610852fb46d9f4d /generic/tclExecute.c
parent0bceead396460bd96a148e6a6c9e55acc1ed7311 (diff)
downloadtcl-9a809e614ae7603730d8cc5f60b454b66dffa972.zip
tcl-9a809e614ae7603730d8cc5f60b454b66dffa972.tar.gz
tcl-9a809e614ae7603730d8cc5f60b454b66dffa972.tar.bz2
Use mp_isneg() in stead of mp_cmp_d() when the output of this function is simply compared with MP_LT.
Diffstat (limited to 'generic/tclExecute.c')
-rw-r--r--generic/tclExecute.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index a83023c..1c69474 100644
--- a/generic/tclExecute.c
+++ b/generic/tclExecute.c
@@ -8092,7 +8092,7 @@ ExecuteExtendedBinaryMathOp(
break;
case TCL_NUMBER_BIG:
Tcl_TakeBignumFromObj(NULL, value2Ptr, &big2);
- invalid = (mp_cmp_d(&big2, 0) == MP_LT);
+ invalid = mp_isneg(&big2);
mp_clear(&big2);
break;
default:
@@ -8171,7 +8171,7 @@ ExecuteExtendedBinaryMathOp(
break;
case TCL_NUMBER_BIG:
Tcl_TakeBignumFromObj(NULL, valuePtr, &big1);
- zero = (mp_cmp_d(&big1, 0) == MP_GT);
+ zero = (!mp_isneg(&big1));
mp_clear(&big1);
break;
default:
@@ -8209,7 +8209,7 @@ ExecuteExtendedBinaryMathOp(
} else {
mp_init(&bigRemainder);
mp_div_2d(&big1, shift, &bigResult, &bigRemainder);
- if (mp_cmp_d(&bigRemainder, 0) == MP_LT) {
+ if (mp_isneg(&bigRemainder)) {
/*
* Convert to Tcl's integer division rules.
*/
@@ -8236,14 +8236,14 @@ ExecuteExtendedBinaryMathOp(
* arguments is negative, store it in 'Second'.
*/
- if (mp_cmp_d(&big1, 0) != MP_LT) {
- numPos = 1 + (mp_cmp_d(&big2, 0) != MP_LT);
+ if (!mp_isneg(&big1)) {
+ numPos = 1 + !mp_isneg(&big2);
First = &big1;
Second = &big2;
} else {
First = &big2;
Second = &big1;
- numPos = (mp_cmp_d(First, 0) != MP_LT);
+ numPos = (!mp_isneg(First));
}
mp_init(&bigResult);
@@ -8445,7 +8445,7 @@ ExecuteExtendedBinaryMathOp(
break;
case TCL_NUMBER_BIG:
Tcl_TakeBignumFromObj(NULL, value2Ptr, &big2);
- negativeExponent = (mp_cmp_d(&big2, 0) == MP_LT);
+ negativeExponent = mp_isneg(&big2);
mp_mod_2d(&big2, 1, &big2);
oddExponent = !mp_iszero(&big2);
mp_clear(&big2);
@@ -8995,7 +8995,7 @@ TclCompareTwoNumbers(
goto wideCompare;
case TCL_NUMBER_BIG:
Tcl_TakeBignumFromObj(NULL, value2Ptr, &big2);
- if (mp_cmp_d(&big2, 0) == MP_LT) {
+ if (mp_isneg(&big2)) {
compare = MP_GT;
} else {
compare = MP_LT;
@@ -9032,7 +9032,7 @@ TclCompareTwoNumbers(
}
Tcl_TakeBignumFromObj(NULL, value2Ptr, &big2);
if ((d1 < (double)LONG_MAX) && (d1 > (double)LONG_MIN)) {
- if (mp_cmp_d(&big2, 0) == MP_LT) {
+ if (mp_isneg(&big2)) {
compare = MP_GT;
} else {
compare = MP_LT;