On 6/11/22 03:37, Richard Henderson wrote:
Since Disassemble wants the data in this format, collect
it that way. This allows using a loop to print the bytes.
Signed-off-by: Richard Henderson <richard.hender...@linaro.org>
---
disas/nanomips.c | 44 +++++++++++++++++++++-----------------------
1 file changed, 21 insertions(+), 23 deletions(-)
diff --git a/disas/nanomips.c b/disas/nanomips.c
index 9a69e6880a..5438def9af 100644
--- a/disas/nanomips.c
+++ b/disas/nanomips.c
@@ -21905,12 +21905,8 @@ static const Pool MAJOR[2] = {
0x0 }, /* P16 */
};
-static bool nanomips_dis(char **buf, Dis_info *info,
- unsigned short one,
- unsigned short two,
- unsigned short three)
+static bool nanomips_dis(char **buf, Dis_info *info, uint16_t words[3])
words[] can be const.
+ for (int i = 0; i < 6; i += 2) {
I'd rather convert this magic 6 and iterate over ARRAY_SIZE(words).
Anyhow,
Reviewed-by: Philippe Mathieu-Daudé <phi...@linaro.org>
+ if (i < length) {
+ (*info->fprintf_func)(info->stream, "%04x ", words[i / 2]);
+ } else {
+ (*info->fprintf_func)(info->stream, " ");
+ }
}