diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2018-02-27 21:12:00 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2018-02-27 21:12:00 (GMT) |
commit | b31a3b3d706e0d1b5b93f5d33098273d7354c66f (patch) | |
tree | 4b2a7b2973f9fc4b923ea816042a33301df6ec7d /generic | |
parent | fa036d2b99727547f299a146d44fa5f7a1d74089 (diff) | |
parent | 9a809e614ae7603730d8cc5f60b454b66dffa972 (diff) | |
download | tcl-b31a3b3d706e0d1b5b93f5d33098273d7354c66f.zip tcl-b31a3b3d706e0d1b5b93f5d33098273d7354c66f.tar.gz tcl-b31a3b3d706e0d1b5b93f5d33098273d7354c66f.tar.bz2 |
Merge 8.7
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclBasic.c | 2 | ||||
-rw-r--r-- | generic/tclExecute.c | 18 | ||||
-rw-r--r-- | generic/tclScan.c | 2 | ||||
-rw-r--r-- | generic/tclStrToD.c | 4 |
4 files changed, 13 insertions, 13 deletions
diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 42a1ccf..16e2e20 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -6943,7 +6943,7 @@ ExprAbsFunc( } if (type == TCL_NUMBER_BIG) { - if (mp_cmp_d((const mp_int *) ptr, 0) == MP_LT) { + if (mp_isneg((const mp_int *) ptr)) { Tcl_GetBignumFromObj(NULL, objv[1], &big); tooLarge: mp_neg(&big, &big); diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 7757816..d5617d4 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -7949,7 +7949,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: @@ -8028,7 +8028,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: @@ -8066,7 +8066,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. */ @@ -8093,14 +8093,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); @@ -8302,7 +8302,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); @@ -8852,7 +8852,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; @@ -8889,7 +8889,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; diff --git a/generic/tclScan.c b/generic/tclScan.c index 65ceb66..4eb0c06 100644 --- a/generic/tclScan.c +++ b/generic/tclScan.c @@ -942,7 +942,7 @@ Tcl_ScanObjCmd( if (flags & SCAN_UNSIGNED) { mp_int big; if ((Tcl_GetBignumFromObj(interp, objPtr, &big) != TCL_OK) - || (mp_cmp_d(&big, 0) == MP_LT)) { + || mp_isneg(&big)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "unsigned bignum scans are invalid", -1)); Tcl_SetErrorCode(interp, "TCL", "FORMAT", "BADUNSIGNED",NULL); diff --git a/generic/tclStrToD.c b/generic/tclStrToD.c index 5cf6969..147f96b 100644 --- a/generic/tclStrToD.c +++ b/generic/tclStrToD.c @@ -4633,7 +4633,7 @@ TclCeil( mp_int b; mp_init(&b); - if (mp_cmp_d(a, 0) == MP_LT) { + if (mp_isneg(a)) { mp_neg(a, &b); r = -TclFloor(&b); } else { @@ -4690,7 +4690,7 @@ TclFloor( mp_int b; mp_init(&b); - if (mp_cmp_d(a, 0) == MP_LT) { + if (mp_isneg(a)) { mp_neg(a, &b); r = -TclCeil(&b); } else { |