summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/InitSubSyst.32
-rw-r--r--generic/tclBasic.c4
-rw-r--r--generic/tclExecute.c12
-rw-r--r--generic/tclScan.c2
-rw-r--r--generic/tclStrToD.c30
-rw-r--r--generic/tclStubInit.c2
-rw-r--r--generic/tclTomMath.decls5
-rw-r--r--generic/tclTomMath.h8
-rw-r--r--generic/tclTomMathDecls.h17
-rw-r--r--generic/tclUtil.c6
-rw-r--r--libtommath/tommath_private.h3
-rw-r--r--macosx/README2
-rw-r--r--tests/fileSystemEncoding.test2
-rw-r--r--tests/tcltests.tcl2
-rw-r--r--unix/Makefile.in5
-rw-r--r--win/Makefile.in1
-rw-r--r--win/makefile.vc1
17 files changed, 41 insertions, 63 deletions
diff --git a/doc/InitSubSyst.3 b/doc/InitSubSyst.3
index eef801f..3c138a4 100644
--- a/doc/InitSubSyst.3
+++ b/doc/InitSubSyst.3
@@ -3,7 +3,7 @@
'\"
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-'\"
+'\"
.so man.macros
.TH Tcl_InitSubsystems 3 8.7 Tcl "Tcl Library Procedures"
.BS
diff --git a/generic/tclBasic.c b/generic/tclBasic.c
index b4f9d2b..38e64f6 100644
--- a/generic/tclBasic.c
+++ b/generic/tclBasic.c
@@ -6892,7 +6892,7 @@ ExprIsqrtFunc(
if (Tcl_GetBignumFromObj(interp, objv[1], &big) != TCL_OK) {
return TCL_ERROR;
}
- if (big.sign != MP_ZPOS) {
+ if (mp_isneg(&big)) {
mp_clear(&big);
goto negarg;
}
@@ -7166,7 +7166,7 @@ ExprAbsFunc(
}
if (type == TCL_NUMBER_BIG) {
- if (((const mp_int *) ptr)->sign != MP_ZPOS) {
+ if (mp_isneg((const mp_int *) ptr)) {
Tcl_GetBignumFromObj(NULL, objv[1], &big);
tooLarge:
mp_neg(&big, &big);
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index d725140..6e4be61 100644
--- a/generic/tclExecute.c
+++ b/generic/tclExecute.c
@@ -7697,7 +7697,7 @@ ExecuteExtendedBinaryMathOp(
Tcl_TakeBignumFromObj(NULL, value2Ptr, &big2);
/* TODO: internals intrusion */
- if ((w1 > ((Tcl_WideInt) 0)) ^ (big2.sign == MP_ZPOS)) {
+ if ((w1 > ((Tcl_WideInt) 0)) ^ !mp_isneg(&big2)) {
/*
* Arguments are opposite sign; remainder is sum.
*/
@@ -7746,7 +7746,7 @@ ExecuteExtendedBinaryMathOp(
break;
case TCL_NUMBER_BIG:
Tcl_TakeBignumFromObj(NULL, value2Ptr, &big2);
- invalid = big2.sign != MP_ZPOS;
+ invalid = mp_isneg(&big2);
mp_clear(&big2);
break;
default:
@@ -7825,7 +7825,7 @@ ExecuteExtendedBinaryMathOp(
break;
case TCL_NUMBER_BIG:
Tcl_TakeBignumFromObj(NULL, valuePtr, &big1);
- zero = (big1.sign == MP_ZPOS);
+ zero = !mp_isneg(&big1);
mp_clear(&big1);
break;
default:
@@ -7949,7 +7949,7 @@ ExecuteExtendedBinaryMathOp(
oddExponent = (int) (w2 & (Tcl_WideInt)1);
} else {
Tcl_TakeBignumFromObj(NULL, value2Ptr, &big2);
- negativeExponent = big2.sign != MP_ZPOS;
+ negativeExponent = mp_isneg(&big2);
mp_mod_2d(&big2, 1, &big2);
oddExponent = big2.used != 0;
mp_clear(&big2);
@@ -8424,7 +8424,7 @@ TclCompareTwoNumbers(
goto wideCompare;
case TCL_NUMBER_BIG:
Tcl_TakeBignumFromObj(NULL, value2Ptr, &big2);
- if (big2.sign != MP_ZPOS) {
+ if (mp_isneg(&big2)) {
compare = MP_GT;
} else {
compare = MP_LT;
@@ -8461,7 +8461,7 @@ TclCompareTwoNumbers(
}
Tcl_TakeBignumFromObj(NULL, value2Ptr, &big2);
if ((d1 < (double)WIDE_MAX) && (d1 > (double)WIDE_MIN)) {
- if (big2.sign != MP_ZPOS) {
+ if (mp_isneg(&big2)) {
compare = MP_GT;
} else {
compare = MP_LT;
diff --git a/generic/tclScan.c b/generic/tclScan.c
index ba9ccbe..aa4e9c8 100644
--- a/generic/tclScan.c
+++ b/generic/tclScan.c
@@ -942,7 +942,7 @@ Tcl_ScanObjCmd(
int code = Tcl_GetBignumFromObj(interp, objPtr, &big);
if (code == TCL_OK) {
- if (big.sign != MP_ZPOS) {
+ if (mp_isneg(&big)) {
code = TCL_ERROR;
}
mp_clear(&big);
diff --git a/generic/tclStrToD.c b/generic/tclStrToD.c
index 3f5b8d2..ea260d9 100644
--- a/generic/tclStrToD.c
+++ b/generic/tclStrToD.c
@@ -4481,10 +4481,10 @@ TclBignumToDouble(
bits = mp_count_bits(a);
if (bits > DBL_MAX_EXP*log2FLT_RADIX) {
errno = ERANGE;
- if (a->sign == MP_ZPOS) {
- return HUGE_VAL;
- } else {
+ if (mp_isneg(a)) {
return -HUGE_VAL;
+ } else {
+ return HUGE_VAL;
}
}
shift = mantBits - bits;
@@ -4514,10 +4514,10 @@ TclBignumToDouble(
mp_div_2d(a, -shift, &b, NULL);
if (mp_isodd(&b)) {
- if (b.sign == MP_ZPOS) {
- mp_add_d(&b, 1, &b);
- } else {
+ if (mp_isneg(&b)) {
mp_sub_d(&b, 1, &b);
+ } else {
+ mp_add_d(&b, 1, &b);
}
}
} else {
@@ -4527,10 +4527,10 @@ TclBignumToDouble(
*/
mp_div_2d(a, -1-shift, &b, NULL);
- if (b.sign == MP_ZPOS) {
- mp_add_d(&b, 1, &b);
- } else {
+ if (mp_isneg(&b)) {
mp_sub_d(&b, 1, &b);
+ } else {
+ mp_add_d(&b, 1, &b);
}
mp_div_2d(&b, 1, &b, NULL);
}
@@ -4556,10 +4556,10 @@ TclBignumToDouble(
* Return the result with the appropriate sign.
*/
- if (a->sign == MP_ZPOS) {
- return r;
- } else {
+ if (mp_isneg(a)) {
return -r;
+ } else {
+ return r;
}
}
@@ -4585,7 +4585,7 @@ TclCeil(
mp_int b;
mp_init(&b);
- if (a->sign != MP_ZPOS) {
+ if (mp_isneg(a)) {
mp_neg(a, &b);
r = -TclFloor(&b);
} else {
@@ -4642,7 +4642,7 @@ TclFloor(
mp_int b;
mp_init(&b);
- if (a->sign != MP_ZPOS) {
+ if (mp_isneg(a)) {
mp_neg(a, &b);
r = -TclCeil(&b);
} else {
@@ -4732,7 +4732,7 @@ BignumToBiasedFrExp(
*/
*machexp = bits - mantBits + 2;
- return ((a->sign == MP_ZPOS) ? r : -r);
+ return (mp_isneg(a) ? -r : r);
}
/*
diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c
index ee6c67b..6995360 100644
--- a/generic/tclStubInit.c
+++ b/generic/tclStubInit.c
@@ -638,7 +638,7 @@ const TclTomMathStubs tclTomMathStubs = {
TclBN_mp_get_mag_ull, /* 69 */
0, /* 70 */
TclBN_mp_get_mag_ul, /* 71 */
- TclBN_mp_isodd, /* 72 */
+ 0, /* 72 */
0, /* 73 */
0, /* 74 */
0, /* 75 */
diff --git a/generic/tclTomMath.decls b/generic/tclTomMath.decls
index 49d6fca..c0977c4 100644
--- a/generic/tclTomMath.decls
+++ b/generic/tclTomMath.decls
@@ -214,10 +214,7 @@ declare 69 {
Tcl_WideUInt MP_WUR TclBN_mp_get_mag_ull(const mp_int *a)
}
declare 71 {
- unsigned long TclBN_mp_get_mag_ul(const mp_int *a)
-}
-declare 72 {
- mp_bool MP_WUR TclBN_mp_isodd(const mp_int *a)
+ unsigned long MP_WUR TclBN_mp_get_mag_ul(const mp_int *a)
}
# Added in libtommath 1.1.0
diff --git a/generic/tclTomMath.h b/generic/tclTomMath.h
index 5f93c19..557eff1 100644
--- a/generic/tclTomMath.h
+++ b/generic/tclTomMath.h
@@ -298,12 +298,8 @@ mp_err mp_init_size(mp_int *a, int size) MP_WUR;
/* ---> Basic Manipulations <--- */
#define mp_iszero(a) (((a)->used == 0) ? MP_YES : MP_NO)
-/*
-mp_bool mp_iseven(const mp_int *a) MP_WUR;
-*/
-/*
-mp_bool mp_isodd(const mp_int *a) MP_WUR;
-*/
+#define mp_isodd(a) (((a)->used != 0 && (((a)->dp[0] & 1) == 1)) ? MP_YES : MP_NO)
+#define mp_iseven(a) (((a)->used == 0 || (((a)->dp[0] & 1) == 0)) ? MP_YES : MP_NO)
#define mp_isneg(a) (((a)->sign != MP_ZPOS) ? MP_YES : MP_NO)
/* set to zero */
diff --git a/generic/tclTomMathDecls.h b/generic/tclTomMathDecls.h
index 9be7e12..c1f3a4c 100644
--- a/generic/tclTomMathDecls.h
+++ b/generic/tclTomMathDecls.h
@@ -82,7 +82,6 @@
#define mp_init_set TclBN_mp_init_set
#define mp_init_size TclBN_mp_init_size
#define mp_init_ul TclBN_mp_init_ul
-#define mp_isodd TclBN_mp_isodd
#define mp_lshd TclBN_mp_lshd
#define mp_mod TclBN_mp_mod
#define mp_mod_2d TclBN_mp_mod_2d
@@ -293,9 +292,8 @@ EXTERN void TclBN_mp_set_ull(mp_int *a, Tcl_WideUInt i);
EXTERN Tcl_WideUInt TclBN_mp_get_mag_ull(const mp_int *a) MP_WUR;
/* Slot 70 is reserved */
/* 71 */
-EXTERN unsigned long TclBN_mp_get_mag_ul(const mp_int *a);
-/* 72 */
-EXTERN mp_bool TclBN_mp_isodd(const mp_int *a) MP_WUR;
+EXTERN unsigned long TclBN_mp_get_mag_ul(const mp_int *a) MP_WUR;
+/* Slot 72 is reserved */
/* Slot 73 is reserved */
/* Slot 74 is reserved */
/* Slot 75 is reserved */
@@ -386,8 +384,8 @@ typedef struct TclTomMathStubs {
void (*tclBN_mp_set_ull) (mp_int *a, Tcl_WideUInt i); /* 68 */
Tcl_WideUInt (*tclBN_mp_get_mag_ull) (const mp_int *a) MP_WUR; /* 69 */
void (*reserved70)(void);
- unsigned long (*tclBN_mp_get_mag_ul) (const mp_int *a); /* 71 */
- mp_bool (*tclBN_mp_isodd) (const mp_int *a) MP_WUR; /* 72 */
+ unsigned long (*tclBN_mp_get_mag_ul) (const mp_int *a) MP_WUR; /* 71 */
+ void (*reserved72)(void);
void (*reserved73)(void);
void (*reserved74)(void);
void (*reserved75)(void);
@@ -535,8 +533,7 @@ extern const TclTomMathStubs *tclTomMathStubsPtr;
/* Slot 70 is reserved */
#define TclBN_mp_get_mag_ul \
(tclTomMathStubsPtr->tclBN_mp_get_mag_ul) /* 71 */
-#define TclBN_mp_isodd \
- (tclTomMathStubsPtr->tclBN_mp_isodd) /* 72 */
+/* Slot 72 is reserved */
/* Slot 73 is reserved */
/* Slot 74 is reserved */
/* Slot 75 is reserved */
@@ -553,10 +550,6 @@ extern const TclTomMathStubs *tclTomMathStubsPtr;
/* !END!: Do not edit above this line. */
-#undef mp_isodd
-#define mp_isodd(a) (((a)->used > 0 && (((a)->dp[0] & 1) == 1)) ? MP_YES : MP_NO)
-#define mp_iseven(a) (((a)->used == 0 || (((a)->dp[0] & 1) == 0)) ? MP_YES : MP_NO)
-
#undef TCL_STORAGE_CLASS
#define TCL_STORAGE_CLASS DLLIMPORT
diff --git a/generic/tclUtil.c b/generic/tclUtil.c
index c9d7003..200e319 100644
--- a/generic/tclUtil.c
+++ b/generic/tclUtil.c
@@ -3419,7 +3419,7 @@ GetWideForIndex(
/* objPtr holds an integer outside the signed wide range */
/* Truncate to the signed wide range. */
- *widePtr = (((mp_int *)cd)->sign != MP_ZPOS) ? WIDE_MIN : WIDE_MAX;
+ *widePtr = ((mp_isneg((mp_int *)cd)) ? WIDE_MIN : WIDE_MAX);
return TCL_OK;
}
@@ -3532,7 +3532,7 @@ GetWideForIndex(
} else {
/* sum holds an integer outside the signed wide range */
/* Truncate to the signed wide range. */
- if (((mp_int *)cd)->sign != MP_ZPOS) {
+ if (mp_isneg((mp_int *)cd)) {
*widePtr = WIDE_MIN;
} else {
*widePtr = WIDE_MAX;
@@ -3685,7 +3685,7 @@ GetEndOffsetFromObj(
if (t == TCL_NUMBER_BIG) {
/* Truncate to the signed wide range. */
- if (((mp_int *)cd)->sign != MP_ZPOS) {
+ if (mp_isneg((mp_int *)cd)) {
offset = (bytes[3] == '-') ? WIDE_MAX : WIDE_MIN;
} else {
offset = (bytes[3] == '-') ? WIDE_MIN : WIDE_MAX;
diff --git a/libtommath/tommath_private.h b/libtommath/tommath_private.h
index 61d382d..2e3250c 100644
--- a/libtommath/tommath_private.h
+++ b/libtommath/tommath_private.h
@@ -287,7 +287,4 @@ extern MP_PRIVATE const mp_digit s_mp_prime_tab[];
return (a->sign == MP_NEG) ? (type)-res : (type)res; \
}
-#undef mp_isodd
-#define mp_isodd TclBN_mp_isodd
-
#endif
diff --git a/macosx/README b/macosx/README
index 7419c59..4a97fee 100644
--- a/macosx/README
+++ b/macosx/README
@@ -36,7 +36,7 @@ Weak-linking is available on OS X 10.2 or later, it additionally allows Tcl
built on 10.x to run on any 10.y with x > y >= z (for a chosen z >= 2).
- Tcl extensions can be installed in any of:
- $HOME/Library/Tcl /Library/Tcl
+ $HOME/Library/Tcl /Library/Tcl
$HOME/Library/Frameworks /Library/Frameworks
(searched in that order).
Given a potential package directory $pkg, Tcl on OSX checks for the file
diff --git a/tests/fileSystemEncoding.test b/tests/fileSystemEncoding.test
index 3679652..fa67646 100644
--- a/tests/fileSystemEncoding.test
+++ b/tests/fileSystemEncoding.test
@@ -39,7 +39,7 @@ namespace eval ::tcl::test::fileSystemEncoding {
set globbed [lindex [glob -directory $dir *] 0]
encoding system utf-8
lappend res [file exists $globbed]
- encoding system iso8859-1
+ encoding system iso8859-1
lappend res [file exists $globbed]
return $res
} -cleanup {
diff --git a/tests/tcltests.tcl b/tests/tcltests.tcl
index ea5b978..c3c8650 100644
--- a/tests/tcltests.tcl
+++ b/tests/tcltests.tcl
@@ -21,7 +21,7 @@ namespace eval ::tcltests {
interp alias {} [namespace current]::tempdir {} ::tcl::file::tempdir
}
}
-
+
proc tempdir_alternate {} {
file tempfile tempfile
diff --git a/unix/Makefile.in b/unix/Makefile.in
index 4720cc4..e78369c 100644
--- a/unix/Makefile.in
+++ b/unix/Makefile.in
@@ -330,7 +330,7 @@ TOMMATH_OBJS = bn_s_mp_reverse.o bn_s_mp_mul_digs_fast.o \
bn_s_mp_get_bit.o bn_mp_get_mag_ul.o bn_mp_grow.o bn_mp_init.o \
bn_mp_init_copy.o bn_mp_init_multi.o bn_mp_init_set.o \
bn_mp_init_size.o bn_mp_init_ul.o bn_s_mp_karatsuba_mul.o \
- bn_s_mp_karatsuba_sqr.o bn_s_mp_balance_mul.o bn_mp_isodd.o \
+ bn_s_mp_karatsuba_sqr.o bn_s_mp_balance_mul.o \
bn_mp_lshd.o bn_mp_mod.o bn_mp_mod_2d.o bn_mp_mul.o bn_mp_mul_2.o \
bn_mp_mul_2d.o bn_mp_mul_d.o bn_mp_neg.o bn_mp_or.o \
bn_mp_radix_size.o bn_mp_radix_smap.o \
@@ -1645,9 +1645,6 @@ bn_s_mp_karatsuba_sqr.o: $(TOMMATH_DIR)/bn_s_mp_karatsuba_sqr.c $(MATHHDRS)
bn_s_mp_balance_mul.o: $(TOMMATH_DIR)/bn_s_mp_balance_mul.c $(MATHHDRS)
$(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_s_mp_balance_mul.c
-bn_mp_isodd.o: $(TOMMATH_DIR)/bn_mp_isodd.c $(MATHHDRS)
- $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_isodd.c
-
bn_mp_lshd.o: $(TOMMATH_DIR)/bn_mp_lshd.c $(MATHHDRS)
$(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_lshd.c
diff --git a/win/Makefile.in b/win/Makefile.in
index 4b49186..0596a09 100644
--- a/win/Makefile.in
+++ b/win/Makefile.in
@@ -388,7 +388,6 @@ TOMMATH_OBJS = \
bn_mp_init_set.${OBJEXT} \
bn_mp_init_size.${OBJEXT} \
bn_mp_init_ul.${OBJEXT} \
- bn_mp_isodd.${OBJEXT} \
bn_mp_lshd.${OBJEXT} \
bn_mp_mod.${OBJEXT} \
bn_mp_mod_2d.${OBJEXT} \
diff --git a/win/makefile.vc b/win/makefile.vc
index e97c85f..97f59ae 100644
--- a/win/makefile.vc
+++ b/win/makefile.vc
@@ -342,7 +342,6 @@ TOMMATHOBJS = \
$(TMP_DIR)\bn_mp_init_set.obj \
$(TMP_DIR)\bn_mp_init_size.obj \
$(TMP_DIR)\bn_mp_init_ul.obj \
- $(TMP_DIR)\bn_mp_isodd.obj \
$(TMP_DIR)\bn_mp_lshd.obj \
$(TMP_DIR)\bn_mp_mod.obj \
$(TMP_DIR)\bn_mp_mod_2d.obj \