summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbjarni <bjarni@openttd.org>2007-01-05 20:46:53 +0000
committerbjarni <bjarni@openttd.org>2007-01-05 20:46:53 +0000
commit674dcfa5d2b6ecdc6af005d2675faece49d6d0a3 (patch)
tree23801016f0037793c0147ba29ae4c38e0b776767
parent7dff5fccd30e884eda50772efe9526359e642609 (diff)
downloadopenttd-674dcfa5d2b6ecdc6af005d2675faece49d6d0a3.tar.xz
(svn r7887) -Fix: [OSX] Endian32_Swap should always return a uint32, not a long unsigned int
This kills an OSX specific warning in newgrf_config.c Ensured that Endian16_Swap returns uint16 as well, even though that one didn't result in any warnings (yet)
-rw-r--r--src/stdafx.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/stdafx.h b/src/stdafx.h
index 8504e585c..eae4fa512 100644
--- a/src/stdafx.h
+++ b/src/stdafx.h
@@ -56,9 +56,10 @@
#ifdef __APPLE__
# include "os/macosx/osx_stdafx.h"
-// make endian swapping use Apple's macros to increase speed
-# define BSWAP32(x) Endian32_Swap(x)
-# define BSWAP16(x) Endian16_Swap(x)
+/* make endian swapping use Apple's macros to increase speed (since it will use hardware swapping if available)
+ * Even though they should return uint16 and uint32, we get warnings if we don't cast those (why?) */
+# define BSWAP32(x) ((uint32)Endian32_Swap(x))
+# define BSWAP16(x) ((uint16)Endian16_Swap(x))
#else
# define BSWAP32(x) ((((x) >> 24) & 0xFF) | (((x) >> 8) & 0xFF00) | (((x) << 8) & 0xFF0000) | (((x) << 24) & 0xFF000000))
# define BSWAP16(x) ((x) >> 8 | (x) << 8)