summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWim Taymans <wtaymans@redhat.com>2014-09-19 12:23:44 +0200
committerWim Taymans <wtaymans@redhat.com>2014-09-19 12:23:44 +0200
commit2ae41b98a35405dbfd35209e7d68428be77a2e62 (patch)
tree192e4ab71a25a0d0f25afc5682707097f367458a
parent106dacc2620126dedb99d2b981ba2e5a7d4591f9 (diff)
executor: use the size of the opcode arg to get multiplier
When loading a constant, select the multiplier based on the size of the opcode argument. This is safer because we have existing code that declares the constants of the wrong size.
-rw-r--r--orc/orcexecutor.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/orc/orcexecutor.c b/orc/orcexecutor.c
index 21513f3..9007f3e 100644
--- a/orc/orcexecutor.c
+++ b/orc/orcexecutor.c
@@ -285,18 +285,19 @@ orc_executor_emulate (OrcExecutor *ex)
for(k=0;k<ORC_STATIC_OPCODE_N_SRC;k++) {
OrcCodeVariable *var = code->vars + insn->src_args[k];
- if (opcode->src_size[k] == 0) continue;
+ int src_size = opcode->src_size[k];
+ if (src_size == 0) continue;
if (var->vartype == ORC_VAR_TYPE_CONST) {
opcode_ex[j].src_ptrs[k] = tmpspace[insn->src_args[k]];
/* FIXME hack */
load_constant (tmpspace[insn->src_args[k]], 8,
var->value.i);
- if (var->size == 1)
+ if (src_size == 1)
opcode_ex[j].shift = 3;
- else if (var->size == 2)
+ else if (src_size == 2)
opcode_ex[j].shift = 2;
- else if (var->size == 4)
+ else if (src_size == 4)
opcode_ex[j].shift = 1;
} else if (var->vartype == ORC_VAR_TYPE_PARAM) {
opcode_ex[j].src_ptrs[k] = tmpspace[insn->src_args[k]];