Import Tcl 8.6.10
This commit is contained in:
@@ -89,81 +89,6 @@ TclBN_revision(void)
|
||||
{
|
||||
return TCLTOMMATH_REVISION;
|
||||
}
|
||||
#if 0
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* TclBNAlloc --
|
||||
*
|
||||
* Allocate memory for libtommath.
|
||||
*
|
||||
* Results:
|
||||
* Returns a pointer to the allocated block.
|
||||
*
|
||||
* This procedure is a wrapper around Tcl_Alloc, needed because of a
|
||||
* mismatched type signature between Tcl_Alloc and malloc.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
extern void *
|
||||
TclBNAlloc(
|
||||
size_t x)
|
||||
{
|
||||
return (void *) ckalloc((unsigned int) x);
|
||||
}
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* TclBNRealloc --
|
||||
*
|
||||
* Change the size of an allocated block of memory in libtommath
|
||||
*
|
||||
* Results:
|
||||
* Returns a pointer to the allocated block.
|
||||
*
|
||||
* This procedure is a wrapper around Tcl_Realloc, needed because of a
|
||||
* mismatched type signature between Tcl_Realloc and realloc.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
void *
|
||||
TclBNRealloc(
|
||||
void *p,
|
||||
size_t s)
|
||||
{
|
||||
return (void *) ckrealloc((char *) p, (unsigned int) s);
|
||||
}
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* TclBNFree --
|
||||
*
|
||||
* Free allocated memory in libtommath.
|
||||
*
|
||||
* Results:
|
||||
* None.
|
||||
*
|
||||
* Side effects:
|
||||
* Memory is freed.
|
||||
*
|
||||
* This function is simply a wrapper around Tcl_Free, needed in libtommath
|
||||
* because of a type mismatch between free and Tcl_Free.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
extern void
|
||||
TclBNFree(
|
||||
void *p)
|
||||
{
|
||||
ckree((char *) p);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
@@ -181,7 +106,7 @@ TclBNFree(
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
extern void
|
||||
int
|
||||
TclBNInitBignumFromLong(
|
||||
mp_int *a,
|
||||
long initVal)
|
||||
@@ -194,8 +119,7 @@ TclBNInitBignumFromLong(
|
||||
* Allocate enough memory to hold the largest possible long
|
||||
*/
|
||||
|
||||
status = mp_init_size(a,
|
||||
(CHAR_BIT * sizeof(long) + DIGIT_BIT - 1) / DIGIT_BIT);
|
||||
status = mp_init(a);
|
||||
if (status != MP_OKAY) {
|
||||
Tcl_Panic("initialization failure in TclBNInitBignumFromLong");
|
||||
}
|
||||
@@ -222,6 +146,7 @@ TclBNInitBignumFromLong(
|
||||
v >>= MP_DIGIT_BIT;
|
||||
}
|
||||
a->used = p - a->dp;
|
||||
return MP_OKAY;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -240,7 +165,7 @@ TclBNInitBignumFromLong(
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
extern void
|
||||
int
|
||||
TclBNInitBignumFromWideInt(
|
||||
mp_int *a, /* Bignum to initialize */
|
||||
Tcl_WideInt v) /* Initial value */
|
||||
@@ -251,6 +176,7 @@ TclBNInitBignumFromWideInt(
|
||||
} else {
|
||||
TclBNInitBignumFromWideUInt(a, (Tcl_WideUInt)v);
|
||||
}
|
||||
return MP_OKAY;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -269,7 +195,7 @@ TclBNInitBignumFromWideInt(
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
extern void
|
||||
int
|
||||
TclBNInitBignumFromWideUInt(
|
||||
mp_int *a, /* Bignum to initialize */
|
||||
Tcl_WideUInt v) /* Initial value */
|
||||
@@ -281,13 +207,12 @@ TclBNInitBignumFromWideUInt(
|
||||
* Allocate enough memory to hold the largest possible Tcl_WideUInt.
|
||||
*/
|
||||
|
||||
status = mp_init_size(a,
|
||||
(CHAR_BIT * sizeof(Tcl_WideUInt) + DIGIT_BIT - 1) / DIGIT_BIT);
|
||||
status = mp_init(a);
|
||||
if (status != MP_OKAY) {
|
||||
Tcl_Panic("initialization failure in TclBNInitBignumFromWideUInt");
|
||||
}
|
||||
|
||||
a->sign = MP_ZPOS;
|
||||
a->sign = 0;
|
||||
|
||||
/*
|
||||
* Store the magnitude in the bignum.
|
||||
@@ -299,6 +224,7 @@ TclBNInitBignumFromWideUInt(
|
||||
v >>= MP_DIGIT_BIT;
|
||||
}
|
||||
a->used = p - a->dp;
|
||||
return MP_OKAY;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user