summaryrefslogtreecommitdiff
path: root/stdafx.h
diff options
context:
space:
mode:
authorsignde <signde@openttd.org>2004-09-17 16:35:56 +0000
committersignde <signde@openttd.org>2004-09-17 16:35:56 +0000
commite049bd9b2b397be5882b8b78e457e63d179fb81b (patch)
treeb1a608846431c00cfce5a6fb677c493f0504fd7f /stdafx.h
parentf7cfd47261cdb03a2b1e93266d038fd62879daa4 (diff)
downloadopenttd-e049bd9b2b397be5882b8b78e457e63d179fb81b.tar.xz
(svn r281) -Fix: some endian issues fixed in network code
Diffstat (limited to 'stdafx.h')
-rw-r--r--stdafx.h23
1 files changed, 18 insertions, 5 deletions
diff --git a/stdafx.h b/stdafx.h
index fd2c655c9..00b829bee 100644
--- a/stdafx.h
+++ b/stdafx.h
@@ -113,19 +113,32 @@ typedef unsigned __int64 uint64;
// Setup alignment and conversion macros
#if defined(TTD_BIG_ENDIAN)
+
# define TTD_ALIGNMENT_2
# define TTD_ALIGNMENT_4
+
static uint32 INLINE TO_LE32(uint32 x) { return BSWAP32(x); }
static uint16 INLINE TO_LE16(uint16 x) { return BSWAP16(x); }
-# define TO_BE32(x) x
-# define TO_BE16(x) x
+static uint32 INLINE FROM_LE32(uint32 x) { return BSWAP32(x); }
+static uint16 INLINE FROM_LE16(uint16 x) { return BSWAP16(x); }
+#define TO_BE32(x) x
+#define TO_BE16(x) x
+#define FROM_BE32(x) x
+#define FROM_BE16(x) x
#define TO_BE32X(x) x
+
#else
-# define TO_LE32(x) x
-# define TO_LE16(x) x
-#define TO_BE32X(x) BSWAP32(x)
+
static uint32 FORCEINLINE TO_BE32(uint32 x) { return BSWAP32(x); }
static uint16 FORCEINLINE TO_BE16(uint16 x) { return BSWAP16(x); }
+static uint32 FORCEINLINE FROM_BE32(uint32 x) { return BSWAP32(x); }
+static uint16 FORCEINLINE FROM_BE16(uint16 x) { return BSWAP16(x); }
+#define TO_LE32(x) x
+#define TO_LE16(x) x
+#define TO_BE32X(x) BSWAP32(x)
+#define FROM_LE32(x) x
+#define FROM_LE16(x) x
+
#endif
#if !defined(GAME_DATA_DIR)