diff options
-rw-r--r-- | generic/tcl.h | 6 | ||||
-rw-r--r-- | generic/tclDecls.h | 4 | ||||
-rw-r--r-- | generic/tclIndexObj.c | 21 |
3 files changed, 16 insertions, 15 deletions
diff --git a/generic/tcl.h b/generic/tcl.h index 7294cf9..676784d 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -824,15 +824,15 @@ typedef struct Tcl_DString { /* * Flags that may be passed to Tcl_GetIndexFromObj. * TCL_EXACT disallows abbreviated strings. - * TCL_INDEX_TEMP_TABLE disallows caching of lookups. A possible use case is - * a table that will not live long enough to make it worthwhile. * TCL_INDEX_NULL_OK allows the empty string or NULL to return TCL_OK. * The returned value will be -1; + * TCL_INDEX_TEMP_TABLE disallows caching of lookups. A possible use case is + * a table that will not live long enough to make it worthwhile. */ #define TCL_EXACT 1 -#define TCL_INDEX_TEMP_TABLE 2 #define TCL_INDEX_NULL_OK 32 +#define TCL_INDEX_TEMP_TABLE 64 /* *---------------------------------------------------------------------------- diff --git a/generic/tclDecls.h b/generic/tclDecls.h index c5f89b5..41215d5 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -3919,7 +3919,7 @@ extern const TclStubs *tclStubsPtr; #define Tcl_GetUnicodeFromObj(objPtr, sizePtr) \ (sizeof(*(sizePtr)) <= sizeof(int) ? tclStubsPtr->tclGetUnicodeFromObj(objPtr, (int *)(sizePtr)) : tclStubsPtr->tcl_GetUnicodeFromObj(objPtr, (size_t *)(sizePtr))) #define Tcl_GetIndexFromObjStruct(interp, objPtr, tablePtr, offset, msg, flags, indexPtr) \ - (tclStubsPtr->tcl_GetIndexFromObjStruct((interp), (objPtr), (tablePtr), (offset), (msg), (flags)|(int)(sizeof(*(indexPtr))<<8), (indexPtr))) + (tclStubsPtr->tcl_GetIndexFromObjStruct((interp), (objPtr), (tablePtr), (offset), (msg), (flags)|(int)(sizeof(*(indexPtr))<<1), (indexPtr))) #else #define Tcl_GetStringFromObj(objPtr, sizePtr) \ (sizeof(*(sizePtr)) <= sizeof(int) ? (TclGetStringFromObj)(objPtr, (int *)(sizePtr)) : (Tcl_GetStringFromObj)(objPtr, (size_t *)(sizePtr))) @@ -3930,7 +3930,7 @@ extern const TclStubs *tclStubsPtr; #define Tcl_GetUnicodeFromObj(objPtr, sizePtr) \ (sizeof(*(sizePtr)) <= sizeof(int) ? (TclGetUnicodeFromObj)(objPtr, (int *)(sizePtr)) : Tcl_GetUnicodeFromObj(objPtr, (size_t *)(sizePtr))) #define Tcl_GetIndexFromObjStruct(interp, objPtr, tablePtr, offset, msg, flags, indexPtr) \ - ((Tcl_GetIndexFromObjStruct)((interp), (objPtr), (tablePtr), (offset), (msg), (flags)|(int)(sizeof(*(indexPtr))<<8), (indexPtr))) + ((Tcl_GetIndexFromObjStruct)((interp), (objPtr), (tablePtr), (offset), (msg), (flags)|(int)(sizeof(*(indexPtr))<<1), (indexPtr))) #endif #ifdef TCL_MEM_DEBUG diff --git a/generic/tclIndexObj.c b/generic/tclIndexObj.c index c369827..567bdc5 100644 --- a/generic/tclIndexObj.c +++ b/generic/tclIndexObj.c @@ -300,20 +300,21 @@ Tcl_GetIndexFromObjStruct( uncachedDone: if (indexPtr != NULL) { - if ((flags>>8) & (int)~sizeof(int)) { - if ((flags>>8) == sizeof(uint64_t)) { - *(uint64_t *)indexPtr = index; - return TCL_OK; - } else if ((flags>>8) == sizeof(uint32_t)) { - *(uint32_t *)indexPtr = index; - return TCL_OK; - } else if ((flags>>8) == sizeof(uint16_t)) { + flags &= (30-(int)(sizeof(int)<<1)); + if (flags) { + if (flags == sizeof(uint16_t)<<1) { *(uint16_t *)indexPtr = index; return TCL_OK; - } else if ((flags>>8) == sizeof(uint8_t)) { + } else if (flags == (int)(sizeof(uint8_t)<<1)) { *(uint8_t *)indexPtr = index; return TCL_OK; - } + } else if (flags == (int)(sizeof(int64_t)<<1)) { + *(int64_t *)indexPtr = index; + return TCL_OK; + } else if (flags == (int)(sizeof(int32_t)<<1)) { + *(int32_t *)indexPtr = index; + return TCL_OK; + } } *(int *)indexPtr = index; } |