Index: generic/nsf.c =================================================================== diff -u -rfd39317a31fcc1aae5985fb0236901b910b4bae3 -r802ecff8cf163e6c1e8e6cf8eb590fddc5097e06 --- generic/nsf.c (.../nsf.c) (revision fd39317a31fcc1aae5985fb0236901b910b4bae3) +++ generic/nsf.c (.../nsf.c) (revision 802ecff8cf163e6c1e8e6cf8eb590fddc5097e06) @@ -163,7 +163,6 @@ *Nsf_OT_tclCmdNameType = NULL, *Nsf_OT_listType = NULL, *Nsf_OT_doubleType = NULL, -//*Nsf_OT_bignumType = NULL, *Nsf_OT_intType = NULL; /* @@ -9461,7 +9460,6 @@ * *---------------------------------------------------------------------- */ -//void foo() {;} #include int @@ -9473,27 +9471,31 @@ * Try to short_cut common cases to avoid conversion to bignums, since * Tcl_GetBignumFromObj returns a value, which has to be freed. */ - if (objPtr->typePtr == Nsf_OT_intType /*|| objPtr->typePtr == Nsf_OT_bignumType*/) { - //fprintf(stderr, "shortcut OK\n"); + if (objPtr->typePtr == Nsf_OT_intType) { + /* + * We know already, that the value is an int + */ result = TCL_OK; } else if (objPtr->typePtr == Nsf_OT_doubleType) { - //fprintf(stderr, "shortcut NOT OK\n"); + /* + * We know already, that the value is not an int + */ result = TCL_ERROR; } else { mp_int bignumValue; - //if (objPtr->typePtr) { - // fprintf(stderr, "type is on call %p %s value %s bignum %p\n", - // objPtr->typePtr, objPtr->typePtr? objPtr->typePtr->name:"NULL", ObjStr(objPtr), - // Nsf_OT_bignumType); - //} + /* + * We have to figure out, whether the value is an int. We perform this + * test via Tcl_GetBignumFromObj(), which tries to keep the type small if + * possible (e.g. it might return type "int" or "float" when appropriate. + */ - result = Tcl_GetBignumFromObj(interp, objPtr, &bignumValue); + /*if (objPtr->typePtr) { + fprintf(stderr, "type is on call %p %s value %s \n", + objPtr->typePtr, objPtr->typePtr? objPtr->typePtr->name:"NULL", ObjStr(objPtr)); + }*/ - //fprintf(stderr, "type after call %p %s\n", - // objPtr->typePtr, objPtr->typePtr? objPtr->typePtr->name:"NULL"); - - if (result == TCL_OK) { + if ((result = Tcl_GetBignumFromObj(interp, objPtr, &bignumValue)) == TCL_OK) { mp_clear(&bignumValue); } } @@ -20977,19 +20979,6 @@ Nsf_OT_doubleType = Tcl_GetObjType("double"); assert(Nsf_OT_doubleType); -#if 0 - { - mp_int bignumValue; - Tcl_Obj *objPtr; - - mp_init(&bignumValue); - objPtr = Tcl_NewBignumObj(&bignumValue); - Nsf_OT_bignumType = objPtr->typePtr; - DECR_REF_COUNT(objPtr); - //mp_clear(&bignumValue); - } - assert(Nsf_OT_bignumType); -#endif NsfMutexUnlock(&initMutex); /* Index: tests/parameters.test =================================================================== diff -u -rfd39317a31fcc1aae5985fb0236901b910b4bae3 -r802ecff8cf163e6c1e8e6cf8eb590fddc5097e06 --- tests/parameters.test (.../parameters.test) (revision fd39317a31fcc1aae5985fb0236901b910b4bae3) +++ tests/parameters.test (.../parameters.test) (revision 802ecff8cf163e6c1e8e6cf8eb590fddc5097e06) @@ -1642,7 +1642,7 @@ # # Test integer, wideinteger and bignums # -Test parameter count 1 +Test parameter count 1000 Test case bignums { ::nx::Object create o {