decodetree: Force Python to print unsigned values
PATCH 1/1 decodetree: Force Python to print unsigned values
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.
--- scripts/decodetree.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/decodetree.py +2 -2
@@ -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):
Signature · 1 line
2.19.1
Richard Henderson
AppliedQuoted 9 lines · Philippe Mathieu-Daudé
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é <[email protected]>--- scripts/decodetree.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Queued, thanks.
r~
Hi Richard,
Quoted 6 lines · Richard Henderson
Quoted 5 lines · Philippe Mathieu-Daudé
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.
Quoted 6 lines
Quoted 4 lines
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- scripts/decodetree.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)Queued, thanks.
Can you drop this from your queue? I'll send a cleaner approach (as RFC, and I also want to log the error I got in the commit msg).
Thanks,
Phil.
Quoted 11 lines · Philippe Mathieu-Daudé
Quoted 11 lines · Philippe Mathieu-Daudé
Quoted 9 lines
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é <[email protected]>--- scripts/decodetree.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 4 lines
Quoted 1 line
Queued, thanks.
Can you drop this from your queue? I'll send a cleaner approach (as RFC, and I also want to log the error I got in the commit msg).
Done.
r~