mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-03-22 18:31:27 +00:00
[qfcc] Alias entity to int for comparison
The ruamoko ISA has no entity comparison operators because an entity is just an int in disguise.
This commit is contained in:
parent
afe8c8fca5
commit
211cd657e0
1 changed files with 15 additions and 2 deletions
|
@ -54,6 +54,7 @@ static expr_t *double_compare (int op, expr_t *e1, expr_t *e2);
|
|||
static expr_t *vector_compare (int op, expr_t *e1, expr_t *e2);
|
||||
static expr_t *vector_multiply (int op, expr_t *e1, expr_t *e2);
|
||||
static expr_t *vector_scale (int op, expr_t *e1, expr_t *e2);
|
||||
static expr_t *entity_compare (int op, expr_t *e1, expr_t *e2);
|
||||
|
||||
static expr_type_t string_string[] = {
|
||||
{'+', &type_string},
|
||||
|
@ -166,8 +167,8 @@ static expr_type_t vector_double[] = {
|
|||
};
|
||||
|
||||
static expr_type_t entity_entity[] = {
|
||||
{EQ, &type_int},
|
||||
{NE, &type_int},
|
||||
{EQ, &type_int, 0, 0, entity_compare},
|
||||
{NE, &type_int, 0, 0, entity_compare},
|
||||
{0, 0}
|
||||
};
|
||||
|
||||
|
@ -812,6 +813,18 @@ double_compare (int op, expr_t *e1, expr_t *e2)
|
|||
return e;
|
||||
}
|
||||
|
||||
static expr_t *
|
||||
entity_compare (int op, expr_t *e1, expr_t *e2)
|
||||
{
|
||||
if (options.code.progsversion == PROG_VERSION) {
|
||||
e1 = new_alias_expr (&type_int, e1);
|
||||
e2 = new_alias_expr (&type_int, e2);
|
||||
}
|
||||
expr_t *e = new_binary_expr (op, e1, e2);
|
||||
e->e.expr.type = &type_int;
|
||||
return e;
|
||||
}
|
||||
|
||||
static expr_t *
|
||||
invalid_binary_expr (int op, expr_t *e1, expr_t *e2)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue