about summary refs log tree commit diff stats
path: root/miasm/core/utils.py
diff options
context:
space:
mode:
authorFabrice Desclaux <fabrice.desclaux@cea.fr>2020-07-21 15:37:39 +0200
committerFabrice Desclaux <fabrice.desclaux@cea.fr>2020-07-21 16:47:59 +0200
commit82c5d696eb97b5816a276cbf9708d0b3602d7055 (patch)
treee90ca108dd1c130d015a3960051276d2c58d233a /miasm/core/utils.py
parent9bf0f4c1c14d318110b56df6952b0fcc2950539e (diff)
downloadfocaccia-miasm-82c5d696eb97b5816a276cbf9708d0b3602d7055.tar.gz
focaccia-miasm-82c5d696eb97b5816a276cbf9708d0b3602d7055.zip
Move modint in core
Diffstat (limited to 'miasm/core/utils.py')
-rw-r--r--miasm/core/utils.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/miasm/core/utils.py b/miasm/core/utils.py
index 37248c40..ed630bde 100644
--- a/miasm/core/utils.py
+++ b/miasm/core/utils.py
@@ -129,6 +129,9 @@ def decode_hex(value):
 def encode_hex(value):
     return _ENCODE_HEX(value)[0]
 
+def size2mask(size):
+    """Return the bit mask of size @size"""
+    return (1 << size) - 1
 
 def hexdump(src, length=16):
     lines = []