about summary refs log tree commit diff stats
path: root/miasm/core/utils.py
diff options
context:
space:
mode:
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 = []