mirror of
https://github.com/capstone-engine/capstone.git
synced 2025-02-18 13:30:16 +00:00
arm64: properly print immediate in friendly format in printSImm7ScaledOperand(). bug reported by Amanieu
This commit is contained in:
parent
9518148e6f
commit
6f4840270a
@ -562,17 +562,27 @@ static void printSImm7ScaledOperand(MCInst *MI, unsigned OpNum,
|
||||
{
|
||||
MCOperand *MOImm = MCInst_getOperand(MI, OpNum);
|
||||
int32_t Imm = (int32_t)unpackSignedImm(7, MCOperand_getImm(MOImm));
|
||||
int64_t res;
|
||||
|
||||
res = Imm * MemScale;
|
||||
if (res > 0) {
|
||||
if (res > HEX_THRESHOLD)
|
||||
SStream_concat(O, "#0x%"PRIx64, res);
|
||||
else
|
||||
SStream_concat(O, "#%"PRIu64, res);
|
||||
} else {
|
||||
if (res < -HEX_THRESHOLD)
|
||||
SStream_concat(O, "#-0x%"PRIx64, -res);
|
||||
else
|
||||
SStream_concat(O, "#-%"PRIu64, -res);
|
||||
}
|
||||
|
||||
if (Imm * MemScale > HEX_THRESHOLD)
|
||||
SStream_concat(O, "#0x%x", Imm * MemScale);
|
||||
else
|
||||
SStream_concat(O, "#%u", Imm * MemScale);
|
||||
if (MI->csh->detail) {
|
||||
if (MI->csh->doing_mem) {
|
||||
MI->flat_insn.arm64.operands[MI->flat_insn.arm64.op_count].mem.disp = Imm * MemScale;
|
||||
MI->flat_insn.arm64.operands[MI->flat_insn.arm64.op_count].mem.disp = res;
|
||||
} else {
|
||||
MI->flat_insn.arm64.operands[MI->flat_insn.arm64.op_count].type = ARM64_OP_IMM;
|
||||
MI->flat_insn.arm64.operands[MI->flat_insn.arm64.op_count].imm = Imm * MemScale;
|
||||
MI->flat_insn.arm64.operands[MI->flat_insn.arm64.op_count].imm = res;
|
||||
MI->flat_insn.arm64.op_count++;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user