aboutsummaryrefslogtreecommitdiff
path: root/test/Scripts/common_dump.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/Scripts/common_dump.py')
-rw-r--r--test/Scripts/common_dump.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/test/Scripts/common_dump.py b/test/Scripts/common_dump.py
index 3d69c3fb27..cd0c493451 100644
--- a/test/Scripts/common_dump.py
+++ b/test/Scripts/common_dump.py
@@ -40,7 +40,8 @@ def HexDump(val, numBits=32):
4. Do print 0x Why?
so that they can be easily distinguished using sed/rx
"""
+ assert 0 <= val < (1 << numBits)
+
val = val & (( 1 << numBits) - 1)
newFmt = "0x%0" + "%d" % (numBits / 4) + "x"
return newFmt % val
-