Simplifying macros to fix VS' broken preprocessor.
This commit is contained in:
parent
123444078f
commit
6129e1eb7a
|
@ -2587,7 +2587,7 @@ uint32_t IntCode_MUL_HI_I32_I32(IntCodeState& ics, const IntCode* i) {
|
||||||
return IA_NEXT;
|
return IA_NEXT;
|
||||||
}
|
}
|
||||||
uint32_t IntCode_MUL_HI_I64_I64(IntCodeState& ics, const IntCode* i) {
|
uint32_t IntCode_MUL_HI_I64_I64(IntCodeState& ics, const IntCode* i) {
|
||||||
#if !XE_COMPILER(MSVC)
|
#if !XE_COMPILER_MSVC
|
||||||
// GCC can, in theory, do this:
|
// GCC can, in theory, do this:
|
||||||
__int128 v =
|
__int128 v =
|
||||||
(__int128)ics.rf[i->src1_reg].i64 * (__int128)ics.rf[i->src2_reg].i64;
|
(__int128)ics.rf[i->src1_reg].i64 * (__int128)ics.rf[i->src2_reg].i64;
|
||||||
|
@ -2622,7 +2622,7 @@ uint32_t IntCode_MUL_HI_I32_I32_U(IntCodeState& ics, const IntCode* i) {
|
||||||
return IA_NEXT;
|
return IA_NEXT;
|
||||||
}
|
}
|
||||||
uint32_t IntCode_MUL_HI_I64_I64_U(IntCodeState& ics, const IntCode* i) {
|
uint32_t IntCode_MUL_HI_I64_I64_U(IntCodeState& ics, const IntCode* i) {
|
||||||
#if !XE_COMPILER(MSVC)
|
#if !XE_COMPILER_MSVC
|
||||||
// GCC can, in theory, do this:
|
// GCC can, in theory, do this:
|
||||||
__int128 v =
|
__int128 v =
|
||||||
(__int128)ics.rf[i->src1_reg].i64 * (__int128)ics.rf[i->src2_reg].i64;
|
(__int128)ics.rf[i->src1_reg].i64 * (__int128)ics.rf[i->src2_reg].i64;
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
#include <xenia/types.h>
|
#include <xenia/types.h>
|
||||||
|
|
||||||
|
|
||||||
#if 0 && XE_COMPILER(MSVC) && defined(UNICODE) && UNICODE
|
#if 0 && XE_COMPILER_MSVC && defined(UNICODE) && UNICODE
|
||||||
// http://msdn.microsoft.com/en-us/library/b0084kay.aspx
|
// http://msdn.microsoft.com/en-us/library/b0084kay.aspx
|
||||||
#if !defined(__WFILE__)
|
#if !defined(__WFILE__)
|
||||||
#define WIDEN2(x) L##x
|
#define WIDEN2(x) L##x
|
||||||
|
@ -38,7 +38,7 @@
|
||||||
|
|
||||||
|
|
||||||
#define __XE_ASSERT(expr) assert(expr)
|
#define __XE_ASSERT(expr) assert(expr)
|
||||||
#if XE_OPTION(ENABLE_ASSERTS)
|
#if XE_OPTION_ENABLE_ASSERTS
|
||||||
#define XEASSERTCORE(expr) __XE_ASSERT(expr)
|
#define XEASSERTCORE(expr) __XE_ASSERT(expr)
|
||||||
#else
|
#else
|
||||||
#define XEASSERTCORE(expr) XE_EMPTY_MACRO
|
#define XEASSERTCORE(expr) XE_EMPTY_MACRO
|
||||||
|
@ -54,12 +54,12 @@
|
||||||
#define XEASSERTNOTNULL(expr) XEASSERTCORE( (expr) != NULL )
|
#define XEASSERTNOTNULL(expr) XEASSERTCORE( (expr) != NULL )
|
||||||
|
|
||||||
|
|
||||||
#if XE_COMPILER(MSVC)
|
#if XE_COMPILER_MSVC
|
||||||
// http://msdn.microsoft.com/en-us/library/bb918086.aspx
|
// http://msdn.microsoft.com/en-us/library/bb918086.aspx
|
||||||
// TODO(benvanik): if 2010+, use static_assert?
|
// TODO(benvanik): if 2010+, use static_assert?
|
||||||
// http://msdn.microsoft.com/en-us/library/dd293588.aspx
|
// http://msdn.microsoft.com/en-us/library/dd293588.aspx
|
||||||
#define XESTATICASSERT(expr, message) _STATIC_ASSERT(expr)
|
#define XESTATICASSERT(expr, message) _STATIC_ASSERT(expr)
|
||||||
//#elif XE_COMPILER(GNUC)
|
//#elif XE_COMPILER_GNUC
|
||||||
// http://stackoverflow.com/questions/3385515/static-assert-in-c
|
// http://stackoverflow.com/questions/3385515/static-assert-in-c
|
||||||
//#define XESTATICASSERT(expr, message) ({ extern int __attribute__((error("assertion failure: '" #expr "' not true - " #message))) compile_time_check(); ((expr)?0:compile_time_check()),0; })
|
//#define XESTATICASSERT(expr, message) ({ extern int __attribute__((error("assertion failure: '" #expr "' not true - " #message))) compile_time_check(); ((expr)?0:compile_time_check()),0; })
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
// These functions are modeled off of the Apple OSAtomic routines
|
// These functions are modeled off of the Apple OSAtomic routines
|
||||||
// http://developer.apple.com/library/mac/#documentation/DriversKernelHardware/Reference/libkern_ref/OSAtomic_h/
|
// http://developer.apple.com/library/mac/#documentation/DriversKernelHardware/Reference/libkern_ref/OSAtomic_h/
|
||||||
|
|
||||||
#if XE_LIKE(OSX)
|
#if XE_LIKE_OSX
|
||||||
#include <libkern/OSAtomic.h>
|
#include <libkern/OSAtomic.h>
|
||||||
|
|
||||||
#define xe_atomic_inc_32(value) \
|
#define xe_atomic_inc_32(value) \
|
||||||
|
@ -41,7 +41,7 @@ typedef OSQueueHead xe_atomic_stack_t;
|
||||||
#define xe_atomic_stack_dequeue(stack, offset) \
|
#define xe_atomic_stack_dequeue(stack, offset) \
|
||||||
OSAtomicDequeue((OSQueueHead*)stack, offset)
|
OSAtomicDequeue((OSQueueHead*)stack, offset)
|
||||||
|
|
||||||
#elif XE_LIKE(WIN32)
|
#elif XE_LIKE_WIN32
|
||||||
|
|
||||||
#define xe_atomic_inc_32(value) \
|
#define xe_atomic_inc_32(value) \
|
||||||
InterlockedIncrement((volatile LONG*)value)
|
InterlockedIncrement((volatile LONG*)value)
|
||||||
|
@ -73,7 +73,7 @@ XEFORCEINLINE void* xe_atomic_stack_dequeue(xe_atomic_stack_t* stack,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif XE_LIKE(POSIX)
|
#elif XE_LIKE_POSIX
|
||||||
|
|
||||||
#define xe_atomic_inc_32(value) \
|
#define xe_atomic_inc_32(value) \
|
||||||
__sync_add_and_fetch(value, 1)
|
__sync_add_and_fetch(value, 1)
|
||||||
|
|
|
@ -14,11 +14,11 @@
|
||||||
#include <xenia/types.h>
|
#include <xenia/types.h>
|
||||||
|
|
||||||
|
|
||||||
#if XE_COMPILER(MSVC)
|
#if XE_COMPILER_MSVC
|
||||||
#define XESWAP16 _byteswap_ushort
|
#define XESWAP16 _byteswap_ushort
|
||||||
#define XESWAP32 _byteswap_ulong
|
#define XESWAP32 _byteswap_ulong
|
||||||
#define XESWAP64 _byteswap_uint64
|
#define XESWAP64 _byteswap_uint64
|
||||||
#elif XE_LIKE(OSX)
|
#elif XE_LIKE_OSX
|
||||||
#include <libkern/OSByteOrder.h>
|
#include <libkern/OSByteOrder.h>
|
||||||
#define XESWAP16 OSSwapInt16
|
#define XESWAP16 OSSwapInt16
|
||||||
#define XESWAP32 OSSwapInt32
|
#define XESWAP32 OSSwapInt32
|
||||||
|
@ -30,7 +30,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if XE_CPU(BIGENDIAN)
|
#if XE_CPU_BIGENDIAN
|
||||||
#define XESWAP16BE(p) (p)
|
#define XESWAP16BE(p) (p)
|
||||||
#define XESWAP32BE(p) (p)
|
#define XESWAP32BE(p) (p)
|
||||||
#define XESWAP64BE(p) (p)
|
#define XESWAP64BE(p) (p)
|
||||||
|
@ -47,7 +47,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if XE_CPU(BIGENDIAN)
|
#if XE_CPU_BIGENDIAN
|
||||||
#define XESWAPF32BE(p) (p)
|
#define XESWAPF32BE(p) (p)
|
||||||
#define XESWAPF64BE(p) (p)
|
#define XESWAPF64BE(p) (p)
|
||||||
XEFORCEINLINE float XESWAPF32LE(float value) {
|
XEFORCEINLINE float XESWAPF32LE(float value) {
|
||||||
|
|
|
@ -11,8 +11,6 @@
|
||||||
#define XENIA_CONFIG_H_
|
#define XENIA_CONFIG_H_
|
||||||
|
|
||||||
|
|
||||||
#define XE_OPTION(NAME) (defined XE_OPTION_##NAME && XE_OPTION_##NAME)
|
|
||||||
|
|
||||||
// Enable compile-time and runtime-time assertions.
|
// Enable compile-time and runtime-time assertions.
|
||||||
#define XE_OPTION_ENABLE_ASSERTS 1
|
#define XE_OPTION_ENABLE_ASSERTS 1
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ namespace xe {
|
||||||
#include <xenia/core/thread.h>
|
#include <xenia/core/thread.h>
|
||||||
#include <xenia/core/window.h>
|
#include <xenia/core/window.h>
|
||||||
|
|
||||||
#if XE_PLATFORM(WIN32)
|
#if XE_PLATFORM_WIN32
|
||||||
#include <xenia/core/win32_window.h>
|
#include <xenia/core/win32_window.h>
|
||||||
#endif // WIN32
|
#endif // WIN32
|
||||||
|
|
||||||
|
|
|
@ -299,7 +299,7 @@ uint32_t xe_crc32(const void* data, size_t length, uint32_t previous_crc) {
|
||||||
// Process eight bytes at once (Slicing-by-8).
|
// Process eight bytes at once (Slicing-by-8).
|
||||||
const uint32_t* current = (const uint32_t*)data;
|
const uint32_t* current = (const uint32_t*)data;
|
||||||
while (length >= 8) {
|
while (length >= 8) {
|
||||||
#if XE_CPU(BIGENDIAN)
|
#if XE_CPU_BIGENDIAN
|
||||||
uint32_t one = *current++ ^ XESWAP32(crc);
|
uint32_t one = *current++ ^ XESWAP32(crc);
|
||||||
uint32_t two = *current++;
|
uint32_t two = *current++;
|
||||||
crc = xe_crc32_lookup_[0][ two & 0xFF] ^
|
crc = xe_crc32_lookup_[0][ two & 0xFF] ^
|
||||||
|
|
|
@ -17,7 +17,7 @@ typedef struct xe_file {
|
||||||
} xe_file_t;
|
} xe_file_t;
|
||||||
|
|
||||||
|
|
||||||
#if XE_LIKE(WIN32)
|
#if XE_LIKE_WIN32
|
||||||
#define fseeko _fseeki64
|
#define fseeko _fseeki64
|
||||||
#define ftello _ftelli64
|
#define ftello _ftelli64
|
||||||
#endif // WIN32
|
#endif // WIN32
|
||||||
|
@ -37,7 +37,7 @@ xe_file_ref xe_file_open(const xe_file_mode mode, const xechar_t *path) {
|
||||||
}
|
}
|
||||||
XEIGNORE(xestrcat(mode_string, XECOUNT(mode_string), XT("b")));
|
XEIGNORE(xestrcat(mode_string, XECOUNT(mode_string), XT("b")));
|
||||||
|
|
||||||
#if XE_LIKE(WIN32) && XE_WCHAR
|
#if XE_LIKE_WIN32 && XE_WCHAR
|
||||||
XEEXPECTZERO(_wfopen_s((FILE**)&file->handle, path, mode_string));
|
XEEXPECTZERO(_wfopen_s((FILE**)&file->handle, path, mode_string));
|
||||||
#else
|
#else
|
||||||
file->handle = fopen(path, mode_string);
|
file->handle = fopen(path, mode_string);
|
||||||
|
|
|
@ -85,13 +85,13 @@ XEFORCEINLINE uint32_t UNALIGNED_LOAD32(const char *p) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if XE_CPU(BIGENDIAN)
|
#if XE_CPU_BIGENDIAN
|
||||||
#define uint32_t_in_expected_order(x) (XESWAP32(x))
|
#define uint32_t_in_expected_order(x) (XESWAP32(x))
|
||||||
#define uint64_in_expected_order(x) (XESWAP64(x))
|
#define uint64_in_expected_order(x) (XESWAP64(x))
|
||||||
#else
|
#else
|
||||||
#define uint32_t_in_expected_order(x) (x)
|
#define uint32_t_in_expected_order(x) (x)
|
||||||
#define uint64_in_expected_order(x) (x)
|
#define uint64_in_expected_order(x) (x)
|
||||||
#endif // XE_CPU(BIGENDIAN)
|
#endif // XE_CPU_BIGENDIAN
|
||||||
|
|
||||||
#if !defined(LIKELY)
|
#if !defined(LIKELY)
|
||||||
#if HAVE_BUILTIN_EXPECT
|
#if HAVE_BUILTIN_EXPECT
|
||||||
|
|
|
@ -23,7 +23,7 @@ void xe_path_join(const xechar_t* left, const xechar_t* right,
|
||||||
|
|
||||||
void xe_path_get_absolute(const xechar_t* path, xechar_t* out_abs_path,
|
void xe_path_get_absolute(const xechar_t* path, xechar_t* out_abs_path,
|
||||||
size_t abs_path_size) {
|
size_t abs_path_size) {
|
||||||
#if XE_PLATFORM(WIN32)
|
#if XE_PLATFORM_WIN32
|
||||||
#if XE_WCHAR
|
#if XE_WCHAR
|
||||||
_wfullpath(out_abs_path, path, abs_path_size);
|
_wfullpath(out_abs_path, path, abs_path_size);
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -49,7 +49,7 @@ void xe_thread_release(xe_thread_ref thread) {
|
||||||
xe_ref_release((xe_ref)thread, (xe_ref_dealloc_t)xe_thread_dealloc);
|
xe_ref_release((xe_ref)thread, (xe_ref_dealloc_t)xe_thread_dealloc);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if XE_PLATFORM(WIN32)
|
#if XE_PLATFORM_WIN32
|
||||||
|
|
||||||
// http://msdn.microsoft.com/en-us/library/xcb2z8hs.aspx
|
// http://msdn.microsoft.com/en-us/library/xcb2z8hs.aspx
|
||||||
#pragma pack(push,8)
|
#pragma pack(push,8)
|
||||||
|
@ -113,7 +113,7 @@ void xe_thread_join(xe_thread_ref thread) {
|
||||||
|
|
||||||
static void* xe_thread_callback_pthreads(void* param) {
|
static void* xe_thread_callback_pthreads(void* param) {
|
||||||
xe_thread_t* thread = reinterpret_cast<xe_thread_t*>(param);
|
xe_thread_t* thread = reinterpret_cast<xe_thread_t*>(param);
|
||||||
#if XE_LIKE(OSX)
|
#if XE_LIKE_OSX
|
||||||
XEIGNORE(pthread_setname_np(thread->name));
|
XEIGNORE(pthread_setname_np(thread->name));
|
||||||
#else
|
#else
|
||||||
pthread_setname_np(pthread_self(), thread->name);
|
pthread_setname_np(pthread_self(), thread->name);
|
||||||
|
|
|
@ -20,7 +20,7 @@ using namespace xe::cpu;
|
||||||
// TODO(benvanik): move xbox.h out
|
// TODO(benvanik): move xbox.h out
|
||||||
#include <xenia/xbox.h>
|
#include <xenia/xbox.h>
|
||||||
|
|
||||||
#if !XE_PLATFORM(WIN32)
|
#if !XE_PLATFORM_WIN32
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#endif // WIN32
|
#endif // WIN32
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
#include <xenia/debug/protocols/ws/simple_sha1.h>
|
#include <xenia/debug/protocols/ws/simple_sha1.h>
|
||||||
|
|
||||||
#if XE_PLATFORM(WIN32)
|
#if XE_PLATFORM_WIN32
|
||||||
#include <winsock2.h>
|
#include <winsock2.h>
|
||||||
#else
|
#else
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#include <xenia/kernel/xboxkrnl_module.h>
|
#include <xenia/kernel/xboxkrnl_module.h>
|
||||||
#include <xenia/kernel/objects/xuser_module.h>
|
#include <xenia/kernel/objects/xuser_module.h>
|
||||||
|
|
||||||
#if XE_PLATFORM(WIN32)
|
#if XE_PLATFORM_WIN32
|
||||||
// Required for wslay.
|
// Required for wslay.
|
||||||
typedef SSIZE_T ssize_t;
|
typedef SSIZE_T ssize_t;
|
||||||
#endif // WIN32
|
#endif // WIN32
|
||||||
|
|
|
@ -32,7 +32,7 @@ GraphicsSystem* xe::gpu::CreateNop(Emulator* emulator) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if XE_PLATFORM(WIN32)
|
#if XE_PLATFORM_WIN32
|
||||||
#include <xenia/gpu/d3d11/d3d11_gpu.h>
|
#include <xenia/gpu/d3d11/d3d11_gpu.h>
|
||||||
GraphicsSystem* xe::gpu::CreateD3D11(Emulator* emulator) {
|
GraphicsSystem* xe::gpu::CreateD3D11(Emulator* emulator) {
|
||||||
return xe::gpu::d3d11::Create(emulator);
|
return xe::gpu::d3d11::Create(emulator);
|
||||||
|
@ -43,7 +43,7 @@ GraphicsSystem* xe::gpu::CreateD3D11(Emulator* emulator) {
|
||||||
GraphicsSystem* xe::gpu::Create(Emulator* emulator) {
|
GraphicsSystem* xe::gpu::Create(Emulator* emulator) {
|
||||||
if (FLAGS_gpu.compare("nop") == 0) {
|
if (FLAGS_gpu.compare("nop") == 0) {
|
||||||
return CreateNop(emulator);
|
return CreateNop(emulator);
|
||||||
#if XE_PLATFORM(WIN32)
|
#if XE_PLATFORM_WIN32
|
||||||
} else if (FLAGS_gpu.compare("d3d11") == 0) {
|
} else if (FLAGS_gpu.compare("d3d11") == 0) {
|
||||||
return CreateD3D11(emulator);
|
return CreateD3D11(emulator);
|
||||||
#endif // WIN32
|
#endif // WIN32
|
||||||
|
@ -51,7 +51,7 @@ GraphicsSystem* xe::gpu::Create(Emulator* emulator) {
|
||||||
// Create best available.
|
// Create best available.
|
||||||
GraphicsSystem* best = NULL;
|
GraphicsSystem* best = NULL;
|
||||||
|
|
||||||
#if XE_PLATFORM(WIN32)
|
#if XE_PLATFORM_WIN32
|
||||||
best = CreateD3D11(emulator);
|
best = CreateD3D11(emulator);
|
||||||
if (best) {
|
if (best) {
|
||||||
return best;
|
return best;
|
||||||
|
|
|
@ -24,7 +24,7 @@ GraphicsSystem* Create(Emulator* emulator);
|
||||||
|
|
||||||
GraphicsSystem* CreateNop(Emulator* emulator);
|
GraphicsSystem* CreateNop(Emulator* emulator);
|
||||||
|
|
||||||
#if XE_PLATFORM(WIN32)
|
#if XE_PLATFORM_WIN32
|
||||||
GraphicsSystem* CreateD3D11(Emulator* emulator);
|
GraphicsSystem* CreateD3D11(Emulator* emulator);
|
||||||
#endif // WIN32
|
#endif // WIN32
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ DEFINE_string(hid, "any",
|
||||||
|
|
||||||
|
|
||||||
#include <xenia/hid/nop/nop_hid.h>
|
#include <xenia/hid/nop/nop_hid.h>
|
||||||
#if XE_PLATFORM(WIN32)
|
#if XE_PLATFORM_WIN32
|
||||||
#include <xenia/hid/xinput/xinput_hid.h>
|
#include <xenia/hid/xinput/xinput_hid.h>
|
||||||
#endif // WIN32
|
#endif // WIN32
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ InputSystem* xe::hid::Create(Emulator* emulator) {
|
||||||
|
|
||||||
if (FLAGS_hid.compare("nop") == 0) {
|
if (FLAGS_hid.compare("nop") == 0) {
|
||||||
input_system->AddDriver(xe::hid::nop::Create(input_system));
|
input_system->AddDriver(xe::hid::nop::Create(input_system));
|
||||||
#if XE_PLATFORM(WIN32)
|
#if XE_PLATFORM_WIN32
|
||||||
} else if (FLAGS_hid.compare("xinput") == 0) {
|
} else if (FLAGS_hid.compare("xinput") == 0) {
|
||||||
input_system->AddDriver(xe::hid::xinput::Create(input_system));
|
input_system->AddDriver(xe::hid::xinput::Create(input_system));
|
||||||
#endif // WIN32
|
#endif // WIN32
|
||||||
|
@ -42,7 +42,7 @@ InputSystem* xe::hid::Create(Emulator* emulator) {
|
||||||
|
|
||||||
// NOTE: in any mode we create as many as we can, falling back to nop.
|
// NOTE: in any mode we create as many as we can, falling back to nop.
|
||||||
|
|
||||||
#if XE_PLATFORM(WIN32)
|
#if XE_PLATFORM_WIN32
|
||||||
InputDriver* xinput_driver = xe::hid::xinput::Create(input_system);
|
InputDriver* xinput_driver = xe::hid::xinput::Create(input_system);
|
||||||
if (xinput_driver) {
|
if (xinput_driver) {
|
||||||
input_system->AddDriver(xinput_driver);
|
input_system->AddDriver(xinput_driver);
|
||||||
|
|
|
@ -147,7 +147,7 @@ void XThread::set_name(const char* name) {
|
||||||
}
|
}
|
||||||
name_ = xestrdupa(name);
|
name_ = xestrdupa(name);
|
||||||
|
|
||||||
#if XE_PLATFORM(WIN32)
|
#if XE_PLATFORM_WIN32
|
||||||
// Do the nasty set for us.
|
// Do the nasty set for us.
|
||||||
#pragma pack(push, 8)
|
#pragma pack(push, 8)
|
||||||
typedef struct tagTHREADNAME_INFO {
|
typedef struct tagTHREADNAME_INFO {
|
||||||
|
@ -249,7 +249,7 @@ X_STATUS XThread::Exit(int exit_code) {
|
||||||
return X_STATUS_SUCCESS;
|
return X_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if XE_PLATFORM(WIN32)
|
#if XE_PLATFORM_WIN32
|
||||||
|
|
||||||
static uint32_t __stdcall XThreadStartCallbackWin32(void* param) {
|
static uint32_t __stdcall XThreadStartCallbackWin32(void* param) {
|
||||||
XThread* thread = reinterpret_cast<XThread*>(param);
|
XThread* thread = reinterpret_cast<XThread*>(param);
|
||||||
|
@ -308,7 +308,7 @@ X_STATUS XThread::PlatformCreate() {
|
||||||
|
|
||||||
int result_code;
|
int result_code;
|
||||||
if (creation_params_.creation_flags & X_CREATE_SUSPENDED) {
|
if (creation_params_.creation_flags & X_CREATE_SUSPENDED) {
|
||||||
#if XE_PLATFORM(OSX)
|
#if XE_PLATFORM_OSX
|
||||||
result_code = pthread_create_suspended_np(
|
result_code = pthread_create_suspended_np(
|
||||||
reinterpret_cast<pthread_t*>(&thread_handle_),
|
reinterpret_cast<pthread_t*>(&thread_handle_),
|
||||||
&attr,
|
&attr,
|
||||||
|
|
|
@ -465,7 +465,7 @@ uint32_t xeKeTlsAlloc() {
|
||||||
|
|
||||||
uint32_t tls_index;
|
uint32_t tls_index;
|
||||||
|
|
||||||
#if XE_PLATFORM(WIN32)
|
#if XE_PLATFORM_WIN32
|
||||||
tls_index = TlsAlloc();
|
tls_index = TlsAlloc();
|
||||||
#else
|
#else
|
||||||
pthread_key_t key;
|
pthread_key_t key;
|
||||||
|
@ -501,7 +501,7 @@ int KeTlsFree(uint32_t tls_index) {
|
||||||
|
|
||||||
int result_code = 0;
|
int result_code = 0;
|
||||||
|
|
||||||
#if XE_PLATFORM(WIN32)
|
#if XE_PLATFORM_WIN32
|
||||||
result_code = TlsFree(tls_index);
|
result_code = TlsFree(tls_index);
|
||||||
#else
|
#else
|
||||||
result_code = pthread_key_delete(tls_index) == 0;
|
result_code = pthread_key_delete(tls_index) == 0;
|
||||||
|
@ -531,7 +531,7 @@ uint64_t xeKeTlsGetValue(uint32_t tls_index) {
|
||||||
|
|
||||||
uint64_t value = 0;
|
uint64_t value = 0;
|
||||||
|
|
||||||
#if XE_PLATFORM(WIN32)
|
#if XE_PLATFORM_WIN32
|
||||||
value = (uint64_t)TlsGetValue(tls_index);
|
value = (uint64_t)TlsGetValue(tls_index);
|
||||||
#else
|
#else
|
||||||
value = (uint64_t)pthread_getspecific(tls_index);
|
value = (uint64_t)pthread_getspecific(tls_index);
|
||||||
|
@ -567,7 +567,7 @@ int xeKeTlsSetValue(uint32_t tls_index, uint64_t tls_value) {
|
||||||
|
|
||||||
int result_code = 0;
|
int result_code = 0;
|
||||||
|
|
||||||
#if XE_PLATFORM(WIN32)
|
#if XE_PLATFORM_WIN32
|
||||||
result_code = TlsSetValue(tls_index, (LPVOID)tls_value);
|
result_code = TlsSetValue(tls_index, (LPVOID)tls_value);
|
||||||
#else
|
#else
|
||||||
result_code = pthread_setspecific(tls_index, (void*)tls_value) == 0;
|
result_code = pthread_setspecific(tls_index, (void*)tls_value) == 0;
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
#include <xenia/string.h>
|
#include <xenia/string.h>
|
||||||
|
|
||||||
|
|
||||||
#if XE_COMPILER(GNUC)
|
#if XE_COMPILER_GNUC
|
||||||
#define XE_LOG_LINE_ATTRIBUTE __attribute__ ((format (printf, 5, 6)))
|
#define XE_LOG_LINE_ATTRIBUTE __attribute__ ((format (printf, 5, 6)))
|
||||||
#else
|
#else
|
||||||
#define XE_LOG_LINE_ATTRIBUTE
|
#define XE_LOG_LINE_ATTRIBUTE
|
||||||
|
@ -26,7 +26,7 @@ void xe_log_line(const char* file_path, const uint32_t line_number,
|
||||||
const char* fmt, ...) XE_LOG_LINE_ATTRIBUTE;
|
const char* fmt, ...) XE_LOG_LINE_ATTRIBUTE;
|
||||||
#undef XE_LOG_LINE_ATTRIBUTE
|
#undef XE_LOG_LINE_ATTRIBUTE
|
||||||
|
|
||||||
#if XE_OPTION(ENABLE_LOGGING)
|
#if XE_OPTION_ENABLE_LOGGING
|
||||||
#define XELOGCORE(level, fmt, ...) xe_log_line( \
|
#define XELOGCORE(level, fmt, ...) xe_log_line( \
|
||||||
XE_CURRENT_FILE, XE_CURRENT_LINE, XE_CURRENT_FUNCTION, level, \
|
XE_CURRENT_FILE, XE_CURRENT_LINE, XE_CURRENT_FUNCTION, level, \
|
||||||
fmt, ##__VA_ARGS__)
|
fmt, ##__VA_ARGS__)
|
||||||
|
@ -34,52 +34,52 @@ void xe_log_line(const char* file_path, const uint32_t line_number,
|
||||||
#define XELOGCORE(level, fmt, ...) XE_EMPTY_MACRO
|
#define XELOGCORE(level, fmt, ...) XE_EMPTY_MACRO
|
||||||
#endif // ENABLE_LOGGING
|
#endif // ENABLE_LOGGING
|
||||||
|
|
||||||
#if XE_OPTION(LOG_ERROR)
|
#if XE_OPTION_LOG_ERROR
|
||||||
#define XELOGE(fmt, ...) XELOGCORE('!', fmt, ##__VA_ARGS__)
|
#define XELOGE(fmt, ...) XELOGCORE('!', fmt, ##__VA_ARGS__)
|
||||||
#else
|
#else
|
||||||
#define XELOGE(fmt, ...) XE_EMPTY_MACRO
|
#define XELOGE(fmt, ...) XE_EMPTY_MACRO
|
||||||
#endif
|
#endif
|
||||||
#if XE_OPTION(LOG_WARNING)
|
#if XE_OPTION_LOG_WARNING
|
||||||
#define XELOGW(fmt, ...) XELOGCORE('w', fmt, ##__VA_ARGS__)
|
#define XELOGW(fmt, ...) XELOGCORE('w', fmt, ##__VA_ARGS__)
|
||||||
#else
|
#else
|
||||||
#define XELOGW(fmt, ...) XE_EMPTY_MACRO
|
#define XELOGW(fmt, ...) XE_EMPTY_MACRO
|
||||||
#endif
|
#endif
|
||||||
#if XE_OPTION(LOG_INFO)
|
#if XE_OPTION_LOG_INFO
|
||||||
#define XELOGI(fmt, ...) XELOGCORE('i', fmt, ##__VA_ARGS__)
|
#define XELOGI(fmt, ...) XELOGCORE('i', fmt, ##__VA_ARGS__)
|
||||||
#else
|
#else
|
||||||
#define XELOGI(fmt, ...) XE_EMPTY_MACRO
|
#define XELOGI(fmt, ...) XE_EMPTY_MACRO
|
||||||
#endif
|
#endif
|
||||||
#if XE_OPTION(LOG_DEBUG)
|
#if XE_OPTION_LOG_DEBUG
|
||||||
#define XELOGD(fmt, ...) XELOGCORE('d', fmt, ##__VA_ARGS__)
|
#define XELOGD(fmt, ...) XELOGCORE('d', fmt, ##__VA_ARGS__)
|
||||||
#else
|
#else
|
||||||
#define XELOGD(fmt, ...) XE_EMPTY_MACRO
|
#define XELOGD(fmt, ...) XE_EMPTY_MACRO
|
||||||
#endif
|
#endif
|
||||||
#if XE_OPTION(LOG_CPU)
|
#if XE_OPTION_LOG_CPU
|
||||||
#define XELOGCPU(fmt, ...) XELOGCORE('C', fmt, ##__VA_ARGS__)
|
#define XELOGCPU(fmt, ...) XELOGCORE('C', fmt, ##__VA_ARGS__)
|
||||||
#else
|
#else
|
||||||
#define XELOGCPU(fmt, ...) XE_EMPTY_MACRO
|
#define XELOGCPU(fmt, ...) XE_EMPTY_MACRO
|
||||||
#endif
|
#endif
|
||||||
#if XE_OPTION(LOG_SDB)
|
#if XE_OPTION_LOG_SDB
|
||||||
#define XELOGSDB(fmt, ...) XELOGCORE('S', fmt, ##__VA_ARGS__)
|
#define XELOGSDB(fmt, ...) XELOGCORE('S', fmt, ##__VA_ARGS__)
|
||||||
#else
|
#else
|
||||||
#define XELOGSDB(fmt, ...) XE_EMPTY_MACRO
|
#define XELOGSDB(fmt, ...) XE_EMPTY_MACRO
|
||||||
#endif
|
#endif
|
||||||
#if XE_OPTION(LOG_APU)
|
#if XE_OPTION_LOG_APU
|
||||||
#define XELOGAPU(fmt, ...) XELOGCORE('A', fmt, ##__VA_ARGS__)
|
#define XELOGAPU(fmt, ...) XELOGCORE('A', fmt, ##__VA_ARGS__)
|
||||||
#else
|
#else
|
||||||
#define XELOGAPU(fmt, ...) XE_EMPTY_MACRO
|
#define XELOGAPU(fmt, ...) XE_EMPTY_MACRO
|
||||||
#endif
|
#endif
|
||||||
#if XE_OPTION(LOG_GPU)
|
#if XE_OPTION_LOG_GPU
|
||||||
#define XELOGGPU(fmt, ...) XELOGCORE('G', fmt, ##__VA_ARGS__)
|
#define XELOGGPU(fmt, ...) XELOGCORE('G', fmt, ##__VA_ARGS__)
|
||||||
#else
|
#else
|
||||||
#define XELOGGPU(fmt, ...) XE_EMPTY_MACRO
|
#define XELOGGPU(fmt, ...) XE_EMPTY_MACRO
|
||||||
#endif
|
#endif
|
||||||
#if XE_OPTION(LOG_KERNEL)
|
#if XE_OPTION_LOG_KERNEL
|
||||||
#define XELOGKERNEL(fmt, ...) XELOGCORE('K', fmt, ##__VA_ARGS__)
|
#define XELOGKERNEL(fmt, ...) XELOGCORE('K', fmt, ##__VA_ARGS__)
|
||||||
#else
|
#else
|
||||||
#define XELOGKERNEL(fmt, ...) XE_EMPTY_MACRO
|
#define XELOGKERNEL(fmt, ...) XE_EMPTY_MACRO
|
||||||
#endif
|
#endif
|
||||||
#if XE_OPTION(LOG_FS)
|
#if XE_OPTION_LOG_FS
|
||||||
#define XELOGFS(fmt, ...) XELOGCORE('F', fmt, ##__VA_ARGS__)
|
#define XELOGFS(fmt, ...) XELOGCORE('F', fmt, ##__VA_ARGS__)
|
||||||
#else
|
#else
|
||||||
#define XELOGFS(fmt, ...) XE_EMPTY_MACRO
|
#define XELOGFS(fmt, ...) XE_EMPTY_MACRO
|
||||||
|
|
|
@ -21,7 +21,7 @@ typedef int (*user_main_t)(int argc, xechar_t** argv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if XE_LIKE(WIN32) && defined(UNICODE) && UNICODE
|
#if XE_LIKE_WIN32 && defined(UNICODE) && UNICODE
|
||||||
|
|
||||||
int xe_main_thunk(
|
int xe_main_thunk(
|
||||||
int argc, wchar_t* argv[],
|
int argc, wchar_t* argv[],
|
||||||
|
|
|
@ -23,11 +23,6 @@ XE_COMPILER: GNUC | MSVC | INTEL | UNKNOWN
|
||||||
XE_CPU: 32BIT | 64BIT | BIGENDIAN | LITTLEENDIAN
|
XE_CPU: 32BIT | 64BIT | BIGENDIAN | LITTLEENDIAN
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define XE_PLATFORM(NAME) (defined XE_PLATFORM_##NAME && XE_PLATFORM_##NAME )
|
|
||||||
#define XE_LIKE(NAME) (defined XE_LIKE_##NAME && XE_LIKE_##NAME )
|
|
||||||
#define XE_PROFILE(NAME) (defined XE_PROFILE_##NAME && XE_PROFILE_##NAME )
|
|
||||||
#define XE_COMPILER(NAME) (defined XE_COMPILER_##NAME && XE_COMPILER_##NAME )
|
|
||||||
#define XE_CPU(NAME) (defined XE_CPU_##NAME && XE_CPU_##NAME )
|
|
||||||
|
|
||||||
#if defined(__APPLE__)
|
#if defined(__APPLE__)
|
||||||
#include <TargetConditionals.h>
|
#include <TargetConditionals.h>
|
||||||
|
@ -133,13 +128,13 @@ XE_CPU: 32BIT | 64BIT | BIGENDIAN | LITTLEENDIAN
|
||||||
#define XE_DEBUG 1
|
#define XE_DEBUG 1
|
||||||
#endif // DEBUG
|
#endif // DEBUG
|
||||||
|
|
||||||
#if XE_CPU(32BIT)
|
#if XE_CPU_32BIT
|
||||||
#define XE_ALIGNMENT 8
|
#define XE_ALIGNMENT 8
|
||||||
#else
|
#else
|
||||||
#define XE_ALIGNMENT 16
|
#define XE_ALIGNMENT 16
|
||||||
#endif // 32BIT
|
#endif // 32BIT
|
||||||
|
|
||||||
#if XE_LIKE(WIN32) && defined(UNICODE) && UNICODE
|
#if XE_LIKE_WIN32 && defined(UNICODE) && UNICODE
|
||||||
int xe_main_thunk(
|
int xe_main_thunk(
|
||||||
int argc, wchar_t* argv[],
|
int argc, wchar_t* argv[],
|
||||||
void* user_main, const char* usage);
|
void* user_main, const char* usage);
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
#include <xenia/platform.h>
|
#include <xenia/platform.h>
|
||||||
|
|
||||||
|
|
||||||
#if XE_PLATFORM(WINCE) || XE_PLATFORM(WIN32)
|
#if XE_PLATFORM_WINCE || XE_PLATFORM_WIN32
|
||||||
#ifndef WIN32_LEAN_AND_MEAN
|
#ifndef WIN32_LEAN_AND_MEAN
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#endif
|
#endif
|
||||||
|
@ -24,17 +24,17 @@
|
||||||
#undef max
|
#undef max
|
||||||
#endif // WINCE || WIN32
|
#endif // WINCE || WIN32
|
||||||
|
|
||||||
#if XE_PLATFORM(XBOX360)
|
#if XE_PLATFORM_XBOX360
|
||||||
#include <xtl.h>
|
#include <xtl.h>
|
||||||
#include <xboxmath.h>
|
#include <xboxmath.h>
|
||||||
#endif // XBOX360
|
#endif // XBOX360
|
||||||
|
|
||||||
#if XE_COMPILER(MSVC)
|
#if XE_COMPILER_MSVC
|
||||||
// Disable warning C4068: unknown pragma
|
// Disable warning C4068: unknown pragma
|
||||||
#pragma warning(disable : 4068)
|
#pragma warning(disable : 4068)
|
||||||
#endif // MSVC
|
#endif // MSVC
|
||||||
|
|
||||||
#if XE_LIKE(POSIX)
|
#if XE_LIKE_POSIX
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <endian.h>
|
#include <endian.h>
|
||||||
#endif // POSIX
|
#endif // POSIX
|
||||||
|
@ -56,7 +56,7 @@
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#if XE_COMPILER(MSVC)
|
#if XE_COMPILER_MSVC
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
#include <xenia/common.h>
|
#include <xenia/common.h>
|
||||||
|
|
||||||
|
|
||||||
#if XE_PLATFORM(WIN32)
|
#if XE_PLATFORM_WIN32
|
||||||
|
|
||||||
char* xestrcasestra(const char* str, const char* substr) {
|
char* xestrcasestra(const char* str, const char* substr) {
|
||||||
const size_t len = xestrlena(substr);
|
const size_t len = xestrlena(substr);
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
#define XEInvalidSize ((size_t)(-1))
|
#define XEInvalidSize ((size_t)(-1))
|
||||||
|
|
||||||
#if !XE_LIKE(WIN32)
|
#if !XE_LIKE_WIN32
|
||||||
int strncpy_s(char* dest, size_t destLength, const char* source, size_t count);
|
int strncpy_s(char* dest, size_t destLength, const char* source, size_t count);
|
||||||
#define strcpy_s(dest, destLength, source) !(strcpy(dest, source) == dest + (destLength*0))
|
#define strcpy_s(dest, destLength, source) !(strcpy(dest, source) == dest + (destLength*0))
|
||||||
#define strcat_s(dest, destLength, source) !(strcat(dest, source) == dest + (destLength*0))
|
#define strcat_s(dest, destLength, source) !(strcat(dest, source) == dest + (destLength*0))
|
||||||
|
@ -62,7 +62,7 @@ char* xestrcasestra(const char* str, const char* substr);
|
||||||
#define xesnprintfa(buffer, bufferCount, format, ...) _snprintf_s(buffer, bufferCount, bufferCount, format, ##__VA_ARGS__)
|
#define xesnprintfa(buffer, bufferCount, format, ...) _snprintf_s(buffer, bufferCount, bufferCount, format, ##__VA_ARGS__)
|
||||||
#define xevsnprintfa(buffer, bufferCount, format, args) vsnprintf(buffer, bufferCount, format, args)
|
#define xevsnprintfa(buffer, bufferCount, format, args) vsnprintf(buffer, bufferCount, format, args)
|
||||||
|
|
||||||
#if XE_PLATFORM(WIN32) && defined(UNICODE) && UNICODE
|
#if XE_PLATFORM_WIN32 && defined(UNICODE) && UNICODE
|
||||||
|
|
||||||
typedef wchar_t xechar_t;
|
typedef wchar_t xechar_t;
|
||||||
#define XE_WCHAR 1
|
#define XE_WCHAR 1
|
||||||
|
@ -115,7 +115,7 @@ typedef char xechar_t;
|
||||||
#define XT XETEXT
|
#define XT XETEXT
|
||||||
#define XTS XESTRFORMAT
|
#define XTS XESTRFORMAT
|
||||||
|
|
||||||
#if XE_LIKE(WIN32)
|
#if XE_LIKE_WIN32
|
||||||
#define XE_PATH_SEPARATOR ((xechar_t)'\\')
|
#define XE_PATH_SEPARATOR ((xechar_t)'\\')
|
||||||
#define XE_MAX_PATH _MAX_PATH
|
#define XE_MAX_PATH _MAX_PATH
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -39,13 +39,13 @@ using std::tr1::shared_ptr;
|
||||||
class name; \
|
class name; \
|
||||||
} } } }
|
} } } }
|
||||||
|
|
||||||
#if XE_COMPILER(MSVC)
|
#if XE_COMPILER_MSVC
|
||||||
#define XEASSUME(expr) __analysis_assume(expr)
|
#define XEASSUME(expr) __analysis_assume(expr)
|
||||||
#else
|
#else
|
||||||
#define XEASSUME(expr)
|
#define XEASSUME(expr)
|
||||||
#endif // MSVC
|
#endif // MSVC
|
||||||
|
|
||||||
#if XE_COMPILER(MSVC)
|
#if XE_COMPILER_MSVC
|
||||||
#define XECDECL __cdecl
|
#define XECDECL __cdecl
|
||||||
#else
|
#else
|
||||||
#define XECDECL
|
#define XECDECL
|
||||||
|
@ -61,11 +61,11 @@ using std::tr1::shared_ptr;
|
||||||
#define XEEXTERNC_END
|
#define XEEXTERNC_END
|
||||||
#endif // __cplusplus
|
#endif // __cplusplus
|
||||||
|
|
||||||
#if XE_COMPILER(MSVC)
|
#if XE_COMPILER_MSVC
|
||||||
// http://msdn.microsoft.com/en-us/library/z8y1yy88.aspx
|
// http://msdn.microsoft.com/en-us/library/z8y1yy88.aspx
|
||||||
#define XEFORCEINLINE static __forceinline
|
#define XEFORCEINLINE static __forceinline
|
||||||
#define XENOINLINE __declspec(noinline)
|
#define XENOINLINE __declspec(noinline)
|
||||||
#elif XE_COMPILER(GNUC)
|
#elif XE_COMPILER_GNUC
|
||||||
// http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html
|
// http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html
|
||||||
#if (__GNUC__ >= 4)
|
#if (__GNUC__ >= 4)
|
||||||
#define XEFORCEINLINE static __inline__ __attribute__((always_inline))
|
#define XEFORCEINLINE static __inline__ __attribute__((always_inline))
|
||||||
|
@ -78,7 +78,7 @@ using std::tr1::shared_ptr;
|
||||||
#define XENOINLINE
|
#define XENOINLINE
|
||||||
#endif // MSVC
|
#endif // MSVC
|
||||||
|
|
||||||
#if XE_COMPILER(MSVC)
|
#if XE_COMPILER_MSVC
|
||||||
#define XEPACKEDSTRUCT(name, value) \
|
#define XEPACKEDSTRUCT(name, value) \
|
||||||
__pragma(pack(push, 1)) struct name##_s value __pragma(pack(pop)); \
|
__pragma(pack(push, 1)) struct name##_s value __pragma(pack(pop)); \
|
||||||
typedef struct name##_s name;
|
typedef struct name##_s name;
|
||||||
|
@ -87,7 +87,7 @@ using std::tr1::shared_ptr;
|
||||||
#define XEPACKEDUNION(name, value) \
|
#define XEPACKEDUNION(name, value) \
|
||||||
__pragma(pack(push, 1)) union name##_s value __pragma(pack(pop)); \
|
__pragma(pack(push, 1)) union name##_s value __pragma(pack(pop)); \
|
||||||
typedef union name##_s name;
|
typedef union name##_s name;
|
||||||
#elif XE_COMPILER(GNUC)
|
#elif XE_COMPILER_GNUC
|
||||||
#define XEPACKEDSTRUCT(name, value) \
|
#define XEPACKEDSTRUCT(name, value) \
|
||||||
struct __attribute__((packed)) name
|
struct __attribute__((packed)) name
|
||||||
#define XEPACKEDSTRUCTANONYMOUS(value) \
|
#define XEPACKEDSTRUCTANONYMOUS(value) \
|
||||||
|
@ -96,11 +96,11 @@ using std::tr1::shared_ptr;
|
||||||
union __attribute__((packed)) name
|
union __attribute__((packed)) name
|
||||||
#endif // MSVC
|
#endif // MSVC
|
||||||
|
|
||||||
#if XE_COMPILER(MSVC)
|
#if XE_COMPILER_MSVC
|
||||||
// http://msdn.microsoft.com/en-us/library/83ythb65.aspx
|
// http://msdn.microsoft.com/en-us/library/83ythb65.aspx
|
||||||
#define XECACHEALIGN __declspec(align(XE_ALIGNMENT))
|
#define XECACHEALIGN __declspec(align(XE_ALIGNMENT))
|
||||||
#define XECACHEALIGN64 __declspec(align(64))
|
#define XECACHEALIGN64 __declspec(align(64))
|
||||||
#elif XE_COMPILER(GNUC)
|
#elif XE_COMPILER_GNUC
|
||||||
// http://gcc.gnu.org/onlinedocs/gcc/Type-Attributes.html
|
// http://gcc.gnu.org/onlinedocs/gcc/Type-Attributes.html
|
||||||
#define XECACHEALIGN __attribute__ ((aligned(XE_ALIGNMENT)))
|
#define XECACHEALIGN __attribute__ ((aligned(XE_ALIGNMENT)))
|
||||||
#define XECACHEALIGN64 __attribute__ ((aligned(64)))
|
#define XECACHEALIGN64 __attribute__ ((aligned(64)))
|
||||||
|
@ -110,20 +110,20 @@ using std::tr1::shared_ptr;
|
||||||
#endif // MSVC
|
#endif // MSVC
|
||||||
typedef XECACHEALIGN volatile void xe_aligned_void_t;
|
typedef XECACHEALIGN volatile void xe_aligned_void_t;
|
||||||
|
|
||||||
#if XE_COMPILER(MSVC)
|
#if XE_COMPILER_MSVC
|
||||||
// http://msdn.microsoft.com/en-us/library/ms175773.aspx
|
// http://msdn.microsoft.com/en-us/library/ms175773.aspx
|
||||||
#define XECOUNT(array) _countof(array)
|
#define XECOUNT(array) _countof(array)
|
||||||
#elif XE_COMPILER(GNUC)
|
#elif XE_COMPILER_GNUC
|
||||||
#define XECOUNT(array) (sizeof(array) / sizeof(__typeof__(array[0])))
|
#define XECOUNT(array) (sizeof(array) / sizeof(__typeof__(array[0])))
|
||||||
#else
|
#else
|
||||||
#define XECOUNT(array) (sizeof(array) / sizeof(array[0]))
|
#define XECOUNT(array) (sizeof(array) / sizeof(array[0]))
|
||||||
#endif // MSVC
|
#endif // MSVC
|
||||||
|
|
||||||
#if !defined(MIN)
|
#if !defined(MIN)
|
||||||
#if XE_COMPILER(GNUC)
|
#if XE_COMPILER_GNUC
|
||||||
#define MIN(A, B) ({ __typeof__(A) __a = (A); __typeof__(B) __b = (B); (__a < __b) ? __a : __b; })
|
#define MIN(A, B) ({ __typeof__(A) __a = (A); __typeof__(B) __b = (B); (__a < __b) ? __a : __b; })
|
||||||
#define MAX(A, B) ({ __typeof__(A) __a = (A); __typeof__(B) __b = (B); (__a < __b) ? __b : __a; })
|
#define MAX(A, B) ({ __typeof__(A) __a = (A); __typeof__(B) __b = (B); (__a < __b) ? __b : __a; })
|
||||||
//#elif XE_COMPILER(MSVC)
|
//#elif XE_COMPILER_MSVC
|
||||||
// TODO(benvanik): experiment with decltype:
|
// TODO(benvanik): experiment with decltype:
|
||||||
// http://msdn.microsoft.com/en-us/library/dd537655.aspx
|
// http://msdn.microsoft.com/en-us/library/dd537655.aspx
|
||||||
#else
|
#else
|
||||||
|
@ -134,7 +134,7 @@ typedef XECACHEALIGN volatile void xe_aligned_void_t;
|
||||||
#endif // GNUC
|
#endif // GNUC
|
||||||
#endif // !MIN
|
#endif // !MIN
|
||||||
|
|
||||||
#if XE_PLATFORM(WIN32)
|
#if XE_PLATFORM_WIN32
|
||||||
#define XESAFERELEASE(p) if (p) { p->Release(); }
|
#define XESAFERELEASE(p) if (p) { p->Release(); }
|
||||||
#endif // WIN32
|
#endif // WIN32
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue