VarAction2: Detect ops on previous constants which become loads

This commit is contained in:
Jonathan G Rennison
2022-05-29 12:57:23 +01:00
parent 1fec7d6ddb
commit a5f5be2dff
2 changed files with 33 additions and 0 deletions

View File

@@ -265,6 +265,22 @@ inline bool IsEvalAdjustOperationCommutative(DeterministicSpriteGroupAdjustOpera
}
}
inline bool IsEvalAdjustOperationOnConstantEffectiveLoad(DeterministicSpriteGroupAdjustOperation op, uint32 constant)
{
switch (op) {
case DSGA_OP_ADD:
case DSGA_OP_OR:
case DSGA_OP_XOR:
return constant == 0;
case DSGA_OP_MUL:
return constant == 1;
default:
return false;
}
}
struct DeterministicSpriteGroupAdjust {
DeterministicSpriteGroupAdjustOperation operation;
DeterministicSpriteGroupAdjustType type;