Commit 4b7b7a5f authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

winbase.h: Unify MSVC interlocked functions declarations.

And use intrinsic versions on x86. Signed-off-by: 's avatarJacek Caban <jacek@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent a6e65dbc
......@@ -2904,7 +2904,55 @@ extern WCHAR * CDECL wine_get_dos_file_name( LPCSTR str );
/* Interlocked functions */
#ifdef __i386__
#ifdef _MSC_VER
#pragma intrinsic(_InterlockedCompareExchange)
#pragma intrinsic(_InterlockedCompareExchange64)
#pragma intrinsic(_InterlockedExchange)
#pragma intrinsic(_InterlockedExchangeAdd)
#pragma intrinsic(_InterlockedIncrement)
#pragma intrinsic(_InterlockedDecrement)
#define InterlockedCompareExchange _InterlockedCompareExchange
#define InterlockedCompareExchange64 _InterlockedCompareExchange64
#define InterlockedExchange _InterlockedExchange
#define InterlockedExchangeAdd _InterlockedExchangeAdd
#define InterlockedIncrement _InterlockedIncrement
#define InterlockedDecrement _InterlockedDecrement
long InterlockedCompareExchange(long volatile*,long,long);
long long InterlockedCompareExchange64(long long volatile*,long long,long long);
long InterlockedDecrement(long volatile*);
long InterlockedExchange(long volatile*,long);
long InterlockedExchangeAdd(long volatile*,long);
long InterlockedIncrement(long volatile*);
#ifndef __i386__
#pragma intrinsic(_InterlockedCompareExchangePointer)
#pragma intrinsic(_InterlockedExchangePointer)
#define InterlockedCompareExchangePointer _InterlockedCompareExchangePointer
#define InterlockedExchangePointer _InterlockedExchangePointer
void *InterlockedCompareExchangePointer(void *volatile*,void*,void*);
void *InterlockedExchangePointer(void *volatile*,void*);
#else
static FORCEINLINE void *WINAPI InterlockedCompareExchangePointer( void *volatile *dest, void *xchg, void *compare )
{
return (void *)InterlockedCompareExchange( (long volatile*)dest, (long)xchg, (long)compare );
}
static FORCEINLINE void *WINAPI InterlockedExchangePointer( void *volatile *dest, void *val )
{
return (void *)InterlockedExchange( (long volatile*)dest, (long)val );
}
#endif
#elif defined(__i386__)
# if defined(__GNUC__) && !defined(_NTSYSTEM_) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 2)))
static FORCEINLINE LONG WINAPI InterlockedCompareExchange( LONG volatile *dest, LONG xchg, LONG compare )
......@@ -2963,57 +3011,6 @@ static FORCEINLINE PVOID WINAPI InterlockedExchangePointer( PVOID volatile *dest
WINBASEAPI LONGLONG WINAPI InterlockedCompareExchange64(LONGLONG volatile*,LONGLONG,LONGLONG);
#elif defined(_MSC_VER)
#pragma intrinsic(_InterlockedCompareExchange)
#pragma intrinsic(_InterlockedCompareExchangePointer)
#pragma intrinsic(_InterlockedCompareExchange64)
#pragma intrinsic(_InterlockedExchange)
#pragma intrinsic(_InterlockedExchangePointer)
#pragma intrinsic(_InterlockedExchangeAdd)
#pragma intrinsic(_InterlockedIncrement)
#pragma intrinsic(_InterlockedDecrement)
static FORCEINLINE LONG WINAPI InterlockedCompareExchange( LONG volatile *dest, LONG xchg, LONG compare )
{
return _InterlockedCompareExchange( dest, xchg, compare );
}
static FORCEINLINE PVOID WINAPI InterlockedCompareExchangePointer( PVOID volatile *dest, PVOID xchg, PVOID compare )
{
return _InterlockedCompareExchangePointer( dest, xchg, compare );
}
static FORCEINLINE LONGLONG WINAPI InterlockedCompareExchange64( LONGLONG volatile *dest, LONGLONG xchg, LONGLONG compare )
{
return _InterlockedCompareExchange64( dest, xchg, compare );
}
static FORCEINLINE LONG WINAPI InterlockedExchange( LONG volatile *dest, LONG val )
{
return _InterlockedExchange( dest, val );
}
static FORCEINLINE PVOID WINAPI InterlockedExchangePointer( PVOID volatile *dest, PVOID val )
{
return _InterlockedExchangePointer( dest, val );
}
static FORCEINLINE LONG WINAPI InterlockedExchangeAdd( LONG volatile *dest, LONG incr )
{
return _InterlockedExchangeAdd( dest, incr );
}
static FORCEINLINE LONG WINAPI InterlockedIncrement( LONG volatile *dest )
{
return _InterlockedIncrement( dest );
}
static FORCEINLINE LONG WINAPI InterlockedDecrement( LONG volatile *dest )
{
return _InterlockedDecrement( dest );
}
#elif defined(__GNUC__)
static FORCEINLINE LONG WINAPI InterlockedCompareExchange( LONG volatile *dest, LONG xchg, LONG compare )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment