added __PHYSFS_ATOMIC_INCR and __PHYSFS_ATOMIC_DECR for watcom compiler

This commit is contained in:
Ozkan Sezer 2022-04-16 11:02:02 +03:00 committed by Ryan C. Gordon
parent 141dccb087
commit cd2e055454
1 changed files with 9 additions and 0 deletions

View File

@ -117,6 +117,15 @@ __PHYSFS_COMPILE_TIME_ASSERT(LongEqualsInt, sizeof (int) == sizeof (long));
#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_DECR(ptrval) __sync_fetch_and_add(ptrval, -1)
#elif defined(__WATCOMC__) && defined(__386__)
extern __inline int _xadd_watcom(volatile int *a, int v);
#pragma aux _xadd_watcom = \
"lock xadd [ecx], eax" \
parm [ecx] [eax] \
value [eax] \
modify exact [eax];
#define __PHYSFS_ATOMIC_INCR(ptrval) _xadd_watcom(ptrval, 1)
#define __PHYSFS_ATOMIC_DECR(ptrval) _xadd_watcom(ptrval, -1)
#else
#define PHYSFS_NEED_ATOMIC_OP_FALLBACK 1
int __PHYSFS_ATOMIC_INCR(int *ptrval);