mirror of
https://github.com/ZDoom/acc.git
synced 2025-03-13 03:42:17 +00:00
Add constant evaluation for ~
- When this operator was added to the language, it never got added to the constant expression path, so you could only use it in expressions evaluated at runtime.
This commit is contained in:
parent
26d4df32d4
commit
f099d5e667
1 changed files with 8 additions and 0 deletions
8
parse.c
8
parse.c
|
@ -3746,6 +3746,11 @@ static void ConstExprFactor(void)
|
|||
ConstExprFactor();
|
||||
SendExprCommand(PCD_NEGATELOGICAL);
|
||||
break;
|
||||
case TK_TILDE:
|
||||
TK_NextToken();
|
||||
ConstExprFactor();
|
||||
SendExprCommand(PCD_NEGATEBINARY);
|
||||
break;
|
||||
default:
|
||||
ERR_Error(ERR_BAD_CONST_EXPR, YES);
|
||||
PushExStk(0);
|
||||
|
@ -3842,6 +3847,9 @@ static void SendExprCommand(pcd_t pcd)
|
|||
case PCD_NEGATELOGICAL:
|
||||
PushExStk(!PopExStk());
|
||||
break;
|
||||
case PCD_NEGATEBINARY:
|
||||
PushExStk(~PopExStk());
|
||||
break;
|
||||
case PCD_LSHIFT:
|
||||
operand2 = PopExStk();
|
||||
PushExStk(PopExStk()<<operand2);
|
||||
|
|
Loading…
Reference in a new issue