diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-01-17 21:38:01 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-01-17 21:38:01 (GMT) |
commit | 3c7e5cc3a228b2a86bc56bad4fc6961a21500fc0 (patch) | |
tree | 267d1fe3eb2724988f7ab4bf9a70ac277bfc9c95 | |
parent | 3af4fb5cb1d3445cc851786da9d79999471951f5 (diff) | |
download | tcl-3c7e5cc3a228b2a86bc56bad4fc6961a21500fc0.zip tcl-3c7e5cc3a228b2a86bc56bad4fc6961a21500fc0.tar.gz tcl-3c7e5cc3a228b2a86bc56bad4fc6961a21500fc0.tar.bz2 |
Slightly more efficient TclGetIntForIndexM macro, compared to previous commit
-rw-r--r-- | generic/tclInt.h | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/generic/tclInt.h b/generic/tclInt.h index 53fb629..2fba5bf 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -2499,7 +2499,7 @@ typedef struct List { #define TclGetLongFromObj(interp, objPtr, longPtr) \ (((objPtr)->typePtr == &tclIntType \ && (objPtr)->internalRep.wideValue >= (Tcl_WideInt)(LONG_MIN) \ - && (objPtr)->internalRep.wideValue <= (Tcl_WideInt)(LONG_MAX)) \ + && (objPtr)->internalRep.wideValue <= (Tcl_WideInt)(LONG_MAX)) \ ? ((*(longPtr) = (long)(objPtr)->internalRep.wideValue), TCL_OK) \ : Tcl_GetLongFromObj((interp), (objPtr), (longPtr))) #endif @@ -2507,14 +2507,14 @@ typedef struct List { #define TclGetIntFromObj(interp, objPtr, intPtr) \ (((objPtr)->typePtr == &tclIntType \ && (objPtr)->internalRep.wideValue >= (Tcl_WideInt)(INT_MIN) \ - && (objPtr)->internalRep.wideValue <= (Tcl_WideInt)(INT_MAX)) \ + && (objPtr)->internalRep.wideValue <= (Tcl_WideInt)(INT_MAX)) \ ? ((*(intPtr) = (int)(objPtr)->internalRep.wideValue), TCL_OK) \ : Tcl_GetIntFromObj((interp), (objPtr), (intPtr))) #define TclGetIntForIndexM(interp, objPtr, endValue, idxPtr) \ (((objPtr)->typePtr == &tclIntType \ - && (objPtr)->internalRep.wideValue >= -1 \ - && (objPtr)->internalRep.wideValue <= INT_MAX) \ - ? ((*(idxPtr) = (int)(objPtr)->internalRep.wideValue), TCL_OK) \ + && (objPtr)->internalRep.wideValue <= (Tcl_WideInt)(INT_MAX)) \ + ? ((*(idxPtr) = ((objPtr)->internalRep.wideValue >= 0) \ + ? (int)(objPtr)->internalRep.wideValue : -1), TCL_OK) \ : TclGetIntForIndex((interp), (objPtr), (endValue), (idxPtr))) /* |