Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[next] SH: Use bitwise OR with mask for sign extension #2389

Merged
merged 4 commits into from
Sep 18, 2024
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions arch/SH/SHDisassembler.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ static void set_groups(cs_detail *detail, int n, ...)
va_start(g, n);
while (n > 0) {
sh_insn_group grp;
grp = va_arg(g, sh_insn_group);
grp = va_arg(g, sh_insn_group); // NOLINT(clang-analyzer-valist.Uninitialized)
lhsazevedo marked this conversation as resolved.
Show resolved Hide resolved
if (detail) {
detail->groups[detail->groups_count] = grp;
detail->groups_count++;
Expand Down Expand Up @@ -934,7 +934,6 @@ static bool op4xxb(uint16_t code, uint64_t address, MCInst *MI, cs_mode mode,
rw = write;
break;
case 2:
insn = SH_INS_JMP;
grp = SH_GRP_JUMP;
break;
case 8:
Expand Down Expand Up @@ -1459,13 +1458,13 @@ static bool decode_long(uint32_t code, uint64_t address, MCInst *MI,
if (code & 0x00010000) {
// movi20s #imm,
imm <<= 8;
if (imm >= 1 << 27)
imm = -((1 << 28) - imm);
if (imm & (1 << (28 - 1)))
imm |= ~((1 << 28) - 1);
insn = SH_INS_MOVI20S;
} else {
// MOVI20
if (imm >= 1 << 19)
imm = -((1 << 20) - imm);
if (imm & (1 << (28 - 1)))
imm |= ~((1 << 20) - 1);
insn = SH_INS_MOVI20;
}
set_imm(info, 0, imm);
Expand Down
Loading