SDL_Swap vs Intel_Swap?

tigital tigital at mac.com
Wed Jun 4 15:30:30 EDT 2003


hi,

...I have now ported most of the icculus SDL-based code to OSX, and it 
works nicely , but it has been brought to my attention by taylor that 
people would rather not use the SDL_endian.h functions for 
byteswapping...I think this is an ignorant position:  we can use part 
of SDL, but not all of it!?!

Instead, a bunch of extremely hacked code is being offered:

---------------------------------------------------------------
#if defined(MACINTOSH) || SDL_BYTEORDER == SDL_BIG_ENDIAN
#include "ppcconvert.h"

#define BIG_ENDIAN

#ifdef PLAT_UNIX
#include "SDL_endian.h"
#define INTEL_INT(x)	SDL_Swap32(x)
#define INTEL_SHORT(x)	SDL_Swap16(x)
#else
#define INTEL_INT(x)	SWAPINT(x)
#define INTEL_SHORT(x)	SWAPSHORT(x)
#endif // PLAT_UNIX

#define INTEL_FLOAT(x)	LoadLEFloat(x)

#else

#define INTEL_INT(x)	x
#define INTEL_SHORT(x)	x
#define INTEL_FLOAT(x)	(*x)

#endif // MACINTOSH or SDL_BYTEORDER
-------------------------------------------------------------

...does everyone really agree to do it this way?  Why?  What happens 
when someone comes along and says "I wanna compile this on some other 
ppc architecture"?  It'd be a lot easier to just use the SDL_endian.h 
routines:  they compile into no-ops on intel arch's...

l8r,
jamie




More information about the freespace2 mailing list