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:
Randy Heit 2014-02-04 20:27:05 -06:00
parent 26d4df32d4
commit f099d5e667

View file

@ -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);