diff options
author | rubidium <rubidium@openttd.org> | 2014-04-20 15:47:50 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2014-04-20 15:47:50 +0000 |
commit | bbed2ff9563ed102e538b512282b645c1e3ef7b6 (patch) | |
tree | cf83a202071dc831a064b14b53595f9e717191bd /src/newgrf.cpp | |
parent | 295076155c65c0eab2ca9250eedcd97128dfa915 (diff) | |
download | openttd-bbed2ff9563ed102e538b512282b645c1e3ef7b6.tar.xz |
(svn r26475) -Fix: potentially undefined shifts in NewGRF code
Diffstat (limited to 'src/newgrf.cpp')
-rw-r--r-- | src/newgrf.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/newgrf.cpp b/src/newgrf.cpp index 4485b717a..b567fc4c9 100644 --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -6736,7 +6736,7 @@ static void ParamSet(ByteReader *buf) if ((int32)src2 < 0) { res = src1 >> -(int32)src2; } else { - res = src1 << src2; + res = src1 << (src2 & 0x1F); // Same behaviour as in EvalAdjustT, mask 'value' to 5 bits, which should behave the same on all architectures. } break; @@ -6744,7 +6744,7 @@ static void ParamSet(ByteReader *buf) if ((int32)src2 < 0) { res = (int32)src1 >> -(int32)src2; } else { - res = (int32)src1 << src2; + res = (int32)src1 << (src2 & 0x1F); // Same behaviour as in EvalAdjustT, mask 'value' to 5 bits, which should behave the same on all architectures. } break; |