Commit 2ae41b98 authored by Wim Taymans's avatar Wim Taymans

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.
parent 106dacc2
......@@ -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]];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment