summaryrefslogtreecommitdiffstats
path: root/generic/tclObj.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2016-11-17 16:24:37 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2016-11-17 16:24:37 (GMT)
commit2287394ba1bcf13a8abb6b8097f03e995cd3258a (patch)
tree4e47d8e8427fcbad172ecc5ae3e1199345b1aef7 /generic/tclObj.c
parent37f6932c0ae7967ce2de2576acdd0a2fa016791b (diff)
parent8d1caeae4dbe404a28c14bdc0bc3a8e97f6eaaf2 (diff)
downloadtcl-2287394ba1bcf13a8abb6b8097f03e995cd3258a.zip
tcl-2287394ba1bcf13a8abb6b8097f03e995cd3258a.tar.gz
tcl-2287394ba1bcf13a8abb6b8097f03e995cd3258a.tar.bz2
Fix libtommath's mp_radix_size() function such that it returns 2 for single-digit numbers. Add testcases for mp_radix_size() and mp_iseven(). Undo useless change in bn_mp_add_d.c (bring back libtommath's version).
Diffstat (limited to 'generic/tclObj.c')
-rw-r--r--generic/tclObj.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/generic/tclObj.c b/generic/tclObj.c
index 29c8e23..45f79e4 100644
--- a/generic/tclObj.c
+++ b/generic/tclObj.c
@@ -3253,13 +3253,11 @@ UpdateStringOfBignum(
if (status != MP_OKAY) {
Tcl_Panic("radix size failure in UpdateStringOfBignum");
}
- if (size == 3) {
+ if (size < 2) {
/*
- * mp_radix_size() returns 3 when more than INT_MAX bytes would be
+ * mp_radix_size() returns < 2 when more than INT_MAX bytes would be
* needed to hold the string rep (because mp_radix_size ignores
- * integer overflow issues). When we know the string rep will be more
- * than 3, we can conclude the string rep would overflow our string
- * length limits.
+ * integer overflow issues).
*
* Note that so long as we enforce our bignums to the size that fits
* in a packed bignum, this branch will never be taken.