diff options
Diffstat (limited to 'generic/tclBasic.c')
-rw-r--r-- | generic/tclBasic.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 511258f..caffa5f 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -13,7 +13,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclBasic.c,v 1.193 2006/03/06 21:56:34 dgp Exp $ + * RCS: @(#) $Id: tclBasic.c,v 1.194 2006/05/04 12:55:49 dgp Exp $ */ #include "tclInt.h" @@ -5677,9 +5677,20 @@ ExprSrandFunc( return TCL_ERROR; } - if (Tcl_GetLongFromObj(interp, objv[1], &i) != TCL_OK) { - /* TODO: more ::errorInfo here? or in caller? */ - return TCL_ERROR; + if (Tcl_GetLongFromObj(NULL, objv[1], &i) != TCL_OK) { + Tcl_Obj *objPtr; + mp_int big; + + if (Tcl_GetBignumFromObj(interp, objv[1], &big) != TCL_OK) { + /* TODO: more ::errorInfo here? or in caller? */ + return TCL_ERROR; + } + + mp_mod_2d(&big, (int) CHAR_BIT * sizeof(long), &big); + objPtr = Tcl_NewBignumObj(&big); + Tcl_IncrRefCount(objPtr); + Tcl_GetLongFromObj(NULL, objPtr, &i); + Tcl_DecrRefCount(objPtr); } /* |