summaryrefslogtreecommitdiff
path: root/src/arch
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2008-07-27 23:43:10 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2008-07-27 23:43:10 (GMT)
commit0164ddde7b01a6e3e3aa84ebdeb4ea9b381f063a (patch)
tree8ca31386754fa174fc1d94cedc958d7344723bc4 /src/arch
parent1bf9c5ebe8bb3326e10491974cd43b221e2a56a1 (diff)
Fixed a bug when reading immediate values.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@8 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
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;
}