Python internal representation is signed, so unsigned values
bigger than 31-bit are interpreted as signed (and printed with
a '-' signed).
Mask out to force unsigned values.

Signed-off-by: Philippe Mathieu-Daudé <f4...@amsat.org>
---
 scripts/decodetree.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/decodetree.py b/scripts/decodetree.py
index 5dea15e7a5..a24017d33e 100755
--- a/scripts/decodetree.py
+++ b/scripts/decodetree.py
@@ -895,10 +895,10 @@ class Tree:
                 return '0x{0:x}'.format(b >> sh)
         else:
             def str_switch(b):
-                return 'insn & 0x{0:08x}'.format(b)
+                return 'insn & 0x{0:08x}'.format(b & 0xffffffff)
 
             def str_case(b):
-                return '0x{0:08x}'.format(b)
+                return '0x{0:08x}'.format(b & 0xffffffff)
 
         output(ind, 'switch (', str_switch(self.thismask), ') {\n')
         for b, s in sorted(self.subs):
-- 
2.19.1


Reply via email to