move parameters instead of copying.

This commit is contained in:
Jeff Hutchinson 2021-04-30 00:24:03 -04:00
parent 964fde8f09
commit dcd01e1231
2 changed files with 6 additions and 17 deletions

View file

@ -490,23 +490,7 @@ ConsoleValue CodeBlock::exec(U32 ip, const char* functionName, Namespace* thisNa
{
S32 reg = code[ip + (2 + 6 + 1 + 1) + i];
ConsoleValue& value = argv[i + 1];
switch (value.getType())
{
case ConsoleValueType::cvString:
gEvalState.setLocalStringVariable(reg, value.getString(), dStrlen(value.getString()));
break;
case ConsoleValueType::cvInteger:
gEvalState.setLocalIntVariable(reg, value.getInt());
break;
case ConsoleValueType::cvFloat:
gEvalState.setLocalFloatVariable(reg, value.getFloat());
break;
case ConsoleValueType::cvSTEntry:
gEvalState.setLocalStringTableEntryVariable(reg, value.getString());
break;
default:
AssertFatal(false, avar("Invalid local variable type. Type was: %i", value.getType()));
}
gEvalState.moveConsoleValue(reg, std::move(value));
}
ip = ip + fnArgc + (2 + 6 + 1 + 1);
curFloatTable = functionFloats;

View file

@ -622,6 +622,11 @@ public:
currentRegisterArray->values[reg].setStringTableEntry(val);
}
TORQUE_FORCEINLINE void moveConsoleValue(S32 reg, ConsoleValue val)
{
currentRegisterArray->values[reg] = std::move(val);
}
void pushFrame(StringTableEntry frameName, Namespace *ns, S32 regCount);
void popFrame();