summaryrefslogtreecommitdiffstats
path: root/generic/tclLink.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2022-11-11 21:09:21 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2022-11-11 21:09:21 (GMT)
commit874327229c5e64a52e1fc3b4da6a31936ec07ed2 (patch)
tree62f3596453a433b26e323d6f37de74cba263e81e /generic/tclLink.c
parentb2b045293797df7ff4e350e74cfdab191eadc31f (diff)
downloadtcl-874327229c5e64a52e1fc3b4da6a31936ec07ed2.zip
tcl-874327229c5e64a52e1fc3b4da6a31936ec07ed2.tar.gz
tcl-874327229c5e64a52e1fc3b4da6a31936ec07ed2.tar.bz2
Add (internal) TclNewUIntObj(), and use it to fix TCL_LINK_WIDE_UINT for big (>= 2^63) integers. With testcase
Diffstat (limited to 'generic/tclLink.c')
-rw-r--r--generic/tclLink.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/generic/tclLink.c b/generic/tclLink.c
index 0d57d44..af48302 100644
--- a/generic/tclLink.c
+++ b/generic/tclLink.c
@@ -553,7 +553,7 @@ GetUWide(
*/
return 1;
}
-#ifdef WORDS_BIGENDIAN
+#ifndef WORDS_BIGENDIAN
while (numBytes-- > 0) {
value = (value << CHAR_BIT) | *bytes++;
}
@@ -1451,12 +1451,12 @@ ObjValue(
}
linkPtr->lastValue.f = LinkedVar(float);
return Tcl_NewDoubleObj(linkPtr->lastValue.f);
- case TCL_LINK_WIDE_UINT:
+ case TCL_LINK_WIDE_UINT: {
if (linkPtr->flags & LINK_ALLOC_LAST) {
memcpy(linkPtr->lastValue.aryPtr, linkPtr->addr, linkPtr->bytes);
objv = (Tcl_Obj **)ckalloc(linkPtr->numElems * sizeof(Tcl_Obj *));
for (i=0; i < linkPtr->numElems; i++) {
- TclNewIntObj(objv[i], (Tcl_WideInt)
+ TclNewUIntObj(objv[i],
linkPtr->lastValue.uwPtr[i]);
}
resultObj = Tcl_NewListObj(linkPtr->numElems, objv);
@@ -1464,7 +1464,10 @@ ObjValue(
return resultObj;
}
linkPtr->lastValue.uw = LinkedVar(Tcl_WideUInt);
- return Tcl_NewWideIntObj((Tcl_WideInt) linkPtr->lastValue.uw);
+ Tcl_Obj *uwObj;
+ TclNewUIntObj(uwObj, linkPtr->lastValue.uw);
+ return uwObj;
+ }
case TCL_LINK_STRING:
p = LinkedVar(char *);