mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-12 19:31:41 +00:00
* BugFix: Correct 3 missing defines in the GCC types include file.
* BugFix: Move several compiledEval declarations around to resolve ordering issues. * BugFix: Experimentally remove the reference on an engineAPI template function to allow parameter types to match.
This commit is contained in:
parent
464cb7ae29
commit
6ad2876504
3 changed files with 64 additions and 61 deletions
|
|
@ -459,6 +459,39 @@ enum class FloatOperation
|
|||
NE
|
||||
};
|
||||
|
||||
template<FloatOperation Op>
|
||||
TORQUE_NOINLINE void doSlowMathOp()
|
||||
{
|
||||
ConsoleValue& a = stack[_STK];
|
||||
ConsoleValue& b = stack[_STK - 1];
|
||||
|
||||
// Arithmetic
|
||||
if constexpr (Op == FloatOperation::Add)
|
||||
stack[_STK - 1].setFloat(a.getFloat() + b.getFloat());
|
||||
else if constexpr (Op == FloatOperation::Sub)
|
||||
stack[_STK - 1].setFloat(a.getFloat() - b.getFloat());
|
||||
else if constexpr (Op == FloatOperation::Mul)
|
||||
stack[_STK - 1].setFloat(a.getFloat() * b.getFloat());
|
||||
else if constexpr (Op == FloatOperation::Div)
|
||||
stack[_STK - 1].setFloat(a.getFloat() / b.getFloat());
|
||||
|
||||
// Logical
|
||||
if constexpr (Op == FloatOperation::LT)
|
||||
stack[_STK - 1].setInt(a.getFloat() < b.getFloat());
|
||||
if constexpr (Op == FloatOperation::LE)
|
||||
stack[_STK - 1].setInt(a.getFloat() <= b.getFloat());
|
||||
if constexpr (Op == FloatOperation::GR)
|
||||
stack[_STK - 1].setInt(a.getFloat() > b.getFloat());
|
||||
if constexpr (Op == FloatOperation::GE)
|
||||
stack[_STK - 1].setInt(a.getFloat() >= b.getFloat());
|
||||
if constexpr (Op == FloatOperation::EQ)
|
||||
stack[_STK - 1].setInt(a.getFloat() == b.getFloat());
|
||||
if constexpr (Op == FloatOperation::NE)
|
||||
stack[_STK - 1].setInt(a.getFloat() != b.getFloat());
|
||||
|
||||
_STK--;
|
||||
}
|
||||
|
||||
template<FloatOperation Op>
|
||||
TORQUE_FORCEINLINE void doFloatMathOperation()
|
||||
{
|
||||
|
|
@ -500,39 +533,6 @@ TORQUE_FORCEINLINE void doFloatMathOperation()
|
|||
}
|
||||
}
|
||||
|
||||
template<FloatOperation Op>
|
||||
TORQUE_NOINLINE void doSlowMathOp()
|
||||
{
|
||||
ConsoleValue& a = stack[_STK];
|
||||
ConsoleValue& b = stack[_STK - 1];
|
||||
|
||||
// Arithmetic
|
||||
if constexpr (Op == FloatOperation::Add)
|
||||
stack[_STK - 1].setFloat(a.getFloat() + b.getFloat());
|
||||
else if constexpr (Op == FloatOperation::Sub)
|
||||
stack[_STK - 1].setFloat(a.getFloat() - b.getFloat());
|
||||
else if constexpr (Op == FloatOperation::Mul)
|
||||
stack[_STK - 1].setFloat(a.getFloat() * b.getFloat());
|
||||
else if constexpr (Op == FloatOperation::Div)
|
||||
stack[_STK - 1].setFloat(a.getFloat() / b.getFloat());
|
||||
|
||||
// Logical
|
||||
if constexpr (Op == FloatOperation::LT)
|
||||
stack[_STK - 1].setInt(a.getFloat() < b.getFloat());
|
||||
if constexpr (Op == FloatOperation::LE)
|
||||
stack[_STK - 1].setInt(a.getFloat() <= b.getFloat());
|
||||
if constexpr (Op == FloatOperation::GR)
|
||||
stack[_STK - 1].setInt(a.getFloat() > b.getFloat());
|
||||
if constexpr (Op == FloatOperation::GE)
|
||||
stack[_STK - 1].setInt(a.getFloat() >= b.getFloat());
|
||||
if constexpr (Op == FloatOperation::EQ)
|
||||
stack[_STK - 1].setInt(a.getFloat() == b.getFloat());
|
||||
if constexpr (Op == FloatOperation::NE)
|
||||
stack[_STK - 1].setInt(a.getFloat() != b.getFloat());
|
||||
|
||||
_STK--;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
enum class IntegerOperation
|
||||
|
|
@ -547,6 +547,33 @@ enum class IntegerOperation
|
|||
LogicalOr
|
||||
};
|
||||
|
||||
template<IntegerOperation Op>
|
||||
TORQUE_NOINLINE void doSlowIntegerOp()
|
||||
{
|
||||
ConsoleValue& a = stack[_STK];
|
||||
ConsoleValue& b = stack[_STK - 1];
|
||||
|
||||
// Bitwise Op
|
||||
if constexpr (Op == IntegerOperation::BitAnd)
|
||||
stack[_STK - 1].setInt(a.getInt() & b.getInt());
|
||||
if constexpr (Op == IntegerOperation::BitOr)
|
||||
stack[_STK - 1].setInt(a.getInt() | b.getInt());
|
||||
if constexpr (Op == IntegerOperation::Xor)
|
||||
stack[_STK - 1].setInt(a.getInt() ^ b.getInt());
|
||||
if constexpr (Op == IntegerOperation::LShift)
|
||||
stack[_STK - 1].setInt(a.getInt() << b.getInt());
|
||||
if constexpr (Op == IntegerOperation::RShift)
|
||||
stack[_STK - 1].setInt(a.getInt() >> b.getInt());
|
||||
|
||||
// Logical Op
|
||||
if constexpr (Op == IntegerOperation::LogicalAnd)
|
||||
stack[_STK - 1].setInt(a.getInt() && b.getInt());
|
||||
if constexpr (Op == IntegerOperation::LogicalOr)
|
||||
stack[_STK - 1].setInt(a.getInt() || b.getInt());
|
||||
|
||||
_STK--;
|
||||
}
|
||||
|
||||
template<IntegerOperation Op>
|
||||
TORQUE_FORCEINLINE void doIntOperation()
|
||||
{
|
||||
|
|
@ -581,33 +608,6 @@ TORQUE_FORCEINLINE void doIntOperation()
|
|||
}
|
||||
}
|
||||
|
||||
template<IntegerOperation Op>
|
||||
TORQUE_NOINLINE void doSlowIntegerOp()
|
||||
{
|
||||
ConsoleValue& a = stack[_STK];
|
||||
ConsoleValue& b = stack[_STK - 1];
|
||||
|
||||
// Bitwise Op
|
||||
if constexpr (Op == IntegerOperation::BitAnd)
|
||||
stack[_STK - 1].setInt(a.getInt() & b.getInt());
|
||||
if constexpr (Op == IntegerOperation::BitOr)
|
||||
stack[_STK - 1].setInt(a.getInt() | b.getInt());
|
||||
if constexpr (Op == IntegerOperation::Xor)
|
||||
stack[_STK - 1].setInt(a.getInt() ^ b.getInt());
|
||||
if constexpr (Op == IntegerOperation::LShift)
|
||||
stack[_STK - 1].setInt(a.getInt() << b.getInt());
|
||||
if constexpr (Op == IntegerOperation::RShift)
|
||||
stack[_STK - 1].setInt(a.getInt() >> b.getInt());
|
||||
|
||||
// Logical Op
|
||||
if constexpr (Op == IntegerOperation::LogicalAnd)
|
||||
stack[_STK - 1].setInt(a.getInt() && b.getInt());
|
||||
if constexpr (Op == IntegerOperation::LogicalOr)
|
||||
stack[_STK - 1].setInt(a.getInt() || b.getInt());
|
||||
|
||||
_STK--;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
U32 gExecCount = 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue