mirror of https://github.com/OpenTTD/OpenTTD
Add: [NewGRF] More basic bitwise operators for varact2.
Adds ANDN, NAND, NOR and XNOR operators for whoever might find them useful.pull/13566/head
parent
cb23bc5e2a
commit
7912a69246
|
@ -175,6 +175,10 @@ static U EvalAdjustT(const DeterministicSpriteGroupAdjust &adjust, ScopeResolver
|
|||
case DSGA_OP_SHL: return (uint32_t)(U)last_value << ((U)value & 0x1F); // Same behaviour as in ParamSet, mask 'value' to 5 bits, which should behave the same on all architectures.
|
||||
case DSGA_OP_SHR: return (uint32_t)(U)last_value >> ((U)value & 0x1F);
|
||||
case DSGA_OP_SAR: return (int32_t)(S)last_value >> ((U)value & 0x1F);
|
||||
case DSGA_OP_ANDN: return last_value & ~value;
|
||||
case DSGA_OP_NAND: return ~(last_value & value);
|
||||
case DSGA_OP_NOR: return ~(last_value | value);
|
||||
case DSGA_OP_XNOR: return ~(last_value ^ value);
|
||||
default: return value;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -141,6 +141,10 @@ enum DeterministicSpriteGroupAdjustOperation : uint8_t {
|
|||
DSGA_OP_SHL, ///< a << b
|
||||
DSGA_OP_SHR, ///< (unsigned) a >> b
|
||||
DSGA_OP_SAR, ///< (signed) a >> b
|
||||
DSGA_OP_ANDN, ///< x & ~y
|
||||
DSGA_OP_NAND, ///< ~(x & y)
|
||||
DSGA_OP_NOR, ///< ~(x | y)
|
||||
DSGA_OP_XNOR, ///< ~(x ^ y)
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue