about summary refs log tree commit diff stats
path: root/miasm2/jitter/bn.c
diff options
context:
space:
mode:
authorFabrice Desclaux <fabrice.desclaux@cea.fr>2018-09-18 12:44:13 +0200
committerFabrice Desclaux <fabrice.desclaux@cea.fr>2018-09-19 09:54:11 +0200
commit1b477380792d2b3e045d2f851cc9de01f9452b5a (patch)
treef67946deb2900487b7961731d08623d13ee61129 /miasm2/jitter/bn.c
parent22532774f6e6f8807f98e7dd82abcbf83e7d5057 (diff)
downloadmiasm-1b477380792d2b3e045d2f851cc9de01f9452b5a.tar.gz
miasm-1b477380792d2b3e045d2f851cc9de01f9452b5a.zip
Bignum: allow mask even for max bignum size
Diffstat (limited to '')
-rw-r--r--miasm2/jitter/bn.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/miasm2/jitter/bn.c b/miasm2/jitter/bn.c
index 9462de2c..96e66f4d 100644
--- a/miasm2/jitter/bn.c
+++ b/miasm2/jitter/bn.c
@@ -615,10 +615,9 @@ bn_t bignum_mask(bn_t src, int bits)
 	bn_t dst;
 	bn_t mask;
 
-	mask = bignum_from_int(1);
-	mask = bignum_lshift(mask, bits);
+	mask = bignum_from_int(0);
 	mask = bignum_dec(mask);
-
+	mask = bignum_rshift(mask, BN_BIT_SIZE - bits);
 	dst = bignum_and(src, mask);
 	return dst;
 }