windows: Patched to compile! (...?)
This commit is contained in:
parent
2176364a16
commit
1d6c519c5e
16
src/physfs.h
16
src/physfs.h
|
@ -322,16 +322,16 @@ typedef signed long long PHYSFS_sint64;
|
||||||
#define PHYSFS_COMPILE_TIME_ASSERT(name, x) \
|
#define PHYSFS_COMPILE_TIME_ASSERT(name, x) \
|
||||||
typedef int PHYSFS_compile_time_assert_##name[(x) * 2 - 1]
|
typedef int PHYSFS_compile_time_assert_##name[(x) * 2 - 1]
|
||||||
|
|
||||||
PHYSFS_COMPILE_TIME_ASSERT(uint8, sizeof(PHYSFS_uint8) == 1);
|
PHYSFS_COMPILE_TIME_ASSERT(uint8IsOneByte, sizeof(PHYSFS_uint8) == 1);
|
||||||
PHYSFS_COMPILE_TIME_ASSERT(sint8, sizeof(PHYSFS_sint8) == 1);
|
PHYSFS_COMPILE_TIME_ASSERT(sint8IsOneByte, sizeof(PHYSFS_sint8) == 1);
|
||||||
PHYSFS_COMPILE_TIME_ASSERT(uint16, sizeof(PHYSFS_uint16) == 2);
|
PHYSFS_COMPILE_TIME_ASSERT(uint16IsTwoBytes, sizeof(PHYSFS_uint16) == 2);
|
||||||
PHYSFS_COMPILE_TIME_ASSERT(sint16, sizeof(PHYSFS_sint16) == 2);
|
PHYSFS_COMPILE_TIME_ASSERT(sint16IsTwoBytes, sizeof(PHYSFS_sint16) == 2);
|
||||||
PHYSFS_COMPILE_TIME_ASSERT(uint32, sizeof(PHYSFS_uint32) == 4);
|
PHYSFS_COMPILE_TIME_ASSERT(uint32IsFourBytes, sizeof(PHYSFS_uint32) == 4);
|
||||||
PHYSFS_COMPILE_TIME_ASSERT(sint32, sizeof(PHYSFS_sint32) == 4);
|
PHYSFS_COMPILE_TIME_ASSERT(sint32IsFourBytes, sizeof(PHYSFS_sint32) == 4);
|
||||||
|
|
||||||
#ifndef PHYSFS_NO_64BIT_SUPPORT
|
#ifndef PHYSFS_NO_64BIT_SUPPORT
|
||||||
PHYSFS_COMPILE_TIME_ASSERT(uint64, sizeof(PHYSFS_uint64) == 8);
|
PHYSFS_COMPILE_TIME_ASSERT(uint64IsEightBytes, sizeof(PHYSFS_uint64) == 8);
|
||||||
PHYSFS_COMPILE_TIME_ASSERT(sint64, sizeof(PHYSFS_sint64) == 8);
|
PHYSFS_COMPILE_TIME_ASSERT(sint64IsEightBytes, sizeof(PHYSFS_sint64) == 8);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#undef PHYSFS_COMPILE_TIME_ASSERT
|
#undef PHYSFS_COMPILE_TIME_ASSERT
|
||||||
|
|
|
@ -30,6 +30,9 @@
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
|
#define __PHYSFS_COMPILE_TIME_ASSERT(name, x) \
|
||||||
|
typedef int __PHYSFS_compile_time_assert_##name[(x) * 2 - 1]
|
||||||
|
|
||||||
/* !!! FIXME: remove this when revamping stack allocation code... */
|
/* !!! FIXME: remove this when revamping stack allocation code... */
|
||||||
#if defined(_MSC_VER) || defined(__MINGW32__) || defined(__WATCOMC__)
|
#if defined(_MSC_VER) || defined(__MINGW32__) || defined(__WATCOMC__)
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
|
@ -107,9 +110,9 @@ const void *__PHYSFS_winrtCalcPrefDir(void);
|
||||||
/* atomic operations. */
|
/* atomic operations. */
|
||||||
#if defined(_MSC_VER) && (_MSC_VER >= 1500)
|
#if defined(_MSC_VER) && (_MSC_VER >= 1500)
|
||||||
#include <intrin.h>
|
#include <intrin.h>
|
||||||
PHYSFS_COMPILE_TIME_ASSERT(LongEqualsInt, sizeof (int) == sizeof (long));
|
__PHYSFS_COMPILE_TIME_ASSERT(LongEqualsInt, sizeof (int) == sizeof (long));
|
||||||
#define __PHYSFS_ATOMIC_INCR(ptrval) _InterlockedIncrement((long*)(ptrval))
|
#define __PHYSFS_ATOMIC_INCR(ptrval) _InterlockedIncrement((long*)(ptrval))
|
||||||
#define __PHYSFS_ATOMIC_INCR(ptrval) _InterlockedDecrement((long*)(ptrval))
|
#define __PHYSFS_ATOMIC_DECR(ptrval) _InterlockedDecrement((long*)(ptrval))
|
||||||
#elif defined(__clang__) || (defined(__GNUC__) && (((__GNUC__ * 10000) + (__GNUC_MINOR__ * 100)) >= 40100))
|
#elif defined(__clang__) || (defined(__GNUC__) && (((__GNUC__ * 10000) + (__GNUC_MINOR__ * 100)) >= 40100))
|
||||||
#define __PHYSFS_ATOMIC_INCR(ptrval) __sync_fetch_and_add(ptrval, 1)
|
#define __PHYSFS_ATOMIC_INCR(ptrval) __sync_fetch_and_add(ptrval, 1)
|
||||||
#define __PHYSFS_ATOMIC_DECR(ptrval) __sync_fetch_and_add(ptrval, -1)
|
#define __PHYSFS_ATOMIC_DECR(ptrval) __sync_fetch_and_add(ptrval, -1)
|
||||||
|
|
Loading…
Reference in New Issue