From c68800aa29f208f2013214e54880505fc64ae4a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Thu, 30 Apr 2020 07:16:20 -0400 Subject: [PATCH] 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. Fixes: 3d004a371 Backports commit b412378785c1bd95e3461c1373dd8938bc54fb4e from qemu --- qemu/scripts/decodetree.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qemu/scripts/decodetree.py b/qemu/scripts/decodetree.py index 8e75bf63..02fe4560 100644 --- a/qemu/scripts/decodetree.py +++ b/qemu/scripts/decodetree.py @@ -1161,7 +1161,7 @@ class SizeTree: 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. @@ -1215,7 +1215,7 @@ class SizeLeaf: 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