Fixed #1060 #1061 #1062 (#1079)
diff --git a/arch/ARM/ARMInstPrinter.c b/arch/ARM/ARMInstPrinter.c
index 905528d..655b2ee 100644
--- a/arch/ARM/ARMInstPrinter.c
+++ b/arch/ARM/ARMInstPrinter.c
@@ -759,7 +759,8 @@
SStream_concat(O, "#%u", imm);
} else {
if (imm < -HEX_THRESHOLD)
- SStream_concat(O, "#-0x%x", (unsigned int)-imm);
+ // cast first, then negate
+ SStream_concat(O, "#-0x%x", -(uint32_t)imm);
else
SStream_concat(O, "#-%u", -imm);
}
diff --git a/arch/Sparc/SparcInstPrinter.c b/arch/Sparc/SparcInstPrinter.c
index c2312c4..98b26b2 100644
--- a/arch/Sparc/SparcInstPrinter.c
+++ b/arch/Sparc/SparcInstPrinter.c
@@ -269,7 +269,8 @@
SStream_concat(O, "%u", Imm);
} else {
if (Imm < -HEX_THRESHOLD)
- SStream_concat(O, "-0x%x", (unsigned int)-Imm);
+ //cast first, then negate
+ SStream_concat(O, "-0x%x", -(uint32_t)Imm);
else
SStream_concat(O, "-%u", -Imm);
}
diff --git a/arch/SystemZ/SystemZInstPrinter.c b/arch/SystemZ/SystemZInstPrinter.c
index 18c5a93..b27ae3f 100644
--- a/arch/SystemZ/SystemZInstPrinter.c
+++ b/arch/SystemZ/SystemZInstPrinter.c
@@ -302,7 +302,8 @@
SStream_concat(O, "%u", imm);
} else {
if (imm < -HEX_THRESHOLD)
- SStream_concat(O, "-0x%x", (unsigned int)-imm);
+ //cast first, then negate
+ SStream_concat(O, "-0x%x", -(uint32_t)imm);
else
SStream_concat(O, "-%u", -imm);
}