mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 15:22:04 +00:00
make ~ work for v6 progs by implementing ~x as -1 - x (will give bogus
results if x has fractional bits, but it's better than it was:)
This commit is contained in:
parent
7af8e2952e
commit
1d35f4dd9e
1 changed files with 10 additions and 1 deletions
|
@ -1499,13 +1499,22 @@ unary_expr (int op, expr_t *e)
|
||||||
case ex_uexpr:
|
case ex_uexpr:
|
||||||
if (e->e.expr.op == '~')
|
if (e->e.expr.op == '~')
|
||||||
return e->e.expr.e1;
|
return e->e.expr.e1;
|
||||||
|
goto bitnot_expr;
|
||||||
case ex_block:
|
case ex_block:
|
||||||
if (!e->e.block.result)
|
if (!e->e.block.result)
|
||||||
return error (e, "invalid type for unary ~");
|
return error (e, "invalid type for unary ~");
|
||||||
|
goto bitnot_expr;
|
||||||
case ex_expr:
|
case ex_expr:
|
||||||
case ex_def:
|
case ex_def:
|
||||||
case ex_temp:
|
case ex_temp:
|
||||||
{
|
bitnot_expr:
|
||||||
|
if (options.code.progsversion == PROG_ID_VERSION) {
|
||||||
|
expr_t *n1 = new_expr ();
|
||||||
|
|
||||||
|
n1->type = ex_integer;
|
||||||
|
n1->e.integer_val = -1;
|
||||||
|
return binary_expr ('-', n1, e);
|
||||||
|
} else {
|
||||||
expr_t *n = new_unary_expr (op, e);
|
expr_t *n = new_unary_expr (op, e);
|
||||||
type_t *t = get_type (e);
|
type_t *t = get_type (e);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue