qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RESEND PATCH 2/6] disas/nanomips: Merge insn{1,2,3} into words[3]


From: Philippe Mathieu-Daudé
Subject: Re: [RESEND PATCH 2/6] disas/nanomips: Merge insn{1,2,3} into words[3]
Date: Sun, 6 Nov 2022 18:50:43 +0100
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.4.1

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.henderson@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é <philmd@linaro.org>

+        if (i < length) {
+            (*info->fprintf_func)(info->stream, "%04x ", words[i / 2]);
+        } else {
+            (*info->fprintf_func)(info->stream, "     ");
+        }
      }





reply via email to

[Prev in Thread] Current Thread [Next in Thread]