summaryrefslogtreecommitdiff
path: root/src/arch
diff options
context:
space:
mode:
Diffstat (limited to 'src/arch')
-rw-r--r--src/arch/operand.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/arch/operand.c b/src/arch/operand.c
index cd7c2b4..33807bc 100644
--- a/src/arch/operand.c
+++ b/src/arch/operand.c
@@ -133,19 +133,18 @@ bool fill_imm_operand(asm_operand *operand, AsmOperandSize size, const uint8_t *
*pos += 1;
break;
case AOS_16_BITS:
- operand->value.val16 = data[*pos] || (data[*pos + 1] << 8);
+ operand->value.val16 = data[*pos] | (uint16_t)data[*pos + 1] << 8;
*pos += 2;
break;
case AOS_32_BITS:
- operand->value.val32 = data[*pos] || (data[*pos + 1] << 8) || (data[*pos + 2] << 16);
+ operand->value.val32 = data[*pos] | (uint32_t)data[*pos + 1] << 8
+ | (uint32_t)data[*pos + 2] << 16 | (uint32_t)data[*pos + 3] << 24;
*pos += 4;
break;
case AOS_64_BITS:
- /*
- operand->value.val64 = data[*pos] || (data[*pos + 1] << 8) || (data[*pos + 2] << 16)
- || (data[*pos + 3] << 24) || (data[*pos + 4] << 32) || (data[*pos + 5] << 40)
- || (data[*pos + 6] << 48) || (data[*pos + 7] << 56);
- */
+ operand->value.val64 = data[*pos] | (uint64_t)data[*pos + 1] << 8 | (uint64_t)data[*pos + 2] << 16
+ | (uint64_t)data[*pos + 3] << 24 | (uint64_t)data[*pos + 4] << 32 | (uint64_t)data[*pos + 5] << 40
+ | (uint64_t)data[*pos + 6] << 48 | (uint64_t)data[*pos + 7] << 56;
*pos += 8;
break;
}