mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-27 06:34:11 +00:00
Swap the order of scale and base for calculating the array index.
fold_constants doesn't like dags very much, but it can do the right thing if the expressions are in the right order. This is merely a workaround until I get to work on the code generator itself.
This commit is contained in:
parent
5864c198cc
commit
cd38bd71fa
1 changed files with 3 additions and 2 deletions
|
@ -2304,8 +2304,9 @@ array_expr (expr_t *array, expr_t *index)
|
|||
scale->e.integer_val = size;
|
||||
index = binary_expr ('*', index, scale);
|
||||
index = binary_expr ('-', index,
|
||||
binary_expr ('*', scale,
|
||||
new_integer_expr (array_type->t.array.base)));
|
||||
binary_expr ('*',
|
||||
new_integer_expr (array_type->t.array.base),
|
||||
scale));
|
||||
index = fold_constants (index);
|
||||
if ((index->type == ex_integer
|
||||
&& index->e.integer_val < 32768 && index->e.integer_val >= -32768)
|
||||
|
|
Loading…
Reference in a new issue