Skip to content

Commit

Permalink
Merge pull request #2109 from Rot127/inter-os-printf-formatting
Browse files Browse the repository at this point in the history
Use OS independent printf formatting.
  • Loading branch information
kabeor committed Jul 24, 2023
2 parents cdbf6a0 + 98e9267 commit e1af2e2
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions cstool/cstool_arm.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,14 @@ void print_insn_detail_arm(csh handle, cs_insn *ins)
case ARM_OP_REG:
printf("\t\toperands[%u].type: REG = %s\n", i, cs_reg_name(handle, op->reg));
break;
case ARM_OP_IMM:
printf("\t\toperands[%u].type: IMM = 0x%x\n", i, op->imm);
case ARM_OP_IMM: {
bool neg_imm = op->imm < 0;
if (neg_imm)
printf("\t\toperands[%u].type: IMM = -0x%" PRIx32 "\n", i, -(op->imm));
else
printf("\t\toperands[%u].type: IMM = 0x%" PRIx32 "\n", i, op->imm);
break;
}
case ARM_OP_FP:
#if defined(_KERNEL_MODE)
// Issue #681: Windows kernel does not support formatting float point
Expand All @@ -56,10 +61,10 @@ void print_insn_detail_arm(csh handle, cs_insn *ins)

break;
case ARM_OP_PIMM:
printf("\t\toperands[%u].type: P-IMM = %u\n", i, op->imm);
printf("\t\toperands[%u].type: P-IMM = %" PRIu32 "\n", i, op->imm);
break;
case ARM_OP_CIMM:
printf("\t\toperands[%u].type: C-IMM = %u\n", i, op->imm);
printf("\t\toperands[%u].type: C-IMM = %" PRIu32 "\n", i, op->imm);
break;
case ARM_OP_SETEND:
printf("\t\toperands[%u].type: SETEND = %s\n", i, op->setend == ARM_SETEND_BE? "be" : "le");
Expand Down

0 comments on commit e1af2e2

Please sign in to comment.