- fixed code generation for min/max when the first operand was a local variable or constant.

The code for constants was not optimal because the first operand of the instructions cannot be constant. This was solved by swapping it with the second choice which will always be non-constant.
The code for local variables did not allocate a new destination register and would overwrite the first parameter's variable.
This commit is contained in:
Christoph Oelckers 2017-03-09 09:36:12 +01:00
commit 77bac4f6fa
2 changed files with 19 additions and 10 deletions

View file

@ -276,7 +276,7 @@ void ZCCCompiler::ProcessStruct(ZCC_Struct *cnode, PSymbolTreeNode *treenode, ZC
//==========================================================================
ZCCCompiler::ZCCCompiler(ZCC_AST &ast, DObject *_outer, PSymbolTable &_symbols, PNamespace *_outnamespc, int lumpnum, const VersionInfo &ver)
: Outer(_outer), GlobalTreeNodes(&_symbols), OutNamespace(_outnamespc), AST(ast), Lump(lumpnum), mVersion(ver)
: Outer(_outer), GlobalTreeNodes(&_symbols), OutNamespace(_outnamespc), AST(ast), mVersion(ver), Lump(lumpnum)
{
FScriptPosition::ResetErrorCounter();
// Group top-level nodes by type