39 #include "SDL_byteorder.h"
40 #include "SDL_endian.h"
49 #define ConvertLE16(v) SDL_SwapLE16((v))
54 #define ConvertLE32(v) SDL_SwapLE32((v))
59 #ifdef __ULTRA_SPARC__
61 extern unsigned short inline AccessLE16(
unsigned char *p)
63 return p[0] + (p[1] << 8);
68 #define AccessLE16(p) SDL_SwapLE16(*((unsigned short *)(p)))
75 #ifdef __ULTRA_SPARC__
77 extern unsigned inline AccessLE32(
unsigned char *p)
79 return p[0] + (p[1] << 8) + (p[2] << 16) + (p[3] << 24);
84 #define AccessLE32(p) SDL_SwapLE32(*((unsigned int *)(p)))
92 #ifdef __ULTRA_SPARC__
94 extern unsigned short inline _FetchLE16(
unsigned char **pp)
96 unsigned char *p = *pp;
97 unsigned short i = p[0] + (p[1] << 8);
101 #define FetchLE16(p) _FetchLE16(&p)
105 #define FetchLE16(p) SDL_SwapLE16(*((unsigned short *)(p))); p += 2
113 #ifdef __ULTRA_SPARC__
115 extern unsigned inline _FetchLE32(
unsigned char **pp)
117 unsigned char *p = *pp;
118 unsigned int i = p[0] + (p[1] << 8) + (p[2] << 16) + (p[3] << 24);
122 #define FetchLE32(p) _FetchLE32(&p)
126 #define FetchLE32(p) SDL_SwapLE32(*((unsigned int *)(p))); p += 4
131 #if SDL_BYTEORDER == SDL_LIL_ENDIAN
132 #define STRATAGUS_LITTLE_ENDIAN
133 #elif SDL_BYTEORDER == SDL_BIG_ENDIAN
134 #define STRATAGUS_BIG_ENDIAN
136 #error Neither SDL_BIG_ENDIAN nor SDL_LIL_ENDIAN is set
147 #if !defined(USE_WIN32)
150 #include <sys/types.h>
155 #if defined(__BYTE_ORDER) && __BYTE_ORDER == __BIG_ENDIAN
156 #include <byteswap.h>
160 #include <architecture/byte_order.h>
169 #if defined(__BYTE_ORDER) && __BYTE_ORDER == __BIG_ENDIAN
174 #define ConvertLE16(v) bswap_16((v))
179 #define ConvertLE32(v) bswap_32((v))
188 #define ConvertLE16(v) NXSwapLittleShortToHost(v)
193 #define ConvertLE32(v) NXSwapLittleIntToHost(v)
200 #define ConvertLE16(v) (v)
205 #define ConvertLE32(v) (v)
207 #endif // defined(USE_MAC)
209 #endif // ! defined(__BYTE_ORDER) && __BYTE_ORDER == __BIG_ENDIAN
214 #define AccessLE16(p) ConvertLE16(*((unsigned short *)(p)))
219 #define AccessLE32(p) ConvertLE32(*((unsigned int *)(p)))
225 #define FetchLE16(p) ConvertLE16(*((unsigned short *)(p))++)
231 #define FetchLE32(p) ConvertLE32(*((unsigned int *)(p))++)
237 #define FetchByte(p) (*((unsigned char *)(p))++)
241 #endif // !__ENDIAN_H__
#define AccessLE16(p)
Definition: myendian.h:68
#define AccessLE32(p)
Definition: myendian.h:84