summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2018-03-07 19:55:23 (GMT)
committerdgp <dgp@users.sourceforge.net>2018-03-07 19:55:23 (GMT)
commitd7f41b448c046d176a3b6a931a12d09d7e75b626 (patch)
tree8afc5ce28a7eaea817459f53ca298d0d07df4daa
parent2c44354d13f15b788a4213ab50441eed6ad54f75 (diff)
downloadtcl-d7f41b448c046d176a3b6a931a12d09d7e75b626.zip
tcl-d7f41b448c046d176a3b6a931a12d09d7e75b626.tar.gz
tcl-d7f41b448c046d176a3b6a931a12d09d7e75b626.tar.bz2
Express INST_LIST_INDEX_IMM index processinig in terms of TCL_INDEX_END so
that consistencies are maintained, and hardcoded values are a bit demystified.
-rw-r--r--generic/tclExecute.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index d345899..6bc5485 100644
--- a/generic/tclExecute.c
+++ b/generic/tclExecute.c
@@ -5090,15 +5090,10 @@ TEBCresume(
}
/*
- * Select the list item based on the index. Negative operand means
- * end-based indexing (-2, ...), and -1 means out of range.
+ * Decode end-offset index values.
*/
- if (opnd < -1) {
- index = opnd+1 + objc;
- } else {
- index = opnd;
- }
+ index = opnd + (opnd <= TCL_INDEX_END)*(objc - 1 - TCL_INDEX_END);
pcAdjustment = 5;
lindexFastPath: