mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-30 15:52:09 +00:00
- implemented ~== operator.
Turned out this was really simple because the functionality was already there.
This commit is contained in:
parent
09b82b8a3a
commit
43aec68559
2 changed files with 4 additions and 4 deletions
|
@ -2525,6 +2525,7 @@ FxExpression *FxCompareEq::Resolve(FCompileContext& ctx)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Operator == TK_ApproxEq && ValueType->GetRegType() != REGT_FLOAT) Operator = TK_Eq;
|
||||||
if (left->isConstant() && right->isConstant())
|
if (left->isConstant() && right->isConstant())
|
||||||
{
|
{
|
||||||
int v;
|
int v;
|
||||||
|
@ -2533,7 +2534,7 @@ FxExpression *FxCompareEq::Resolve(FCompileContext& ctx)
|
||||||
{
|
{
|
||||||
double v1 = static_cast<FxConstant *>(left)->GetValue().GetFloat();
|
double v1 = static_cast<FxConstant *>(left)->GetValue().GetFloat();
|
||||||
double v2 = static_cast<FxConstant *>(right)->GetValue().GetFloat();
|
double v2 = static_cast<FxConstant *>(right)->GetValue().GetFloat();
|
||||||
v = Operator == TK_Eq? v1 == v2 : v1 != v2;
|
v = Operator == TK_Eq? v1 == v2 : Operator == TK_Neq? v1 != v2 : fabs(v1-v2) < VM_EPSILON;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -2588,7 +2589,7 @@ ExpEmit FxCompareEq::Emit(VMFunctionBuilder *build)
|
||||||
|
|
||||||
// See FxUnaryNotBoolean for comments, since it's the same thing.
|
// See FxUnaryNotBoolean for comments, since it's the same thing.
|
||||||
build->Emit(OP_LI, to.RegNum, 0, 0);
|
build->Emit(OP_LI, to.RegNum, 0, 0);
|
||||||
build->Emit(instr, Operator != TK_Eq, op1.RegNum, op2.RegNum);
|
build->Emit(instr, Operator == TK_ApproxEq? CMP_APPROX : Operator != TK_Eq, op1.RegNum, op2.RegNum);
|
||||||
build->Emit(OP_JMP, 1);
|
build->Emit(OP_JMP, 1);
|
||||||
build->Emit(OP_LI, to.RegNum, 1);
|
build->Emit(OP_LI, to.RegNum, 1);
|
||||||
return to;
|
return to;
|
||||||
|
|
|
@ -2535,6 +2535,7 @@ FxExpression *ZCCCompiler::ConvertNode(ZCC_TreeNode *ast)
|
||||||
|
|
||||||
case PEX_EQEQ:
|
case PEX_EQEQ:
|
||||||
case PEX_NEQ:
|
case PEX_NEQ:
|
||||||
|
case PEX_APREQ:
|
||||||
return new FxCompareEq(tok, left, right);
|
return new FxCompareEq(tok, left, right);
|
||||||
|
|
||||||
case PEX_Assign:
|
case PEX_Assign:
|
||||||
|
@ -2563,8 +2564,6 @@ FxExpression *ZCCCompiler::ConvertNode(ZCC_TreeNode *ast)
|
||||||
// todo: These do not have representations in DECORATE and no implementation exists yet.
|
// todo: These do not have representations in DECORATE and no implementation exists yet.
|
||||||
case PEX_Concat:
|
case PEX_Concat:
|
||||||
case PEX_Is:
|
case PEX_Is:
|
||||||
// more esoteric operators
|
|
||||||
case PEX_APREQ:
|
|
||||||
|
|
||||||
// vector operations will be done later.
|
// vector operations will be done later.
|
||||||
case PEX_CrossProduct:
|
case PEX_CrossProduct:
|
||||||
|
|
Loading…
Reference in a new issue