x86: X86_immediate_size() returns uint8
diff --git a/arch/X86/X86ATTInstPrinter.c b/arch/X86/X86ATTInstPrinter.c
index e0e4c79..60b5039 100644
--- a/arch/X86/X86ATTInstPrinter.c
+++ b/arch/X86/X86ATTInstPrinter.c
@@ -658,7 +658,7 @@
// Print X86 immediates as signed values.
uint8_t encsize;
int64_t imm = MCOperand_getImm(Op);
- int opsize = X86_immediate_size(MCInst_getOpcode(MI), &encsize);
+ uint8_t opsize = X86_immediate_size(MCInst_getOpcode(MI), &encsize);
if (opsize == 1) // print 1 byte immediate in positive form
imm = imm & 0xff;
@@ -739,7 +739,7 @@
MI->flat_insn->detail->x86.operands[MI->flat_insn->detail->x86.op_count].imm = imm;
if (opsize > 0) {
- MI->flat_insn->detail->x86.operands[MI->flat_insn->detail->x86.op_count].size = (uint8_t)opsize;
+ MI->flat_insn->detail->x86.operands[MI->flat_insn->detail->x86.op_count].size = opsize;
MI->flat_insn->detail->x86.encoding.imm_size = encsize;
} else if (MI->op1_size > 0)
MI->flat_insn->detail->x86.operands[MI->flat_insn->detail->x86.op_count].size = MI->op1_size;
diff --git a/arch/X86/X86IntelInstPrinter.c b/arch/X86/X86IntelInstPrinter.c
index f90d2ef..9a44df5 100644
--- a/arch/X86/X86IntelInstPrinter.c
+++ b/arch/X86/X86IntelInstPrinter.c
@@ -803,7 +803,7 @@
MCOperand *Op = MCInst_getOperand(MI, OpNo);
if (MCOperand_isImm(Op)) {
int64_t imm = MCOperand_getImm(Op) + MI->flat_insn->size + MI->address;
- int opsize = X86_immediate_size(MI->Opcode, NULL);
+ uint8_t opsize = X86_immediate_size(MI->Opcode, NULL);
// truncat imm for non-64bit
if (MI->csh->mode != CS_MODE_64) {
@@ -835,7 +835,7 @@
if (MI->flat_insn->detail->x86.op_count > 0)
MI->flat_insn->detail->x86.operands[MI->flat_insn->detail->x86.op_count].size = MI->flat_insn->detail->x86.operands[0].size;
else if (opsize > 0)
- MI->flat_insn->detail->x86.operands[MI->flat_insn->detail->x86.op_count].size = (uint8_t)opsize;
+ MI->flat_insn->detail->x86.operands[MI->flat_insn->detail->x86.op_count].size = opsize;
else
MI->flat_insn->detail->x86.operands[MI->flat_insn->detail->x86.op_count].size = MI->imm_size;
MI->flat_insn->detail->x86.operands[MI->flat_insn->detail->x86.op_count].imm = imm;
@@ -887,7 +887,7 @@
} else if (MCOperand_isImm(Op)) {
uint8_t encsize;
int64_t imm = MCOperand_getImm(Op);
- int opsize = X86_immediate_size(MCInst_getOpcode(MI), &encsize);
+ uint8_t opsize = X86_immediate_size(MCInst_getOpcode(MI), &encsize);
if (opsize == 1) // print 1 byte immediate in positive form
imm = imm & 0xff;
diff --git a/arch/X86/X86Mapping.c b/arch/X86/X86Mapping.c
index 2d7d96f..07772df 100644
--- a/arch/X86/X86Mapping.c
+++ b/arch/X86/X86Mapping.c
@@ -3572,7 +3572,7 @@
};
// given the instruction name, return the size of its immediate operand (or 0)
-int X86_immediate_size(unsigned int id, uint8_t *enc_size)
+uint8_t X86_immediate_size(unsigned int id, uint8_t *enc_size)
{
#if 0
// linear searching
diff --git a/arch/X86/X86Mapping.h b/arch/X86/X86Mapping.h
index 26ab9e3..2ab464e 100644
--- a/arch/X86/X86Mapping.h
+++ b/arch/X86/X86Mapping.h
@@ -69,6 +69,6 @@
cs_regs regs_write, uint8_t *regs_write_count);
// given the instruction id, return the size of its immediate operand (or 0)
-int X86_immediate_size(unsigned int id, uint8_t *enc_size);
+uint8_t X86_immediate_size(unsigned int id, uint8_t *enc_size);
#endif