mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-19 07:20:50 +00:00
Set up temp aliases correctly
Fixes vector expressions as sub-expresses. I really don't know why I did the temp alias setup that way.
This commit is contained in:
parent
fc50376297
commit
0f1f477e64
3 changed files with 23 additions and 6 deletions
|
@ -889,9 +889,7 @@ expr_alias (sblock_t *sblock, expr_t *e, operand_t **op)
|
|||
}
|
||||
}
|
||||
if (!top) {
|
||||
top = new_operand (op_temp);
|
||||
top->type = type;
|
||||
top->size = type_size (type);
|
||||
top = temp_operand (type);
|
||||
top->o.tempop.alias = aop;
|
||||
top->o.tempop.offset = offset;
|
||||
top->next = aop->o.tempop.alias_ops;
|
||||
|
|
|
@ -21,6 +21,8 @@ int
|
|||
main ()
|
||||
{
|
||||
int ret = 0;
|
||||
float x = 4;
|
||||
float y = 5;
|
||||
vector v;
|
||||
|
||||
v = t2(5);
|
||||
|
@ -33,5 +35,11 @@ main ()
|
|||
printf("t3(5) = %v\n", v);
|
||||
ret |= 1;
|
||||
}
|
||||
v = [x, y, 0] / 2;
|
||||
if (v != [2, 2.5, 0]) {
|
||||
printf("v = %v\n", v);
|
||||
ret |= 1;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -8,8 +8,8 @@ foo (float x, float y, float z)
|
|||
return v;
|
||||
}
|
||||
|
||||
float w;
|
||||
float h;
|
||||
float w = 2;
|
||||
float h = 4;
|
||||
|
||||
vector
|
||||
bar (void)
|
||||
|
@ -22,8 +22,19 @@ bar (void)
|
|||
return pos;
|
||||
}
|
||||
|
||||
vector
|
||||
baz (float w, float h)
|
||||
{
|
||||
vector p = [w, h, 0] / 2;
|
||||
return p;
|
||||
}
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
return 0;
|
||||
int ret = 0;
|
||||
ret |= foo(1,2,3) != [1, 2, 3];
|
||||
ret |= bar() != [2, 4, 0];
|
||||
ret |= baz(5, 6) != [2.5, 3, 0];
|
||||
return ret;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue