summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2010-08-02 23:35:47 +0000
committerfrosch <frosch@openttd.org>2010-08-02 23:35:47 +0000
commit1a9d5ae076fb507cc6056f1da95e1789d2e0b1d9 (patch)
tree90c8fd69a7708a1e8b69d226735e4eb89bfd5e76
parent0e5c562da491ef857700c76d59af5c75be2e7296 (diff)
downloadopenttd-1a9d5ae076fb507cc6056f1da95e1789d2e0b1d9.tar.xz
(svn r20333) -Fix (r20332): Mask second operand to 5 bits to avoid differences between platforms.
-rw-r--r--src/newgrf_spritegroup.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/newgrf_spritegroup.cpp b/src/newgrf_spritegroup.cpp
index 3a543cf0c..6eb136598 100644
--- a/src/newgrf_spritegroup.cpp
+++ b/src/newgrf_spritegroup.cpp
@@ -124,9 +124,9 @@ static U EvalAdjustT(const DeterministicSpriteGroupAdjust *adjust, ResolverObjec
case DSGA_OP_ROR: return RotateRight(last_value, value);
case DSGA_OP_SCMP: return ((S)last_value == (S)value) ? 1 : ((S)last_value < (S)value ? 0 : 2);
case DSGA_OP_UCMP: return ((U)last_value == (U)value) ? 1 : ((U)last_value < (U)value ? 0 : 2);
- case DSGA_OP_SHL: return (U)last_value << (U)value;
- case DSGA_OP_SHR: return (U)last_value >> (U)value;
- case DSGA_OP_SAR: return (S)last_value >> (U)value;
+ case DSGA_OP_SHL: return (U)last_value << ((U)value & 0x1F); // mask 'value' to 5 bits, which should behave the same on all architectures.
+ case DSGA_OP_SHR: return (U)last_value >> ((U)value & 0x1F);
+ case DSGA_OP_SAR: return (S)last_value >> ((U)value & 0x1F);
default: return value;
}
}