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

Use OS independent printf formatting. #2109

Merged
merged 1 commit into from
Jul 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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