Simplifying macros to fix VS' broken preprocessor.

This commit is contained in:
Ben Vanik
2014-01-12 14:06:00 -08:00
parent 123444078f
commit 6129e1eb7a
26 changed files with 76 additions and 83 deletions

View File

@@ -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).
const uint32_t* current = (const uint32_t*)data;
while (length >= 8) {
#if XE_CPU(BIGENDIAN)
#if XE_CPU_BIGENDIAN
uint32_t one = *current++ ^ XESWAP32(crc);
uint32_t two = *current++;
crc = xe_crc32_lookup_[0][ two & 0xFF] ^

View File

@@ -17,7 +17,7 @@ typedef struct xe_file {
} xe_file_t;
#if XE_LIKE(WIN32)
#if XE_LIKE_WIN32
#define fseeko _fseeki64
#define ftello _ftelli64
#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")));
#if XE_LIKE(WIN32) && XE_WCHAR
#if XE_LIKE_WIN32 && XE_WCHAR
XEEXPECTZERO(_wfopen_s((FILE**)&file->handle, path, mode_string));
#else
file->handle = fopen(path, mode_string);

View File

@@ -85,13 +85,13 @@ XEFORCEINLINE uint32_t UNALIGNED_LOAD32(const char *p) {
}
#endif
#if XE_CPU(BIGENDIAN)
#if XE_CPU_BIGENDIAN
#define uint32_t_in_expected_order(x) (XESWAP32(x))
#define uint64_in_expected_order(x) (XESWAP64(x))
#else
#define uint32_t_in_expected_order(x) (x)
#define uint64_in_expected_order(x) (x)
#endif // XE_CPU(BIGENDIAN)
#endif // XE_CPU_BIGENDIAN
#if !defined(LIKELY)
#if HAVE_BUILTIN_EXPECT

View File

@@ -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,
size_t abs_path_size) {
#if XE_PLATFORM(WIN32)
#if XE_PLATFORM_WIN32
#if XE_WCHAR
_wfullpath(out_abs_path, path, abs_path_size);
#else

View File

@@ -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);
}
#if XE_PLATFORM(WIN32)
#if XE_PLATFORM_WIN32
// http://msdn.microsoft.com/en-us/library/xcb2z8hs.aspx
#pragma pack(push,8)
@@ -113,7 +113,7 @@ void xe_thread_join(xe_thread_ref thread) {
static void* xe_thread_callback_pthreads(void* 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));
#else
pthread_setname_np(pthread_self(), thread->name);