mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 14:51:51 +00:00
- backported Vector*::Sum() from Raze.
This commit is contained in:
parent
31ac1bd414
commit
4994e114c8
3 changed files with 20 additions and 0 deletions
|
@ -154,6 +154,7 @@ xx(stateinfo)
|
|||
xx(DamageFunction)
|
||||
xx(Length)
|
||||
xx(LengthSquared)
|
||||
xx(Sum)
|
||||
xx(Unit)
|
||||
xx(Angle)
|
||||
xx(PlusZ)
|
||||
|
|
|
@ -202,6 +202,7 @@ std2:
|
|||
'super' { RET(ParseVersion >= MakeVersion(1, 0, 0)? TK_Super : TK_Identifier); }
|
||||
'stop' { RET(TK_Stop); }
|
||||
'null' { RET(TK_Null); }
|
||||
'nullptr' { RET(ParseVersion >= MakeVersion(4, 9, 0)? TK_Null : TK_Identifier); }
|
||||
|
||||
'is' { RET(ParseVersion >= MakeVersion(1, 0, 0)? TK_Is : TK_Identifier); }
|
||||
'replaces' { RET(ParseVersion >= MakeVersion(1, 0, 0)? TK_Replaces : TK_Identifier); }
|
||||
|
|
|
@ -9365,6 +9365,7 @@ FxExpression *FxVectorBuiltin::Resolve(FCompileContext &ctx)
|
|||
assert(Self->IsVector());
|
||||
case NAME_Length:
|
||||
case NAME_LengthSquared:
|
||||
case NAME_Sum:
|
||||
ValueType = TypeFloat64;
|
||||
break;
|
||||
|
||||
|
@ -9396,6 +9397,23 @@ ExpEmit FxVectorBuiltin::Emit(VMFunctionBuilder *build)
|
|||
{
|
||||
build->Emit(vecSize == 2 ? OP_DOTV2_RR : vecSize == 3 ? OP_DOTV3_RR : OP_DOTV4_RR, to.RegNum, op.RegNum, op.RegNum);
|
||||
}
|
||||
else if (Function == NAME_Sum)
|
||||
{
|
||||
ExpEmit temp(build, ValueType->GetRegType(), 1);
|
||||
build->Emit(OP_FLOP, to.RegNum, op.RegNum, FLOP_ABS);
|
||||
build->Emit(OP_FLOP, temp.RegNum, op.RegNum + 1, FLOP_ABS);
|
||||
build->Emit(OP_ADDF_RR, to.RegNum, to.RegNum, temp.RegNum);
|
||||
if (vecSize > 2)
|
||||
{
|
||||
build->Emit(OP_FLOP, temp.RegNum, op.RegNum + 2, FLOP_ABS);
|
||||
build->Emit(OP_ADDF_RR, to.RegNum, to.RegNum, temp.RegNum);
|
||||
}
|
||||
if (vecSize > 3)
|
||||
{
|
||||
build->Emit(OP_FLOP, temp.RegNum, op.RegNum + 3, FLOP_ABS);
|
||||
build->Emit(OP_ADDF_RR, to.RegNum, to.RegNum, temp.RegNum);
|
||||
}
|
||||
}
|
||||
else if (Function == NAME_Unit)
|
||||
{
|
||||
ExpEmit len(build, REGT_FLOAT);
|
||||
|
|
Loading…
Reference in a new issue