mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-03-21 18:01:15 +00:00
Remove the dirty hack used for accessing params and the return value.
Instead of using the equivalent of *(float*)&.return, now use the equivalent of (float).return. No conversion is done in the "cast". NOTE: this sort of cast should be separated from normal casts.
This commit is contained in:
parent
f5412c2b20
commit
d93d8d7d46
2 changed files with 21 additions and 6 deletions
|
@ -777,10 +777,13 @@ param_expr (const char *name, type_t *type)
|
|||
{
|
||||
symbol_t *sym;
|
||||
expr_t *sym_expr;
|
||||
expr_t *cast;
|
||||
|
||||
sym = make_symbol (name, &type_param, 0, st_extern);
|
||||
sym_expr = new_symbol_expr (sym);
|
||||
return unary_expr ('.', address_expr (sym_expr, 0, type));
|
||||
cast = new_unary_expr ('C', sym_expr);
|
||||
cast->e.expr.type = type;
|
||||
return cast;
|
||||
}
|
||||
|
||||
expr_t *
|
||||
|
|
|
@ -494,12 +494,24 @@ expr_expr (sblock_t *sblock, expr_t *e, operand_t **op)
|
|||
static sblock_t *
|
||||
expr_cast (sblock_t *sblock, expr_t *e, operand_t **op)
|
||||
{
|
||||
// FIXME int<->float
|
||||
if (!*op) {
|
||||
(*op) = new_operand (op_temp);
|
||||
(*op)->type = low_level_type (e->e.expr.type);
|
||||
operand_t *src = 0;
|
||||
type_t *type = e->e.expr.type;
|
||||
statement_t *s;
|
||||
|
||||
sblock = statement_subexpr (sblock, e->e.expr.e1, &src);
|
||||
if ((src->type == ev_integer && type->type == ev_float)
|
||||
|| (src->type == ev_float && type->type == ev_integer)) {
|
||||
if (!*op) {
|
||||
(*op) = new_operand (op_temp);
|
||||
(*op)->type = low_level_type (e->e.expr.type);
|
||||
}
|
||||
s = new_statement ("=", e);
|
||||
s->opa = src;
|
||||
s->opc = *op;
|
||||
} else {
|
||||
src->type = low_level_type (e->e.expr.type);
|
||||
*op = src;
|
||||
}
|
||||
sblock = statement_subexpr (sblock, e->e.expr.e1, op);
|
||||
return sblock;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue