mbspc: use newer q_platform.h from ioq3, enables win64 compilation
This commit is contained in:
parent
f23917bf23
commit
4b1b789fa8
|
|
@ -24,6 +24,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
#define __Q_PLATFORM_H
|
#define __Q_PLATFORM_H
|
||||||
|
|
||||||
// this is for determining if we have an asm version of a C function
|
// this is for determining if we have an asm version of a C function
|
||||||
|
#define idx64 0
|
||||||
|
|
||||||
#ifdef Q3_VM
|
#ifdef Q3_VM
|
||||||
|
|
||||||
#define id386 0
|
#define id386 0
|
||||||
|
|
@ -44,7 +46,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
#define idppc 1
|
#define idppc 1
|
||||||
#if defined(__VEC__)
|
#if defined(__VEC__)
|
||||||
#define idppc_altivec 1
|
#define idppc_altivec 1
|
||||||
#ifdef MACOS_X // Apple's GCC does this differently than the FSF.
|
#ifdef __APPLE__ // Apple's GCC does this differently than the FSF.
|
||||||
#define VECCONST_UINT8(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) \
|
#define VECCONST_UINT8(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) \
|
||||||
(vector unsigned char) (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p)
|
(vector unsigned char) (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p)
|
||||||
#else
|
#else
|
||||||
|
|
@ -67,19 +69,57 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef __ASM_I386__ // don't include the C bits if included from qasm.h
|
#ifndef __ASM_I386__ // don't include the C bits if included from qasm.h
|
||||||
|
|
||||||
// for windows fastcall option
|
// for windows fastcall option
|
||||||
#define QDECL
|
#define QDECL
|
||||||
|
#define QCALL
|
||||||
|
|
||||||
//================================================================= WIN32 ===
|
//================================================================= WIN64/32 ===
|
||||||
|
|
||||||
#ifdef _WIN32
|
#if defined(_WIN64) || defined(__WIN64__)
|
||||||
|
|
||||||
|
#undef idx64
|
||||||
|
#define idx64 1
|
||||||
|
|
||||||
#undef QDECL
|
#undef QDECL
|
||||||
#define QDECL __cdecl
|
#define QDECL __cdecl
|
||||||
|
|
||||||
#define OS_STRING "win32"
|
#undef QCALL
|
||||||
|
#define QCALL __stdcall
|
||||||
|
|
||||||
|
#if defined( _MSC_VER )
|
||||||
|
#define OS_STRING "win_msvc64"
|
||||||
|
#elif defined __MINGW64__
|
||||||
|
#define OS_STRING "win_mingw64"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define ID_INLINE __inline
|
||||||
|
#define PATH_SEP '\\'
|
||||||
|
|
||||||
|
#if defined( __WIN64__ )
|
||||||
|
#define ARCH_STRING "x86_64"
|
||||||
|
#elif defined _M_ALPHA
|
||||||
|
#define ARCH_STRING "AXP"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define Q3_LITTLE_ENDIAN
|
||||||
|
|
||||||
|
#define DLL_EXT ".dll"
|
||||||
|
|
||||||
|
#elif defined(_WIN32) || defined(__WIN32__)
|
||||||
|
|
||||||
|
#undef QDECL
|
||||||
|
#define QDECL __cdecl
|
||||||
|
|
||||||
|
#undef QCALL
|
||||||
|
#define QCALL __stdcall
|
||||||
|
|
||||||
|
#if defined( _MSC_VER )
|
||||||
|
#define OS_STRING "win_msvc"
|
||||||
|
#elif defined __MINGW32__
|
||||||
|
#define OS_STRING "win_mingw"
|
||||||
|
#endif
|
||||||
|
|
||||||
#define ID_INLINE __inline
|
#define ID_INLINE __inline
|
||||||
#define PATH_SEP '\\'
|
#define PATH_SEP '\\'
|
||||||
|
|
@ -96,14 +136,10 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
//============================================================== MAC OS X ===
|
//============================================================== MAC OS X ===
|
||||||
|
|
||||||
#if defined(MACOS_X) || defined(__APPLE_CC__)
|
#if defined(__APPLE__) || defined(__APPLE_CC__)
|
||||||
|
|
||||||
// make sure this is defined, just for sanity's sake...
|
|
||||||
#ifndef MACOS_X
|
|
||||||
#define MACOS_X
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define OS_STRING "macosx"
|
#define OS_STRING "macosx"
|
||||||
#define ID_INLINE inline
|
#define ID_INLINE inline
|
||||||
|
|
@ -113,7 +149,12 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
#define ARCH_STRING "ppc"
|
#define ARCH_STRING "ppc"
|
||||||
#define Q3_BIG_ENDIAN
|
#define Q3_BIG_ENDIAN
|
||||||
#elif defined __i386__
|
#elif defined __i386__
|
||||||
#define ARCH_STRING "i386"
|
#define ARCH_STRING "x86"
|
||||||
|
#define Q3_LITTLE_ENDIAN
|
||||||
|
#elif defined __x86_64__
|
||||||
|
#undef idx64
|
||||||
|
#define idx64 1
|
||||||
|
#define ARCH_STRING "x86_64"
|
||||||
#define Q3_LITTLE_ENDIAN
|
#define Q3_LITTLE_ENDIAN
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -123,42 +164,29 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
//================================================================= LINUX ===
|
//================================================================= LINUX ===
|
||||||
|
|
||||||
#ifdef __linux__
|
#if defined(__linux__) || defined(__FreeBSD_kernel__) || defined(__GNU__)
|
||||||
|
|
||||||
#include <endian.h>
|
#include <endian.h>
|
||||||
|
|
||||||
|
#if defined(__linux__)
|
||||||
#define OS_STRING "linux"
|
#define OS_STRING "linux"
|
||||||
|
#elif defined(__FreeBSD_kernel__)
|
||||||
|
#define OS_STRING "kFreeBSD"
|
||||||
|
#else
|
||||||
|
#define OS_STRING "GNU"
|
||||||
|
#endif
|
||||||
|
|
||||||
#define ID_INLINE inline
|
#define ID_INLINE inline
|
||||||
|
|
||||||
#define PATH_SEP '/'
|
#define PATH_SEP '/'
|
||||||
|
|
||||||
#if defined __i386__
|
#if !defined(ARCH_STRING)
|
||||||
#define ARCH_STRING "i386"
|
# error ARCH_STRING should be defined by the Makefile
|
||||||
#elif defined __x86_64__
|
#endif
|
||||||
#define ARCH_STRING "x86_64"
|
|
||||||
#elif defined __powerpc64__
|
#if defined __x86_64__
|
||||||
#define ARCH_STRING "ppc64"
|
#undef idx64
|
||||||
#elif defined __powerpc__
|
#define idx64 1
|
||||||
#define ARCH_STRING "ppc"
|
|
||||||
#elif defined __s390__
|
|
||||||
#define ARCH_STRING "s390"
|
|
||||||
#elif defined __s390x__
|
|
||||||
#define ARCH_STRING "s390x"
|
|
||||||
#elif defined __ia64__
|
|
||||||
#define ARCH_STRING "ia64"
|
|
||||||
#elif defined __alpha__
|
|
||||||
#define ARCH_STRING "alpha"
|
|
||||||
#elif defined __sparc__
|
|
||||||
#define ARCH_STRING "sparc"
|
|
||||||
#elif defined __arm__
|
|
||||||
#define ARCH_STRING "arm"
|
|
||||||
#elif defined __cris__
|
|
||||||
#define ARCH_STRING "cris"
|
|
||||||
#elif defined __hppa__
|
|
||||||
#define ARCH_STRING "hppa"
|
|
||||||
#elif defined __mips__
|
|
||||||
#define ARCH_STRING "mips"
|
|
||||||
#elif defined __sh__
|
|
||||||
#define ARCH_STRING "sh"
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if __FLOAT_WORD_ORDER == __BIG_ENDIAN
|
#if __FLOAT_WORD_ORDER == __BIG_ENDIAN
|
||||||
|
|
@ -179,7 +207,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
#include <machine/endian.h>
|
#include <machine/endian.h>
|
||||||
|
|
||||||
#ifndef __BSD__
|
#ifndef __BSD__
|
||||||
#define __BSD__
|
#define __BSD__
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__FreeBSD__)
|
#if defined(__FreeBSD__)
|
||||||
|
|
@ -194,7 +222,11 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
#define PATH_SEP '/'
|
#define PATH_SEP '/'
|
||||||
|
|
||||||
#ifdef __i386__
|
#ifdef __i386__
|
||||||
#define ARCH_STRING "i386"
|
#define ARCH_STRING "x86"
|
||||||
|
#elif defined __amd64__
|
||||||
|
#undef idx64
|
||||||
|
#define idx64 1
|
||||||
|
#define ARCH_STRING "x86_64"
|
||||||
#elif defined __axp__
|
#elif defined __axp__
|
||||||
#define ARCH_STRING "alpha"
|
#define ARCH_STRING "alpha"
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -221,7 +253,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
#define PATH_SEP '/'
|
#define PATH_SEP '/'
|
||||||
|
|
||||||
#ifdef __i386__
|
#ifdef __i386__
|
||||||
#define ARCH_STRING "i386"
|
#define ARCH_STRING "x86"
|
||||||
#elif defined __sparc
|
#elif defined __sparc
|
||||||
#define ARCH_STRING "sparc"
|
#define ARCH_STRING "sparc"
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -246,7 +278,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
#define ARCH_STRING "mips"
|
#define ARCH_STRING "mips"
|
||||||
|
|
||||||
#define Q3_BIG_ENDIAN // SGI's MIPS are always big endian
|
#define Q3_BIG_ENDIAN // SGI's MIPS are always big endian
|
||||||
|
|
||||||
#define DLL_EXT ".so"
|
#define DLL_EXT ".so"
|
||||||
|
|
||||||
|
|
@ -291,14 +323,18 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
|
||||||
//endianness
|
//endianness
|
||||||
short ShortSwap(short l);
|
void CopyShortSwap (void *dest, void *src);
|
||||||
int LongSwap(int l);
|
void CopyLongSwap (void *dest, void *src);
|
||||||
float FloatSwap(const float *f);
|
short ShortSwap (short l);
|
||||||
|
int LongSwap (int l);
|
||||||
|
float FloatSwap (const float *f);
|
||||||
|
|
||||||
#if defined( Q3_BIG_ENDIAN ) && defined( Q3_LITTLE_ENDIAN )
|
#if defined( Q3_BIG_ENDIAN ) && defined( Q3_LITTLE_ENDIAN )
|
||||||
#error "Endianness defined as both big and little"
|
#error "Endianness defined as both big and little"
|
||||||
#elif defined( Q3_BIG_ENDIAN )
|
#elif defined( Q3_BIG_ENDIAN )
|
||||||
|
|
||||||
|
#define CopyLittleShort(dest, src) CopyShortSwap(dest, src)
|
||||||
|
#define CopyLittleLong(dest, src) CopyLongSwap(dest, src)
|
||||||
#define LittleShort(x) ShortSwap(x)
|
#define LittleShort(x) ShortSwap(x)
|
||||||
#define LittleLong(x) LongSwap(x)
|
#define LittleLong(x) LongSwap(x)
|
||||||
#define LittleFloat(x) FloatSwap(&x)
|
#define LittleFloat(x) FloatSwap(&x)
|
||||||
|
|
@ -308,6 +344,8 @@ float FloatSwap(const float *f);
|
||||||
|
|
||||||
#elif defined( Q3_LITTLE_ENDIAN )
|
#elif defined( Q3_LITTLE_ENDIAN )
|
||||||
|
|
||||||
|
#define CopyLittleShort(dest, src) Com_Memcpy(dest, src, 2)
|
||||||
|
#define CopyLittleLong(dest, src) Com_Memcpy(dest, src, 4)
|
||||||
#define LittleShort
|
#define LittleShort
|
||||||
#define LittleLong
|
#define LittleLong
|
||||||
#define LittleFloat
|
#define LittleFloat
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user