SystemZ MIN_INT right print (#1182)
diff --git a/arch/SystemZ/SystemZInstPrinter.c b/arch/SystemZ/SystemZInstPrinter.c
index 5a8f019..51ede35 100644
--- a/arch/SystemZ/SystemZInstPrinter.c
+++ b/arch/SystemZ/SystemZInstPrinter.c
@@ -41,17 +41,7 @@
static void printAddress(MCInst *MI, unsigned Base, int64_t Disp, unsigned Index, SStream *O)
{
- if (Disp >= 0) {
- if (Disp > HEX_THRESHOLD)
- SStream_concat(O, "0x%"PRIx64, Disp);
- else
- SStream_concat(O, "%"PRIu64, Disp);
- } else {
- if (Disp < -HEX_THRESHOLD)
- SStream_concat(O, "-0x%"PRIx64, -Disp);
- else
- SStream_concat(O, "-%"PRIu64, -Disp);
- }
+ printInt64(O, Disp);
if (Base) {
SStream_concat0(O, "(");
@@ -92,17 +82,7 @@
} else if (MCOperand_isImm(MO)) {
int64_t Imm = MCOperand_getImm(MO);
- if (Imm >= 0) {
- if (Imm > HEX_THRESHOLD)
- SStream_concat(O, "0x%"PRIx64, Imm);
- else
- SStream_concat(O, "%"PRIu64, Imm);
- } else {
- if (Imm < -HEX_THRESHOLD)
- SStream_concat(O, "-0x%"PRIx64, -Imm);
- else
- SStream_concat(O, "-%"PRIu64, -Imm);
- }
+ printInt64(O, Imm);
if (MI->csh->detail) {
MI->flat_insn->detail->sysz.operands[MI->flat_insn->detail->sysz.op_count].type = SYSZ_OP_IMM;
@@ -116,17 +96,7 @@
{
int64_t Value = MCOperand_getImm(MCInst_getOperand(MI, OpNum));
// assert(isUInt<4>(Value) && "Invalid u4imm argument");
- if (Value >= 0) {
- if (Value > HEX_THRESHOLD)
- SStream_concat(O, "0x%"PRIx64, Value);
- else
- SStream_concat(O, "%"PRIu64, Value);
- } else {
- if (Value < -HEX_THRESHOLD)
- SStream_concat(O, "-0x%"PRIx64, -Value);
- else
- SStream_concat(O, "-%"PRIu64, -Value);
- }
+ printInt64(O, Value);
if (MI->csh->detail) {
MI->flat_insn->detail->sysz.operands[MI->flat_insn->detail->sysz.op_count].type = SYSZ_OP_IMM;
@@ -140,10 +110,7 @@
uint32_t Value = (uint32_t)MCOperand_getImm(MCInst_getOperand(MI, OpNum));
// assert(isUInt<6>(Value) && "Invalid u6imm argument");
- if (Value > HEX_THRESHOLD)
- SStream_concat(O, "0x%x", Value);
- else
- SStream_concat(O, "%u", Value);
+ printUInt32(O, Value);
if (MI->csh->detail) {
MI->flat_insn->detail->sysz.operands[MI->flat_insn->detail->sysz.op_count].type = SYSZ_OP_IMM;
@@ -239,17 +206,7 @@
int32_t Value = (int32_t)MCOperand_getImm(MCInst_getOperand(MI, OpNum));
// assert(isInt<32>(Value) && "Invalid s32imm argument");
- if (Value >= 0) {
- if (Value > HEX_THRESHOLD)
- SStream_concat(O, "0x%x", Value);
- else
- SStream_concat(O, "%u", Value);
- } else {
- if (Value < -HEX_THRESHOLD)
- SStream_concat(O, "-0x%x", -Value);
- else
- SStream_concat(O, "-%u", -Value);
- }
+ printInt32(O, Value);
if (MI->csh->detail) {
MI->flat_insn->detail->sysz.operands[MI->flat_insn->detail->sysz.op_count].type = SYSZ_OP_IMM;
@@ -263,10 +220,7 @@
uint32_t Value = (uint32_t)MCOperand_getImm(MCInst_getOperand(MI, OpNum));
// assert(isUInt<32>(Value) && "Invalid u32imm argument");
- if (Value > HEX_THRESHOLD)
- SStream_concat(O, "0x%x", Value);
- else
- SStream_concat(O, "%u", Value);
+ printUInt32(O, Value);
if (MI->csh->detail) {
MI->flat_insn->detail->sysz.operands[MI->flat_insn->detail->sysz.op_count].type = SYSZ_OP_IMM;
@@ -295,17 +249,7 @@
if (MCOperand_isImm(MO)) {
imm = (int32_t)MCOperand_getImm(MO);
- if (imm >= 0) {
- if (imm > HEX_THRESHOLD)
- SStream_concat(O, "0x%x", imm);
- else
- SStream_concat(O, "%u", imm);
- } else {
- if (imm < -HEX_THRESHOLD)
- SStream_concat(O, "-0x%x", -imm);
- else
- SStream_concat(O, "-%u", -imm);
- }
+ printInt32(O, imm);
if (MI->csh->detail) {
MI->flat_insn->detail->sysz.operands[MI->flat_insn->detail->sysz.op_count].type = SYSZ_OP_IMM;