diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-04-05 16:58:41 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-04-05 16:58:41 (GMT) |
commit | 689987ea924a8fded1801777c1a14ab1205fa826 (patch) | |
tree | 1da81fdd9a883d260a13d482dfba4a751bb35d8a /libtommath/bn_mp_is_square.c | |
parent | 7cb32717a995bee029ee18710b3e25e8e73f7377 (diff) | |
download | tcl-689987ea924a8fded1801777c1a14ab1205fa826.zip tcl-689987ea924a8fded1801777c1a14ab1205fa826.tar.gz tcl-689987ea924a8fded1801777c1a14ab1205fa826.tar.bz2 |
Take over improvements from libtommath's development branch (which will appear in next version).
- More efficient MP_SET_XLONG() macro.
- New internal macro's IS_ZERO/IS_EVEN/IS_ODD
- Changed signature for XMALLOC/XREALLOC/XFREE
Diffstat (limited to 'libtommath/bn_mp_is_square.c')
-rw-r--r-- | libtommath/bn_mp_is_square.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/libtommath/bn_mp_is_square.c b/libtommath/bn_mp_is_square.c index 5363a47..1dd1d6c 100644 --- a/libtommath/bn_mp_is_square.c +++ b/libtommath/bn_mp_is_square.c @@ -49,13 +49,12 @@ int mp_is_square(const mp_int *arg, int *ret) return MP_VAL; } - /* digits used? (TSD) */ - if (arg->used == 0) { + if (IS_ZERO(arg)) { return MP_OKAY; } /* First check mod 128 (suppose that DIGIT_BIT is at least 7) */ - if (rem_128[127u & DIGIT(arg, 0)] == (char)1) { + if (rem_128[127u & arg->dp[0]] == (char)1) { return MP_OKAY; } |