diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2005-07-22 23:56:28 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2005-07-22 23:56:28 (GMT) |
commit | 7c3dc60455b251517713096f2162c2bfccbd5b00 (patch) | |
tree | 02921a10431542395ffbe6692dd4f1bc5dfc5ce2 /generic | |
parent | 45f567905490707f572d6b6a31274edca1f06b59 (diff) | |
download | tcl-7c3dc60455b251517713096f2162c2bfccbd5b00.zip tcl-7c3dc60455b251517713096f2162c2bfccbd5b00.tar.gz tcl-7c3dc60455b251517713096f2162c2bfccbd5b00.tar.bz2 |
Improve the incrementer code for INST_DICT_INCR_IMM, removing a gcc-ism.
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclExecute.c | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 9dd242e..aff2bc3 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclExecute.c,v 1.196 2005/07/21 21:49:05 dkf Exp $ + * RCS: @(#) $Id: tclExecute.c,v 1.197 2005/07/22 23:56:34 dkf Exp $ */ #include "tclInt.h" @@ -4866,9 +4866,7 @@ TclExecuteByteCode(interp, codePtr) result = Tcl_DictObjPutKeyList(interp, dictPtr, opnd, tosPtr-opnd, *tosPtr); break; - case INST_DICT_INCR_IMM: { - long value; - + case INST_DICT_INCR_IMM: cleanup = 1; opnd = TclGetInt4AtPtr(pc+1); result = Tcl_DictObjGet(interp, dictPtr, *tosPtr, &valPtr); @@ -4877,17 +4875,35 @@ TclExecuteByteCode(interp, codePtr) } if (valPtr == NULL) { Tcl_DictObjPut(NULL, dictPtr, *tosPtr, Tcl_NewLongObj(opnd)); + } else if (valPtr->typePtr == &tclWideIntType) { + Tcl_WideInt wvalue; + + Tcl_GetWideIntFromObj(NULL, valPtr, &wvalue); + Tcl_DictObjPut(NULL, dictPtr, *tosPtr, + Tcl_NewWideIntObj(wvalue + opnd)); + } else if (valPtr->typePtr == &tclIntType) { + long value; + + Tcl_GetLongFromObj(NULL, valPtr, &value); + Tcl_DictObjPut(NULL, dictPtr, *tosPtr, + Tcl_NewLongObj(value + opnd)); } else { -#warning non-long incrementing broken - result = Tcl_GetLongFromObj(interp, valPtr, &value); + long value; + Tcl_WideInt wvalue; + + REQUIRE_WIDE_OR_INT(result, valPtr, value, wvalue); if (result != TCL_OK) { break; } - Tcl_DictObjPut(NULL, dictPtr, *tosPtr, - Tcl_NewLongObj(value + opnd)); + if (valPtr->typePtr == &tclWideIntType) { + Tcl_DictObjPut(NULL, dictPtr, *tosPtr, + Tcl_NewWideIntObj(wvalue + opnd)); + } else { + Tcl_DictObjPut(NULL, dictPtr, *tosPtr, + Tcl_NewLongObj(value + opnd)); + } } break; - } case INST_DICT_UNSET: cleanup = opnd; result = Tcl_DictObjRemoveKeyList(interp, dictPtr, opnd, |