Commit 989dfdb0 authored by Ryan C. Gordon's avatar Ryan C. Gordon

Byte order detection fixes in SDL_endian.h ...

--ryan.




From: Mike Frysinger <vapier@gentoo.org>
To: sdl@libsdl.org
Date: Thu, 1 Sep 2005 20:25:01 -0400
Subject: [SDL] [patch] add support for arm/thumb and superh to endian

find attached a patch to add support for detecting endian on superh and
arm/thumb ... also, ive incorporated a patch from Fedora which will gather
the correct endian on a linux host from the system endian.h instead of just
trying to maintain an ever-growing list of architectures
-mike

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401140
parent 36330ae2
...@@ -34,6 +34,16 @@ static char rcsid = ...@@ -34,6 +34,16 @@ static char rcsid =
#define SDL_LIL_ENDIAN 1234 #define SDL_LIL_ENDIAN 1234
#define SDL_BIG_ENDIAN 4321 #define SDL_BIG_ENDIAN 4321
#ifdef __linux__
# include <endian.h>
# if BYTE_ORDER == LITTLE_ENDIAN
# define SDL_BYTEORDER SDL_LIL_ENDIAN
# else
# define SDL_BYTEORDER SDL_BIG_ENDIAN
# endif
#else
/* Pardon the mess, I'm trying to determine the endianness of this host. /* Pardon the mess, I'm trying to determine the endianness of this host.
I'm doing it by preprocessor defines rather than some sort of configure I'm doing it by preprocessor defines rather than some sort of configure
script so that application code can use this too. The "right" way would script so that application code can use this too. The "right" way would
...@@ -42,7 +52,8 @@ static char rcsid = ...@@ -42,7 +52,8 @@ static char rcsid =
#if (defined(__i386__) || defined(__i386)) || \ #if (defined(__i386__) || defined(__i386)) || \
defined(__ia64__) || defined(WIN32) || \ defined(__ia64__) || defined(WIN32) || \
(defined(__alpha__) || defined(__alpha)) || \ (defined(__alpha__) || defined(__alpha)) || \
defined(__arm__) || \ (defined(__arm__) || defined(__thumb__)) || \
(defined(__sh__) || defined(__sh64__)) || \
(defined(__mips__) && defined(__MIPSEL__)) || \ (defined(__mips__) && defined(__MIPSEL__)) || \
defined(__SYMBIAN32__) || \ defined(__SYMBIAN32__) || \
defined(__x86_64__) || \ defined(__x86_64__) || \
...@@ -52,4 +63,6 @@ static char rcsid = ...@@ -52,4 +63,6 @@ static char rcsid =
#define SDL_BYTEORDER SDL_BIG_ENDIAN #define SDL_BYTEORDER SDL_BIG_ENDIAN
#endif #endif
#endif /* __linux__ */
#endif /* _SDL_byteorder_h */ #endif /* _SDL_byteorder_h */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment