diff options
| author | griffin <briang42@easystreet.net> | 2022-11-24 03:32:46 (GMT) |
|---|---|---|
| committer | griffin <briang42@easystreet.net> | 2022-11-24 03:32:46 (GMT) |
| commit | a4e76a1c02f39e24cbf6ee4543ce76e34727cecd (patch) | |
| tree | e1d9340dca5ec520a60fa97635105588433107a4 /generic/tclLink.c | |
| parent | 7b6d0229053cd8590549a3d9c256b97125455fd6 (diff) | |
| parent | 6932d0c2d01a49afe9c6b163f3a3d939b0e2d603 (diff) | |
| download | tcl-a4e76a1c02f39e24cbf6ee4543ce76e34727cecd.zip tcl-a4e76a1c02f39e24cbf6ee4543ce76e34727cecd.tar.gz tcl-a4e76a1c02f39e24cbf6ee4543ce76e34727cecd.tar.bz2 | |
Sync with trunk
Diffstat (limited to 'generic/tclLink.c')
| -rw-r--r-- | generic/tclLink.c | 39 |
1 files changed, 6 insertions, 33 deletions
diff --git a/generic/tclLink.c b/generic/tclLink.c index af6bd22..1985151 100644 --- a/generic/tclLink.c +++ b/generic/tclLink.c @@ -527,41 +527,14 @@ GetUWide( Tcl_Obj *objPtr, Tcl_WideUInt *uwidePtr) { - Tcl_WideInt *widePtr = (Tcl_WideInt *) uwidePtr; - void *clientData; - int type, intValue; - - if (Tcl_GetNumberFromObj(NULL, objPtr, &clientData, &type) == TCL_OK) { - if (type == TCL_NUMBER_INT) { - *widePtr = *((const Tcl_WideInt *) clientData); - return (*widePtr < 0); - } else if (type == TCL_NUMBER_BIG) { - mp_int *numPtr = (mp_int *)clientData; - Tcl_WideUInt value = 0; - size_t numBytes; - - if (numPtr->sign || (MP_OKAY != mp_pack(&value, 1, - &numBytes, 0, sizeof(Tcl_WideUInt), 0, 0, numPtr))) { - /* - * If the sign bit is set (a negative value) or if the value - * can't possibly fit in the bits of an unsigned wide, there's - * no point in doing further conversion. - */ - return 1; - } - *uwidePtr = value; - return 0; - } - } - - /* - * Evil edge case fallback. - */ + if (Tcl_GetWideUIntFromObj(NULL, objPtr, uwidePtr) != TCL_OK) { + int intValue; - if (GetInvalidIntFromObj(objPtr, &intValue) != TCL_OK) { - return 1; + if (GetInvalidIntFromObj(objPtr, &intValue) != TCL_OK) { + return 1; + } + *uwidePtr = intValue; } - *uwidePtr = intValue; return 0; } |
