VarAction2: Detect and replace reversed commutative op via temp storage

This commit is contained in:
Jonathan G Rennison
2022-05-29 11:59:03 +01:00
parent 762cfb3df7
commit 1fec7d6ddb
2 changed files with 30 additions and 1 deletions

View File

@@ -250,6 +250,20 @@ inline bool IsEvalAdjustUsableForConstantPropagation(DeterministicSpriteGroupAdj
}
}
inline bool IsEvalAdjustOperationCommutative(DeterministicSpriteGroupAdjustOperation op)
{
switch (op) {
case DSGA_OP_ADD:
case DSGA_OP_MUL:
case DSGA_OP_AND:
case DSGA_OP_OR:
case DSGA_OP_XOR:
return true;
default:
return false;
}
}
struct DeterministicSpriteGroupAdjust {
DeterministicSpriteGroupAdjustOperation operation;