include/SDL_endian.h
changeset 1354 22f39393668a
parent 1353 7ba544e2888d
child 1368 533567cbb576
     1.1 --- a/include/SDL_endian.h	Thu Feb 09 09:07:13 2006 +0000
     1.2 +++ b/include/SDL_endian.h	Thu Feb 09 09:38:05 2006 +0000
     1.3 @@ -25,22 +25,26 @@
     1.4  #ifndef _SDL_endian_h
     1.5  #define _SDL_endian_h
     1.6  
     1.7 -/* These functions read and write data of the specified endianness, 
     1.8 -   dynamically translating to the host machine endianness.
     1.9 +#include "SDL_stdinc.h"
    1.10  
    1.11 -   e.g.: If you want to read a 16 bit value on big-endian machine from
    1.12 -         an open file containing little endian values, you would use:
    1.13 -		value = SDL_ReadLE16(rp);
    1.14 -         Note that the read/write functions use SDL_RWops pointers
    1.15 -         instead of FILE pointers.  This allows you to read and write
    1.16 -         endian values from large chunks of memory as well as files 
    1.17 -         and other data sources.
    1.18 -*/
    1.19 +/* The two types of endianness */
    1.20 +#define SDL_LIL_ENDIAN	1234
    1.21 +#define SDL_BIG_ENDIAN	4321
    1.22  
    1.23 -#include "SDL_types.h"
    1.24 -//#warning FIXME: move rwops into rwops and swapping into byteorder.h
    1.25 -#include "SDL_rwops.h"
    1.26 -#include "SDL_byteorder.h"
    1.27 +#ifndef SDL_BYTEORDER	/* Not defined in SDL_config.h? */
    1.28 +#if (defined(__i386__) || defined(__i386)) || \
    1.29 +     defined(__ia64__) || defined(__x86_64__) || \
    1.30 +    (defined(__alpha__) || defined(__alpha)) || \
    1.31 +    (defined(__arm__) || defined(__thumb__)) || \
    1.32 +    (defined(__sh__) || defined(__sh64__)) || \
    1.33 +    (defined(__mips__) && defined(__MIPSEL__)) || \
    1.34 +     defined(__SYMBIAN32__) || defined(__OS2__)
    1.35 +#define SDL_BYTEORDER	SDL_LIL_ENDIAN
    1.36 +#else
    1.37 +#define SDL_BYTEORDER	SDL_BIG_ENDIAN
    1.38 +#endif
    1.39 +#endif /* !SDL_BYTEORDER */
    1.40 +
    1.41  
    1.42  #include "begin_code.h"
    1.43  /* Set up for C function definitions, even when using C++ */
    1.44 @@ -180,23 +184,6 @@
    1.45  #define SDL_SwapBE64(X)	(X)
    1.46  #endif
    1.47  
    1.48 -/* Read an item of the specified endianness and return in native format */
    1.49 -extern DECLSPEC Uint16 SDLCALL SDL_ReadLE16(SDL_RWops *src);
    1.50 -extern DECLSPEC Uint16 SDLCALL SDL_ReadBE16(SDL_RWops *src);
    1.51 -extern DECLSPEC Uint32 SDLCALL SDL_ReadLE32(SDL_RWops *src);
    1.52 -extern DECLSPEC Uint32 SDLCALL SDL_ReadBE32(SDL_RWops *src);
    1.53 -extern DECLSPEC Uint64 SDLCALL SDL_ReadLE64(SDL_RWops *src);
    1.54 -extern DECLSPEC Uint64 SDLCALL SDL_ReadBE64(SDL_RWops *src);
    1.55 -
    1.56 -/* Write an item of native format to the specified endianness */
    1.57 -extern DECLSPEC int SDLCALL SDL_WriteLE16(SDL_RWops *dst, Uint16 value);
    1.58 -extern DECLSPEC int SDLCALL SDL_WriteBE16(SDL_RWops *dst, Uint16 value);
    1.59 -extern DECLSPEC int SDLCALL SDL_WriteLE32(SDL_RWops *dst, Uint32 value);
    1.60 -extern DECLSPEC int SDLCALL SDL_WriteBE32(SDL_RWops *dst, Uint32 value);
    1.61 -extern DECLSPEC int SDLCALL SDL_WriteLE64(SDL_RWops *dst, Uint64 value);
    1.62 -extern DECLSPEC int SDLCALL SDL_WriteBE64(SDL_RWops *dst, Uint64 value);
    1.63 -
    1.64 -
    1.65  /* Ends C function definitions when using C++ */
    1.66  #ifdef __cplusplus
    1.67  }