decodetree: Use Python3 floor division operator
This script started using Python2, where the 'classic' division operator returns the floor result. In commit 3d004a371 we started to use Python3, where the division operator returns the float result ('true division').
To keep the same behavior, use the 'floor division' operator "//" which returns the floor result.
---
We didn't notice it because only the RX port (which uses the --varinsnwidth option, and got merged very recently) triggers these problems.
--- scripts/decodetree.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/decodetree.py +2 -2
@@ -1025,7 +1025,7 @@ def output_code(self, i, extracted, outerbits, outermask): if extracted < self.width: output(ind, 'insn = ', decode_function, '_load_bytes(ctx, insn, {0}, {1});\n' - .format(extracted / 8, self.width / 8)); + .format(extracted // 8, self.width // 8)); extracted = self.width # Attempt to aid the compiler in producing compact switch statements.
@@ -1079,7 +1079,7 @@ def output_code(self, i, extracted, outerbits, outermask): if extracted < self.width: output(ind, 'insn = ', decode_function, '_load_bytes(ctx, insn, {0}, {1});\n' - .format(extracted / 8, self.width / 8)); + .format(extracted // 8, self.width // 8)); extracted = self.width output(ind, 'return insn;\n') # end SizeLeaf
Signature · 1 line
2.21.1
Quoted 8 lines · Philippe Mathieu-Daudé
This script started using Python2, where the 'classic' division operator returns the floor result. In commit
3d004a371we started to use Python3, where the division operator returns the float result ('true division').
To keep the same behavior, use the 'floor division' operator "//" which returns the floor result.
Quoted 7 lines
Fixes 3d004a371Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
We didn't notice it because only the RX port (which uses the --varinsnwidth option, and got merged very recently) triggers these problems.Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Ouch. That's a painfully hard to detect incompatibility between 2 and 3 :-(
thanks
-- PMM
Richard Henderson
Reviewed-byQuoted 9 lines · Philippe Mathieu-Daudé
This script started using Python2, where the 'classic' division operator returns the floor result. In commit
3d004a371we started to use Python3, where the division operator returns the float result ('true division').
To keep the same behavior, use the 'floor division' operator "//" which returns the floor result.Fixes 3d004a371Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Quoted 9 lines
---
We didn't notice it because only the RX port (which uses the --varinsnwidth option, and got merged very recently) triggers these problems.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- scripts/decodetree.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
r~
Richard Henderson
AppliedQuoted 20 lines · Richard Henderson
Quoted 9 lines · Philippe Mathieu-Daudé
This script started using Python2, where the 'classic' division operator returns the floor result. In commit
3d004a371we started to use Python3, where the division operator returns the float result ('true division').
To keep the same behavior, use the 'floor division' operator "//" which returns the floor result.Fixes 3d004a371Signed-off-by Philippe Mathieu-Daudé <[email protected]>Quoted 9 lines
---
We didn't notice it because only the RX port (which uses the --varinsnwidth option, and got merged very recently) triggers these problems.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- scripts/decodetree.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 1 line
Reviewed-by Richard Henderson <[email protected]>
Queued to tcg-next for 5.0.
r~
20:47 Pon, 30.03.2020. Richard Henderson <[email protected]> је написао/ла:
Quoted 22 lines · Richard Henderson
Quoted 20 lines · Philippe Mathieu-Daudé
Quoted 18 lines
This script started using Python2, where the 'classic' division operator returns the floor result. In commit
3d004a371we started to use Python3, where the division operator returns the float result ('true division').
To keep the same behavior, use the 'floor division' operator "//" which returns the floor result.Fixes 3d004a371Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
We didn't notice it because only the RX port (which uses the --varinsnwidth option, and got merged very recently) triggers these problems.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
Reviewed-by Richard Henderson <[email protected]>Queued to tcg-next for 5.0.
Richard, great, could you please pick up the LMI patch from the other day together with this patch in your tcg-5.0 queue?
Yours, Aleksandar
Quoted 4 lines
r~
Quoted 2 lines · Aleksandar Markovic
Richard, great, could you please pick up the LMI patch from the other day together with this patch in your tcg-5.0 queue?
Yes, I've got it.
r~