summaryrefslogtreecommitdiffstats
path: root/generic/tclObj.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tclObj.c')
-rw-r--r--generic/tclObj.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/generic/tclObj.c b/generic/tclObj.c
index b4611bc..7ba65c0 100644
--- a/generic/tclObj.c
+++ b/generic/tclObj.c
@@ -3035,11 +3035,12 @@ Tcl_GetLongFromObj(
{
mp_int big;
- unsigned long scratch, value = 0, numBytes = sizeof(unsigned long);
+ unsigned long scratch, value = 0;
unsigned char *bytes = (unsigned char *) &scratch;
+ size_t numBytes;
TclUnpackBignum(objPtr, big);
- if (mp_to_unsigned_bin_n(&big, bytes, &numBytes) == MP_OKAY) {
+ if (mp_to_ubin(&big, bytes, sizeof(long), &numBytes) == MP_OKAY) {
while (numBytes-- > 0) {
value = (value << CHAR_BIT) | *bytes++;
}
@@ -3278,12 +3279,12 @@ Tcl_GetWideIntFromObj(
mp_int big;
Tcl_WideUInt value = 0;
- unsigned long numBytes = sizeof(Tcl_WideInt);
+ size_t numBytes;
Tcl_WideInt scratch;
unsigned char *bytes = (unsigned char *) &scratch;
TclUnpackBignum(objPtr, big);
- if (mp_to_unsigned_bin_n(&big, bytes, &numBytes) == MP_OKAY) {
+ if (mp_to_ubin(&big, bytes, sizeof(Tcl_WideInt), &numBytes) == MP_OKAY) {
while (numBytes-- > 0) {
value = (value << CHAR_BIT) | *bytes++;
}
@@ -3359,12 +3360,12 @@ TclGetWideBitsFromObj(
mp_int big;
Tcl_WideUInt value = 0, scratch;
- unsigned long numBytes = sizeof(Tcl_WideInt);
+ size_t numBytes;
unsigned char *bytes = (unsigned char *) &scratch;
Tcl_GetBignumFromObj(NULL, objPtr, &big);
mp_mod_2d(&big, (int) (CHAR_BIT * sizeof(Tcl_WideInt)), &big);
- mp_to_unsigned_bin_n(&big, bytes, &numBytes);
+ mp_to_ubin(&big, bytes, sizeof(Tcl_WideInt), &numBytes);
while (numBytes-- > 0) {
value = (value << CHAR_BIT) | *bytes++;
}
@@ -3484,7 +3485,7 @@ UpdateStringOfBignum(
stringVal = Tcl_InitStringRep(objPtr, NULL, size - 1);
TclOOM(stringVal, size);
- if (MP_OKAY != mp_toradix_n(&bignumVal, stringVal, 10, size)) {
+ if (MP_OKAY != mp_to_radix(&bignumVal, stringVal, size, NULL, 10)) {
Tcl_Panic("conversion failure in UpdateStringOfBignum");
}
(void) Tcl_InitStringRep(objPtr, NULL, size - 1);
@@ -3626,7 +3627,7 @@ GetBignumFromObj(
return TCL_OK;
}
if (objPtr->typePtr == &tclIntType) {
- TclInitBignumFromWideInt(bignumValue,
+ TclBNInitBignumFromWideInt(bignumValue,
objPtr->internalRep.wideValue);
return TCL_OK;
}
@@ -3736,14 +3737,14 @@ Tcl_SetBignumObj(
mp_int *bignumValue) /* Value to store */
{
Tcl_WideUInt value = 0;
- unsigned long numBytes = sizeof(Tcl_WideUInt);
+ size_t numBytes;
Tcl_WideUInt scratch;
unsigned char *bytes = (unsigned char *) &scratch;
if (Tcl_IsShared(objPtr)) {
Tcl_Panic("%s called with shared object", "Tcl_SetBignumObj");
}
- if (mp_to_unsigned_bin_n(bignumValue, bytes, &numBytes) != MP_OKAY) {
+ if (mp_to_ubin(bignumValue, bytes, sizeof(Tcl_WideUInt), &numBytes) != MP_OKAY) {
goto tooLargeForWide;
}
while (numBytes-- > 0) {