diff options
author | Max Horn | 2003-12-18 01:00:24 +0000 |
---|---|---|
committer | Max Horn | 2003-12-18 01:00:24 +0000 |
commit | 5f4c9cbeeb6a32a96cff1357fb565843417dc051 (patch) | |
tree | b9cbe2093c71406e3b1c893d0eb8c73d17e63122 /common | |
parent | 5d2c2acf905115e33a48a5fc5855075b6f287d11 (diff) | |
download | scummvm-rg350-5f4c9cbeeb6a32a96cff1357fb565843417dc051.tar.gz scummvm-rg350-5f4c9cbeeb6a32a96cff1357fb565843417dc051.tar.bz2 scummvm-rg350-5f4c9cbeeb6a32a96cff1357fb565843417dc051.zip |
resolve an inconsistency in the FROM_* helper macros: now they *always* cast their argument to unsigned (previously, the LE funcs would do this when used on BE machines, and vice versa; but using a FROM_LE macro on a LE machine wouldn't cause a cast to unsigned; this potentially leads to endian bugs!)
svn-id: r11726
Diffstat (limited to 'common')
-rw-r--r-- | common/scummsys.h | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/common/scummsys.h b/common/scummsys.h index 0c520b09c1..74d470f95d 100644 --- a/common/scummsys.h +++ b/common/scummsys.h @@ -306,19 +306,19 @@ FORCEINLINE uint16 SWAP_BYTES_16(uint16 a) { #define READ_UINT32(a) READ_LE_UINT32(a) - #define FROM_LE_32(a) (a) - #define FROM_LE_16(a) (a) + #define FROM_LE_32(a) ((uint32)(a)) + #define FROM_LE_16(a) ((uint16)(a)) - #define TO_LE_32(a) (a) - #define TO_LE_16(a) (a) + #define TO_LE_32(a) ((uint32)(a)) + #define TO_LE_16(a) ((uint16)(a)) #define TO_BE_32(a) SWAP_BYTES_32(a) #define TO_BE_16(a) SWAP_BYTES_16(a) #elif defined(SCUMM_BIG_ENDIAN) - #define MKID(a) (a) - #define MKID_BE(a) (a) + #define MKID(a) ((uint32)(a)) + #define MKID_BE(a) ((uint32)(a)) //#define MKID_BE(a) SWAP_BYTES_32(a) #define READ_UINT32(a) READ_BE_UINT32(a) @@ -329,8 +329,8 @@ FORCEINLINE uint16 SWAP_BYTES_16(uint16 a) { #define TO_LE_32(a) SWAP_BYTES_32(a) #define TO_LE_16(a) SWAP_BYTES_16(a) - #define TO_BE_32(a) (a) - #define TO_BE_16(a) (a) + #define TO_BE_32(a) ((uint32)(a)) + #define TO_BE_16(a) ((uint16)(a)) #else |