This is the mail archive of the
mailing list for the binutils project.
[Patch opcodes] cleanup redundant code in cr16-dis.c
- From: åæç <liuzhiyou dot cs at gmail dot com>
- To: binutils at sourceware dot org
- Date: Mon, 17 Dec 2012 22:04:17 +0800
- Subject: [Patch opcodes] cleanup redundant code in cr16-dis.c
I am looking into the implement of opcodes and I found
static unsigned long build_mask (void)
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!
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
@@ -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,