summaryrefslogtreecommitdiffstats
path: root/generic/tclTomMathInterface.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2019-03-15 20:52:25 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2019-03-15 20:52:25 (GMT)
commit2ff70c01f60ef1dbb586489d97b1f36368ad6741 (patch)
tree818e1ae3cdf91deda3a567394b28a643beebaba6 /generic/tclTomMathInterface.c
parentd7fe4af6212051638be9eb9f6912e844e51fb22c (diff)
downloadtcl-2ff70c01f60ef1dbb586489d97b1f36368ad6741.zip
tcl-2ff70c01f60ef1dbb586489d97b1f36368ad6741.tar.gz
tcl-2ff70c01f60ef1dbb586489d97b1f36368ad6741.tar.bz2
Eliminate usage of mp_isneg(), just check bignum->sign directly (as libtommath itself does)
Make TclInitBugnumFromLong() a static function in stubtable only, as it isn't used by Tcl anymore.
Diffstat (limited to 'generic/tclTomMathInterface.c')
-rw-r--r--generic/tclTomMathInterface.c38
1 files changed, 3 insertions, 35 deletions
diff --git a/generic/tclTomMathInterface.c b/generic/tclTomMathInterface.c
index 9e7bf4b..236a8cf 100644
--- a/generic/tclTomMathInterface.c
+++ b/generic/tclTomMathInterface.c
@@ -93,39 +93,7 @@ TclBN_revision(void)
/*
*----------------------------------------------------------------------
*
- * TclInitBignumFromLong --
- *
- * Allocate and initialize a 'bignum' from a native 'long'.
- *
- * Results:
- * None.
- *
- * Side effects:
- * The 'bignum' is constructed.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TclInitBignumFromLong(
- mp_int *a,
- long v)
-{
- if (mp_init_size(a, (CHAR_BIT * sizeof(long) + DIGIT_BIT - 1) / DIGIT_BIT) != MP_OKAY) {
- Tcl_Panic("initialization failure in TclInitBignumFromLong");
- }
- if (v < (long)0) {
- mp_set_long_long(a, (Tcl_WideUInt)(-(Tcl_WideInt)v));
- mp_neg(a, a);
- } else {
- mp_set_long_long(a, (Tcl_WideUInt)v);
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TclBNInitBignumFromWideInt --
+ * TclInitBignumFromWideInt --
*
* Allocate and initialize a 'bignum' from a Tcl_WideInt
*
@@ -146,7 +114,7 @@ TclInitBignumFromWideInt(
if (mp_init_size(a, (CHAR_BIT * sizeof(Tcl_WideUInt) + DIGIT_BIT - 1) / DIGIT_BIT) != MP_OKAY) {
Tcl_Panic("initialization failure in TclInitBignumFromWideInt");
}
- if (v < (Tcl_WideInt)0) {
+ if (v < 0) {
mp_set_long_long(a, (Tcl_WideUInt)(-v));
mp_neg(a, a);
} else {
@@ -157,7 +125,7 @@ TclInitBignumFromWideInt(
/*
*----------------------------------------------------------------------
*
- * TclBNInitBignumFromWideUInt --
+ * TclInitBignumFromWideUInt --
*
* Allocate and initialize a 'bignum' from a Tcl_WideUInt
*