summaryrefslogtreecommitdiffstats
path: root/libtommath/bn_mp_tc_and.c
diff options
context:
space:
mode:
Diffstat (limited to 'libtommath/bn_mp_tc_and.c')
-rw-r--r--libtommath/bn_mp_tc_and.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/libtommath/bn_mp_tc_and.c b/libtommath/bn_mp_tc_and.c
index e9fe4c6..9834dc6 100644
--- a/libtommath/bn_mp_tc_and.c
+++ b/libtommath/bn_mp_tc_and.c
@@ -9,19 +9,20 @@
* Michael Fromberger but has been written from scratch with
* additional optimizations in place.
*
- * The library is free for all purposes without any express
- * guarantee it works.
+ * SPDX-License-Identifier: Unlicense
*/
/* two complement and */
int mp_tc_and(const mp_int *a, const mp_int *b, mp_int *c)
{
- int res = MP_OKAY, bits;
+ int res = MP_OKAY, bits, abits, bbits;
int as = mp_isneg(a), bs = mp_isneg(b);
mp_int *mx = NULL, _mx, acpy, bcpy;
if ((as != MP_NO) || (bs != MP_NO)) {
- bits = MAX(mp_count_bits(a), mp_count_bits(b));
+ abits = mp_count_bits(a);
+ bbits = mp_count_bits(b);
+ bits = MAX(abits, bbits);
res = mp_init_set_int(&_mx, 1uL);
if (res != MP_OKAY) {
goto end;