From: Tsukasa OI <a4lg@sourceware.org>
To: bfd-cvs@sourceware.org
Subject: [binutils-gdb] RISC-V: Optimize riscv_disassemble_data printf
Date: Thu, 6 Oct 2022 03:35:13 +0000 (GMT) [thread overview]
Message-ID: <20221006033513.87BD4384D140@sourceware.org> (raw)
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=e0b004c5d54dc609f6f4839a6d949775e5bafc71
commit e0b004c5d54dc609f6f4839a6d949775e5bafc71
Author: Tsukasa OI <research_trasio@irq.a4lg.com>
Date: Tue Aug 2 17:18:33 2022 +0900
RISC-V: Optimize riscv_disassemble_data printf
This commit makes types of printf arguments on riscv_disassemble_data
as small as possible (as long as we can preserve the portability) to reduce
the cost of printf (especially on 32-bit host).
opcodes/ChangeLog:
* riscv-dis.c (riscv_disassemble_data): Use smallest possible type
to printing data.
Diff:
---
opcodes/riscv-dis.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/opcodes/riscv-dis.c b/opcodes/riscv-dis.c
index ae35790d43b..bbeee3feda1 100644
--- a/opcodes/riscv-dis.c
+++ b/opcodes/riscv-dis.c
@@ -964,24 +964,22 @@ riscv_disassemble_data (bfd_vma memaddr ATTRIBUTE_UNUSED,
(*info->fprintf_styled_func)
(info->stream, dis_style_assembler_directive, ".byte\t");
(*info->fprintf_styled_func)
- (info->stream, dis_style_immediate, "0x%02llx",
- (unsigned long long) data);
+ (info->stream, dis_style_immediate, "0x%02x", (unsigned) data);
break;
case 2:
info->bytes_per_line = 8;
(*info->fprintf_styled_func)
(info->stream, dis_style_assembler_directive, ".short\t");
(*info->fprintf_styled_func)
- (info->stream, dis_style_immediate, "0x%04llx",
- (unsigned long long) data);
+ (info->stream, dis_style_immediate, "0x%04x", (unsigned) data);
break;
case 4:
info->bytes_per_line = 8;
(*info->fprintf_styled_func)
(info->stream, dis_style_assembler_directive, ".word\t");
(*info->fprintf_styled_func)
- (info->stream, dis_style_immediate, "0x%08llx",
- (unsigned long long) data);
+ (info->stream, dis_style_immediate, "0x%08lx",
+ (unsigned long) data);
break;
case 8:
info->bytes_per_line = 8;
reply other threads:[~2022-10-06 3:35 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221006033513.87BD4384D140@sourceware.org \
--to=a4lg@sourceware.org \
--cc=bfd-cvs@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).