diff options
author | dgp <dgp@users.sourceforge.net> | 2018-03-07 15:13:07 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2018-03-07 15:13:07 (GMT) |
commit | 6de6ee8aa9086eb2b86d82e6831dae17232abca4 (patch) | |
tree | 3633d2b708dc8670f3d1b18e1b6ffb2eeecd23b8 /generic/tclStrToD.c | |
parent | e16df96d28704115312eee43ffc5019a766d2cfd (diff) | |
parent | 0254080ca07929caa2f2b25206928d5559048aff (diff) | |
download | tcl-6de6ee8aa9086eb2b86d82e6831dae17232abca4.zip tcl-6de6ee8aa9086eb2b86d82e6831dae17232abca4.tar.gz tcl-6de6ee8aa9086eb2b86d82e6831dae17232abca4.tar.bz2 |
merge 8.7
Diffstat (limited to 'generic/tclStrToD.c')
-rw-r--r-- | generic/tclStrToD.c | 52 |
1 files changed, 12 insertions, 40 deletions
diff --git a/generic/tclStrToD.c b/generic/tclStrToD.c index 630e498..0434919 100644 --- a/generic/tclStrToD.c +++ b/generic/tclStrToD.c @@ -1268,32 +1268,18 @@ TclParseNumber( } } if (!octalSignificandOverflow) { - if (octalSignificandWide > - (Tcl_WideUInt)(((~(unsigned long)0) >> 1) + signum)) { -#ifndef TCL_WIDE_INT_IS_LONG - if (octalSignificandWide <= (MOST_BITS + signum)) { - objPtr->typePtr = &tclWideIntType; - if (signum) { - objPtr->internalRep.wideValue = - - (Tcl_WideInt) octalSignificandWide; - } else { - objPtr->internalRep.wideValue = - (Tcl_WideInt) octalSignificandWide; - } - break; - } -#endif + if (octalSignificandWide > (MOST_BITS + signum)) { TclInitBignumFromWideUInt(&octalSignificandBig, octalSignificandWide); octalSignificandOverflow = 1; } else { objPtr->typePtr = &tclIntType; if (signum) { - objPtr->internalRep.longValue = - - (long) octalSignificandWide; + objPtr->internalRep.wideValue = + - (Tcl_WideInt) octalSignificandWide; } else { - objPtr->internalRep.longValue = - (long) octalSignificandWide; + objPtr->internalRep.wideValue = + (Tcl_WideInt) octalSignificandWide; } } } @@ -1315,32 +1301,18 @@ TclParseNumber( } returnInteger: if (!significandOverflow) { - if (significandWide > - (Tcl_WideUInt)(((~(unsigned long)0) >> 1) + signum)) { -#ifndef TCL_WIDE_INT_IS_LONG - if (significandWide <= MOST_BITS+signum) { - objPtr->typePtr = &tclWideIntType; - if (signum) { - objPtr->internalRep.wideValue = - - (Tcl_WideInt) significandWide; - } else { - objPtr->internalRep.wideValue = - (Tcl_WideInt) significandWide; - } - break; - } -#endif + if (significandWide > MOST_BITS+signum) { TclInitBignumFromWideUInt(&significandBig, significandWide); significandOverflow = 1; } else { objPtr->typePtr = &tclIntType; if (signum) { - objPtr->internalRep.longValue = - - (long) significandWide; + objPtr->internalRep.wideValue = + - (Tcl_WideInt) significandWide; } else { - objPtr->internalRep.longValue = - (long) significandWide; + objPtr->internalRep.wideValue = + (Tcl_WideInt) significandWide; } } } @@ -4725,7 +4697,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 { @@ -4782,7 +4754,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 { |