Skip to content

Commit a88d390

Browse files
committed
More 32bit bug fixes
1 parent b96fc43 commit a88d390

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

arch/AArch64/AArch64InstPrinter.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1131,7 +1131,7 @@ void printShifter(MCInst *MI, unsigned OpNum, SStream *O)
11311131
AArch64_AM_getShiftValue(Val) == 0)
11321132
return;
11331133
SStream_concat(
1134-
O, "%s%s%s%s#%d", ", ",
1134+
O, "%s%s%s%s#%u", ", ",
11351135
AArch64_AM_getShiftExtendName(AArch64_AM_getShiftType(Val)),
11361136
" ", markup("<imm:"), AArch64_AM_getShiftValue(Val));
11371137
SStream_concat0(O, markup(">"));
@@ -1202,7 +1202,7 @@ static void printMemExtendImpl(bool SignExtend, bool DoShift, unsigned Width,
12021202
if (getUseMarkup)
12031203
SStream_concat0(O, "<imm:");
12041204
unsigned ShiftAmount = DoShift ? Log2_32(Width / 8) : 0;
1205-
SStream_concat(O, "%s%d", "#", ShiftAmount);
1205+
SStream_concat(O, "%s%u", "#", ShiftAmount);
12061206
if (getUseMarkup)
12071207
SStream_concat0(O, ">");
12081208
}
@@ -2319,7 +2319,7 @@ void printSIMDType10Operand(MCInst *MI, unsigned OpNo, SStream *O)
23192319
unsigned Val = \
23202320
MCOperand_getImm(MCInst_getOperand(MI, (OpNo))); \
23212321
SStream_concat(O, "%s", markup("<imm:")); \
2322-
SStream_concat(O, "#%d", (Val * Angle) + Remainder); \
2322+
SStream_concat(O, "#%" PRId32, (int32_t)((Val * Angle) + Remainder)); \
23232323
SStream_concat0(O, markup(">")); \
23242324
}
23252325
DEFINE_printComplexRotationOp(180, 90);

arch/ARM/ARMInstPrinter.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1367,8 +1367,8 @@ static inline void printFBits16(MCInst *MI, unsigned OpNum, SStream *O)
13671367
add_cs_detail(MI, ARM_OP_GROUP_FBits16, OpNum);
13681368
SStream_concat(O, "%s%s", markup("<imm:"), "#");
13691369
SStream_concat(
1370-
O, "%" PRId32,
1371-
(int32_t)16 - MCOperand_getImm(MCInst_getOperand(MI, (OpNum))));
1370+
O, "%" PRIu32,
1371+
(uint32_t)(16 - MCOperand_getImm(MCInst_getOperand(MI, (OpNum)))));
13721372
SStream_concat0(O, markup(">"));
13731373
}
13741374

@@ -1627,7 +1627,7 @@ DEFINE_printMVEVectorList(2) DEFINE_printMVEVectorList(4)
16271627
OpNo, Angle, Remainder); \
16281628
unsigned Val = \
16291629
MCOperand_getImm(MCInst_getOperand(MI, (OpNo))); \
1630-
SStream_concat(O, "#%d", (Val * Angle) + Remainder); \
1630+
SStream_concat(O, "#%u", (uint32_t)((Val * Angle) + Remainder)); \
16311631
}
16321632
DEFINE_printComplexRotationOp(90, 0) DEFINE_printComplexRotationOp(180,
16331633
90)

arch/X86/X86ATTInstPrinter.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,7 @@ static void printU8Imm(MCInst *MI, unsigned Op, SStream *O)
555555
if (val > HEX_THRESHOLD)
556556
SStream_concat(O, "$0x%x", val);
557557
else
558-
SStream_concat(O, "$%u", val);
558+
SStream_concat(O, "$%" PRIu8, val);
559559

560560
if (MI->csh->detail_opt) {
561561
MI->flat_insn->detail->x86
@@ -744,7 +744,7 @@ static void printOperand(MCInst *MI, unsigned OpNo, SStream *O)
744744
// do not print number in negative form
745745
imm = imm & 0xff;
746746
if (imm >= 0 && imm <= HEX_THRESHOLD)
747-
SStream_concat(O, "$%u", imm);
747+
SStream_concat(O, "$%" PRIu64, imm);
748748
else {
749749
SStream_concat(O, "$0x%x", imm);
750750
}
@@ -767,7 +767,7 @@ static void printOperand(MCInst *MI, unsigned OpNo, SStream *O)
767767
case X86_INS_XOR:
768768
// do not print number in negative form
769769
if (imm >= 0 && imm <= HEX_THRESHOLD)
770-
SStream_concat(O, "$%u", imm);
770+
SStream_concat(O, "$%" PRIu64, imm);
771771
else {
772772
imm = arch_masks[opsize ? opsize : MI->imm_size] &
773773
imm;
@@ -779,7 +779,7 @@ static void printOperand(MCInst *MI, unsigned OpNo, SStream *O)
779779
case X86_INS_RETF:
780780
// RET imm16
781781
if (imm >= 0 && imm <= HEX_THRESHOLD)
782-
SStream_concat(O, "$%u", imm);
782+
SStream_concat(O, "$%" PRIu64, imm);
783783
else {
784784
imm = 0xffff & imm;
785785
SStream_concat(O, "$0x%x", imm);
@@ -937,7 +937,7 @@ static void printMemReference(MCInst *MI, unsigned Op, SStream *O)
937937
.op_count]
938938
.mem.scale = (int)ScaleVal;
939939
if (ScaleVal != 1) {
940-
SStream_concat(O, ", %u", ScaleVal);
940+
SStream_concat(O, ", %" PRIu64, ScaleVal);
941941
}
942942
}
943943

0 commit comments

Comments
 (0)