SDL_endian.h: Fix byte order detection on Solaris (and some SPARC compilers).

Fixes #10093.

(Sort of cherry-picked from 14183f8ecac099982883331ae7e405f82e42aa6b.)
This commit is contained in:
Ryan C. Gordon 2024-06-28 00:14:26 -04:00
parent d8e68aea9d
commit d7ee9ce455
No known key found for this signature in database
GPG Key ID: FA148B892AB48044
1 changed files with 10 additions and 1 deletions

View File

@ -59,6 +59,15 @@ _m_prefetch(void *__P)
#ifdef SDL_PLATFORM_LINUX
#include <endian.h>
#define SDL_BYTEORDER __BYTE_ORDER
#elif defined(SDL_PLATFORM_SOLARIS)
#include <sys/byteorder.h>
#if defined(_LITTLE_ENDIAN)
#define SDL_BYTEORDER SDL_LIL_ENDIAN
#elif defined(_BIG_ENDIAN)
#define SDL_BYTEORDER SDL_BIG_ENDIAN
#else
#error Unsupported endianness
#endif
#elif defined(SDL_PLATFORM_OPENBSD) || defined(__DragonFly__)
#include <endian.h>
#define SDL_BYTEORDER BYTE_ORDER
@ -79,7 +88,7 @@ _m_prefetch(void *__P)
defined(__m68k__) || defined(mc68000) || defined(_M_M68K) || \
(defined(__MIPS__) && defined(__MIPSEB__)) || \
defined(__ppc__) || defined(__POWERPC__) || defined(__powerpc__) || defined(__PPC__) || \
defined(__sparc__)
defined(__sparc__) || defined(__sparc)
#define SDL_BYTEORDER SDL_BIG_ENDIAN
#else
#define SDL_BYTEORDER SDL_LIL_ENDIAN