diff options
author | glx <glx@openttd.org> | 2007-12-13 02:04:09 +0000 |
---|---|---|
committer | glx <glx@openttd.org> | 2007-12-13 02:04:09 +0000 |
commit | ab99e83a8320621f08ae4e97903491886ea18181 (patch) | |
tree | 818e19ab3841d84fee2f9c6aa0a5ce8567eae4cd /src | |
parent | 3b849778c13404a31104123d3fb2b318cdbea7c5 (diff) | |
download | openttd-ab99e83a8320621f08ae4e97903491886ea18181.tar.xz |
(svn r11627) -Fix [FS#1532] (r11145): poping from text reference stack must be done in a precise order. But some compiler (MSVC) over optimised it and inverted this order.
Diffstat (limited to 'src')
-rw-r--r-- | src/newgrf_text.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/newgrf_text.cpp b/src/newgrf_text.cpp index 1de167266..052c84f56 100644 --- a/src/newgrf_text.cpp +++ b/src/newgrf_text.cpp @@ -505,13 +505,25 @@ struct TextRefStack { uint8 PopUnsignedByte() { assert(this->position < lengthof(this->stack)); return this->stack[this->position++]; } int8 PopSignedByte() { return (int8)this->PopUnsignedByte(); } - uint16 PopUnsignedWord() { return this->PopUnsignedByte() | (((uint16)this->PopUnsignedByte()) << 8); } + uint16 PopUnsignedWord() + { + uint16 val = this->PopUnsignedByte(); + return val | (this->PopUnsignedByte() << 8); + } int16 PopSignedWord() { return (int32)this->PopUnsignedWord(); } - uint32 PopUnsignedDWord() { return this->PopUnsignedWord() | (((uint32)this->PopUnsignedWord()) << 16); } + uint32 PopUnsignedDWord() + { + uint32 val = this->PopUnsignedWord(); + return val | (this->PopUnsignedWord() << 16); + } int32 PopSignedDWord() { return (int32)this->PopUnsignedDWord(); } - uint64 PopUnsignedQWord() { return this->PopUnsignedDWord() | (((uint64)this->PopUnsignedDWord()) << 32); } + uint64 PopUnsignedQWord() + { + uint64 val = this->PopUnsignedDWord(); + return val | (((uint64)this->PopUnsignedDWord()) << 32); + } int64 PopSignedQWord() { return (int64)this->PopUnsignedQWord(); } /** Rotate the top four words down: W1, W2, W3, W4 -> W4, W1, W2, W3 */ |