diff options
author | tne <tne> | 2017-11-07 16:46:38 (GMT) |
---|---|---|
committer | tne <tne> | 2017-11-07 16:46:38 (GMT) |
commit | 433dff0c1413aa1ca03a2bc29c5d7c4fc2865402 (patch) | |
tree | f427a167c676a57f8ba4c455e8cc46e441e034ec /generic/tclInt.h | |
parent | fc947a1ad4fac39cd6d4ed5c8afaa55c871c6f96 (diff) | |
parent | d0665d7a121733fde114a357da8ca7369a14aa39 (diff) | |
download | tcl-433dff0c1413aa1ca03a2bc29c5d7c4fc2865402.zip tcl-433dff0c1413aa1ca03a2bc29c5d7c4fc2865402.tar.gz tcl-433dff0c1413aa1ca03a2bc29c5d7c4fc2865402.tar.bz2 |
Pulling changes from core-8-branch
Diffstat (limited to 'generic/tclInt.h')
-rw-r--r-- | generic/tclInt.h | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/generic/tclInt.h b/generic/tclInt.h index 8339fb1..dfbcb86 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -2445,8 +2445,8 @@ typedef struct List { #define TCL_EACH_COLLECT 1 /* Collect iteration result like [lmap] */ /* - * Macros providing a faster path to integers: Tcl_GetLongFromObj everywhere, - * Tcl_GetIntFromObj and TclGetIntForIndex on platforms where longs are ints. + * Macros providing a faster path to integers: Tcl_GetLongFromObj, + * Tcl_GetIntFromObj and TclGetIntForIndex. * * WARNING: these macros eval their args more than once. */ @@ -2467,9 +2467,17 @@ typedef struct List { : TclGetIntForIndex((interp), (objPtr), (endValue), (idxPtr))) #else #define TclGetIntFromObj(interp, objPtr, intPtr) \ - Tcl_GetIntFromObj((interp), (objPtr), (intPtr)) -#define TclGetIntForIndexM(interp, objPtr, ignore, idxPtr) \ - TclGetIntForIndex(interp, objPtr, ignore, idxPtr) + (((objPtr)->typePtr == &tclIntType \ + && (objPtr)->internalRep.longValue >= -(Tcl_WideInt)(UINT_MAX) \ + && (objPtr)->internalRep.longValue <= (Tcl_WideInt)(UINT_MAX)) \ + ? ((*(intPtr) = (objPtr)->internalRep.longValue), TCL_OK) \ + : Tcl_GetIntFromObj((interp), (objPtr), (intPtr))) +#define TclGetIntForIndexM(interp, objPtr, endValue, idxPtr) \ + (((objPtr)->typePtr == &tclIntType \ + && (objPtr)->internalRep.longValue >= INT_MIN \ + && (objPtr)->internalRep.longValue <= INT_MAX) \ + ? ((*(idxPtr) = (objPtr)->internalRep.longValue), TCL_OK) \ + : TclGetIntForIndex((interp), (objPtr), (endValue), (idxPtr))) #endif /* |