include/SDL_byteorder.h
changeset 1137 0f9d463bf09c
parent 969 cfb9518670f4
child 1190 173c063d4f55
equal deleted inserted replaced
1136:d16c010d5d98 1137:0f9d463bf09c
    32 
    32 
    33 /* The two types of endianness */
    33 /* The two types of endianness */
    34 #define SDL_LIL_ENDIAN	1234
    34 #define SDL_LIL_ENDIAN	1234
    35 #define SDL_BIG_ENDIAN	4321
    35 #define SDL_BIG_ENDIAN	4321
    36 
    36 
       
    37 #ifdef __linux__
       
    38 # include <endian.h>
       
    39 # if BYTE_ORDER == LITTLE_ENDIAN
       
    40 #  define SDL_BYTEORDER SDL_LIL_ENDIAN
       
    41 # else
       
    42 #  define SDL_BYTEORDER SDL_BIG_ENDIAN
       
    43 # endif
       
    44 
       
    45 #else
       
    46 
    37 /* Pardon the mess, I'm trying to determine the endianness of this host.
    47 /* Pardon the mess, I'm trying to determine the endianness of this host.
    38    I'm doing it by preprocessor defines rather than some sort of configure
    48    I'm doing it by preprocessor defines rather than some sort of configure
    39    script so that application code can use this too.  The "right" way would
    49    script so that application code can use this too.  The "right" way would
    40    be to dynamically generate this file on install, but that's a lot of work.
    50    be to dynamically generate this file on install, but that's a lot of work.
    41  */
    51  */
    42 #if (defined(__i386__) || defined(__i386)) || \
    52 #if (defined(__i386__) || defined(__i386)) || \
    43      defined(__ia64__) || defined(WIN32) || \
    53      defined(__ia64__) || defined(WIN32) || \
    44     (defined(__alpha__) || defined(__alpha)) || \
    54     (defined(__alpha__) || defined(__alpha)) || \
    45      defined(__arm__) || \
    55     (defined(__arm__) || defined(__thumb__)) || \
       
    56     (defined(__sh__) || defined(__sh64__)) || \
    46     (defined(__mips__) && defined(__MIPSEL__)) || \
    57     (defined(__mips__) && defined(__MIPSEL__)) || \
    47      defined(__SYMBIAN32__) || \
    58      defined(__SYMBIAN32__) || \
    48      defined(__x86_64__) || \
    59      defined(__x86_64__) || \
    49      defined(__LITTLE_ENDIAN__)
    60      defined(__LITTLE_ENDIAN__)
    50 #define SDL_BYTEORDER	SDL_LIL_ENDIAN
    61 #define SDL_BYTEORDER	SDL_LIL_ENDIAN
    51 #else
    62 #else
    52 #define SDL_BYTEORDER	SDL_BIG_ENDIAN
    63 #define SDL_BYTEORDER	SDL_BIG_ENDIAN
    53 #endif
    64 #endif
    54 
    65 
       
    66 #endif /* __linux__ */
       
    67 
    55 #endif /* _SDL_byteorder_h */
    68 #endif /* _SDL_byteorder_h */