summaryrefslogtreecommitdiffstats
path: root/generic/tclTomMathInterface.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2019-03-28 20:59:03 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2019-03-28 20:59:03 (GMT)
commitabf9722f425fcd4a8327dddaf5c5ccf08b1d30d6 (patch)
treef7fcce47ca0f81f1eb0ec24efb9e34025ae158eb /generic/tclTomMathInterface.c
parentd74f47cb2ad9e4fa4b038c1a2205f3e8becc2af0 (diff)
downloadtcl-abf9722f425fcd4a8327dddaf5c5ccf08b1d30d6.zip
tcl-abf9722f425fcd4a8327dddaf5c5ccf08b1d30d6.tar.gz
tcl-abf9722f425fcd4a8327dddaf5c5ccf08b1d30d6.tar.bz2
Turn KARATSUBA_MUL_CUTOFF (insize libtommath) et al into a #define in stead of exported int symbols.
Diffstat (limited to 'generic/tclTomMathInterface.c')
-rw-r--r--generic/tclTomMathInterface.c81
1 files changed, 3 insertions, 78 deletions
diff --git a/generic/tclTomMathInterface.c b/generic/tclTomMathInterface.c
index 48db8c3..d7da4ee 100644
--- a/generic/tclTomMathInterface.c
+++ b/generic/tclTomMathInterface.c
@@ -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
/*
*----------------------------------------------------------------------
@@ -219,7 +144,7 @@ TclBNInitBignumFromLong(
p = a->dp;
while (v) {
*p++ = (mp_digit) (v & MP_MASK);
- v >>= MP_DIGIT_BIT;
+ v >>= DIGIT_BIT;
}
a->used = p - a->dp;
}
@@ -287,7 +212,7 @@ TclBNInitBignumFromWideUInt(
Tcl_Panic("initialization failure in TclBNInitBignumFromWideUInt");
}
- a->sign = MP_ZPOS;
+ a->sign = 0;
/*
* Store the magnitude in the bignum.
@@ -296,7 +221,7 @@ TclBNInitBignumFromWideUInt(
p = a->dp;
while (v) {
*p++ = (mp_digit) (v & MP_MASK);
- v >>= MP_DIGIT_BIT;
+ v >>= DIGIT_BIT;
}
a->used = p - a->dp;
}