mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-16 17:32:13 +00:00
c660bfb129
2. Added the svn:ignore properties to clean up the output of "svn update" so that it doesn't show some unversioned files anymore sush as compiled binaries and object files(*.a). 3. Converted the end-of-line charapter sequences from Windows(CR LF) to Unix format(LF). It used to be a mixture of both styles that often confuse some programs. If some files have to be in Windows format, you should add the svn:eol-style on them(svn propset svn:eol-style native polymer/eduke32/source/thefile.c). git-svn-id: https://svn.eduke32.com/eduke32@854 1a8010ca-5511-0410-912e-c29ae57300e0
61 lines
1.3 KiB
C
61 lines
1.3 KiB
C
#ifndef _INCLUDE_PLATFORM_H_
|
|
#define _INCLUDE_PLATFORM_H_
|
|
|
|
#if (!defined __EXPORT__)
|
|
#define __EXPORT__
|
|
#endif
|
|
|
|
#if (defined __WATCOMC__)
|
|
#define snprintf _snprintf
|
|
#endif
|
|
|
|
static __inline unsigned short _swap16(unsigned short D)
|
|
{
|
|
#if PLATFORM_MACOSX
|
|
register unsigned short returnValue;
|
|
__asm__ volatile("lhbrx %0,0,%1"
|
|
: "=r" (returnValue)
|
|
: "r" (&D)
|
|
);
|
|
return returnValue;
|
|
#else
|
|
return((D<<8)|(D>>8));
|
|
#endif
|
|
}
|
|
|
|
static __inline unsigned int _swap32(unsigned int D)
|
|
{
|
|
#if PLATFORM_MACOSX
|
|
register unsigned int returnValue;
|
|
__asm__ volatile("lwbrx %0,0,%1"
|
|
: "=r" (returnValue)
|
|
: "r" (&D)
|
|
);
|
|
return returnValue;
|
|
#else
|
|
return((D<<24)|((D<<8)&0x00FF0000)|((D>>8)&0x0000FF00)|(D>>24));
|
|
#endif
|
|
}
|
|
|
|
#if PLATFORM_MACOSX
|
|
#define PLATFORM_BIGENDIAN 1
|
|
#define BUILDSWAP_INTEL16(x) _swap16(x)
|
|
#define BUILDSWAP_INTEL32(x) _swap32(x)
|
|
#else
|
|
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
|
#define PLATFORM_LITTLEENDIAN 1
|
|
#define BUILDSWAP_INTEL16(x) (x)
|
|
#define BUILDSWAP_INTEL32(x) (x)
|
|
#else
|
|
#define PLATFORM_BIGENDIAN 1
|
|
#define BUILDSWAP_INTEL16(x) _swap16(x)
|
|
#define BUILDSWAP_INTEL32(x) _swap32(x)
|
|
#endif
|
|
#endif
|
|
|
|
extern int has_altivec; /* PowerPC-specific. */
|
|
|
|
#endif /* !defined _INCLUDE_PLATFORM_H_ */
|
|
|
|
/* end of platform.h ... */
|
|
|