From 5f4c9cbeeb6a32a96cff1357fb565843417dc051 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Thu, 18 Dec 2003 01:00:24 +0000 Subject: 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 --- common/scummsys.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'common') 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 -- cgit v1.2.3