* [Patch opcodes] cleanup redundant code in cr16-dis.c
@ 2012-12-17 14:04 刘智猷
0 siblings, 0 replies; only message in thread
From: 刘智猷 @ 2012-12-17 14:04 UTC (permalink / raw)
To: binutils
Hi, all
I am looking into the implement of opcodes and I found
static unsigned long build_mask (void)
and
static int match_opcode (void) in opcodes/cr16-dis.c share same code
/* Adjust mask for bcond with 32-bit size instruction. */
if ((IS_INSN_MNEMONIC("b") && instruction->size == 2))
mask = 0xff0f0000;
I check around and confirm that the code in matc _opcode could be
safety removed. Patch (generate by git) is as following and it passes
all the testcases.
This is in fact a very simple patch. But I guess cleaning up is always
welcomed, isn't it?
BTW. I am not hanging on maillist a lot so if anything is wrong
please pointing it out. Thank you!
Regards,
LIU Zhiyou
P.S. This is a resending. My last email (having the same content) does
not show up in the mail list archieve.
$ git diff
diff --git a/opcodes/cr16-dis.c b/opcodes/cr16-dis.c
index f299fef..e520ded 100644
--- a/opcodes/cr16-dis.c
+++ b/opcodes/cr16-dis.c
@@ -331,10 +331,7 @@ match_opcode (void)
while (instruction >= cr16_instruction)
{
mask = build_mask ();
- /* Adjust mask for bcond with 32-bit size instruction */
- if ((IS_INSN_MNEMONIC("b") && instruction->size == 2))
- mask = 0xff0f0000;
-
+
if ((doubleWord & mask) == BIN (instruction->match,
instruction->match_bits))
return 1;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2012-12-17 14:04 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-17 14:04 [Patch opcodes] cleanup redundant code in cr16-dis.c 刘智猷
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).