summaryrefslogtreecommitdiffstats
path: root/generic/tclIndexObj.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2022-04-26 15:07:32 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2022-04-26 15:07:32 (GMT)
commit9f54abf33a1289128b25b82e8a2d53013463801e (patch)
tree61e1cbbade0543e37925dd3fe1f5d2f611c2692a /generic/tclIndexObj.c
parentaabacf9e13f8a62c916f79cde849149ab05b73c0 (diff)
downloadtcl-9f54abf33a1289128b25b82e8a2d53013463801e.zip
tcl-9f54abf33a1289128b25b82e8a2d53013463801e.tar.gz
tcl-9f54abf33a1289128b25b82e8a2d53013463801e.tar.bz2
Change value of TCL_INDEX_TEMP_TABLE from 2 to 64, and let it lead to a slightly more efficient implementation of Tcl_GetIndexFromObj*() (TIP #613)
Diffstat (limited to 'generic/tclIndexObj.c')
-rw-r--r--generic/tclIndexObj.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/generic/tclIndexObj.c b/generic/tclIndexObj.c
index 1f600c5..e1526ad 100644
--- a/generic/tclIndexObj.c
+++ b/generic/tclIndexObj.c
@@ -369,20 +369,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;
}