summaryrefslogtreecommitdiffstats
path: root/libtommath/tommath.h
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2019-03-27 20:05:26 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2019-03-27 20:05:26 (GMT)
commit9535d1ecdc9355cff86a0335a55d50a5da242457 (patch)
tree011ce18ce878a709f99580d2bde5dd2c1d0b1d1f /libtommath/tommath.h
parent9eb32ba719b38f3e5efbb79dddcd22c42d241693 (diff)
downloadtcl-9535d1ecdc9355cff86a0335a55d50a5da242457.zip
tcl-9535d1ecdc9355cff86a0335a55d50a5da242457.tar.gz
tcl-9535d1ecdc9355cff86a0335a55d50a5da242457.tar.bz2
Document maximum value for right argument of '**' operator.
Adapt test-cases to test for exactly one more than this maximum value. Make sure that the maximum is the same for DIGIT_BIT > 28. Change macro's for mp_iseven()/mp_isodd() so they don't depend on value of DIGIT_BIT any more.
Diffstat (limited to 'libtommath/tommath.h')
-rw-r--r--libtommath/tommath.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/libtommath/tommath.h b/libtommath/tommath.h
index c240d80..00c8b35 100644
--- a/libtommath/tommath.h
+++ b/libtommath/tommath.h
@@ -190,8 +190,8 @@ int mp_init_size(mp_int *a, int size);
/* ---> Basic Manipulations <--- */
#define mp_iszero(a) (((a)->used == 0) ? MP_YES : MP_NO)
-#define mp_iseven(a) ((((a)->used == 0) || (((a)->dp[0] & 1u) == 0u)) ? MP_YES : MP_NO)
-#define mp_isodd(a) ((((a)->used > 0) && (((a)->dp[0] & 1u) == 1u)) ? MP_YES : MP_NO)
+#define mp_iseven(a) (!mp_get_bit((a),0))
+#define mp_isodd(a) mp_get_bit((a),0)
#define mp_isneg(a) (((a)->sign != MP_ZPOS) ? MP_YES : MP_NO)
/* set to zero */