mirror of
https://github.com/reactos/reactos.git
synced 2024-11-04 05:43:30 +00:00
18a81d5d1e
* Sync up to trunk head (r64124). svn path=/branches/shell-experiments/; revision=64126
150 lines
4.8 KiB
C
150 lines
4.8 KiB
C
/******************************************************************************
|
|
* INTERLOCKED Functions *
|
|
******************************************************************************/
|
|
|
|
#define BitScanForward _BitScanForward
|
|
#define BitScanReverse _BitScanReverse
|
|
#define BitTest _bittest
|
|
#define BitTestAndComplement _bittestandcomplement
|
|
#define BitTestAndSet _bittestandset
|
|
#define BitTestAndReset _bittestandreset
|
|
#define InterlockedBitTestAndSet _interlockedbittestandset
|
|
#define InterlockedBitTestAndReset _interlockedbittestandreset
|
|
|
|
#ifdef _M_AMD64
|
|
#define BitScanForward64 _BitScanForward64
|
|
#define BitScanReverse64 _BitScanReverse64
|
|
#define BitTest64 _bittest64
|
|
#define BitTestAndComplement64 _bittestandcomplement64
|
|
#define BitTestAndSet64 _bittestandset64
|
|
#define BitTestAndReset64 _bittestandreset64
|
|
#define InterlockedBitTestAndSet64 _interlockedbittestandset64
|
|
#define InterlockedBitTestAndReset64 _interlockedbittestandreset64
|
|
#endif
|
|
|
|
#if !defined(__INTERLOCKED_DECLARED)
|
|
#define __INTERLOCKED_DECLARED
|
|
|
|
#if defined (_X86_)
|
|
#if defined(NO_INTERLOCKED_INTRINSICS)
|
|
NTKERNELAPI
|
|
LONG
|
|
FASTCALL
|
|
InterlockedIncrement(
|
|
_Inout_ _Interlocked_operand_ LONG volatile *Addend);
|
|
|
|
NTKERNELAPI
|
|
LONG
|
|
FASTCALL
|
|
InterlockedDecrement(
|
|
_Inout_ _Interlocked_operand_ LONG volatile *Addend);
|
|
|
|
NTKERNELAPI
|
|
LONG
|
|
FASTCALL
|
|
InterlockedCompareExchange(
|
|
_Inout_ _Interlocked_operand_ LONG volatile *Destination,
|
|
_In_ LONG Exchange,
|
|
_In_ LONG Comparand);
|
|
|
|
NTKERNELAPI
|
|
LONG
|
|
FASTCALL
|
|
InterlockedExchange(
|
|
_Inout_ _Interlocked_operand_ LONG volatile *Destination,
|
|
_In_ LONG Value);
|
|
|
|
NTKERNELAPI
|
|
LONG
|
|
FASTCALL
|
|
InterlockedExchangeAdd(
|
|
_Inout_ _Interlocked_operand_ LONG volatile *Addend,
|
|
_In_ LONG Value);
|
|
|
|
#else /* !defined(NO_INTERLOCKED_INTRINSICS) */
|
|
|
|
#define InterlockedExchange _InterlockedExchange
|
|
#define InterlockedIncrement _InterlockedIncrement
|
|
#define InterlockedDecrement _InterlockedDecrement
|
|
#define InterlockedExchangeAdd _InterlockedExchangeAdd
|
|
#define InterlockedCompareExchange _InterlockedCompareExchange
|
|
#define InterlockedOr _InterlockedOr
|
|
#define InterlockedAnd _InterlockedAnd
|
|
#define InterlockedXor _InterlockedXor
|
|
|
|
#endif /* !defined(NO_INTERLOCKED_INTRINSICS) */
|
|
|
|
#endif /* defined (_X86_) */
|
|
|
|
#if !defined (_WIN64)
|
|
/*
|
|
* PVOID
|
|
* InterlockedExchangePointer(
|
|
* IN OUT PVOID volatile *Target,
|
|
* IN PVOID Value)
|
|
*/
|
|
#define InterlockedExchangePointer(Target, Value) \
|
|
((PVOID) InterlockedExchange((PLONG) Target, (LONG) Value))
|
|
|
|
/*
|
|
* PVOID
|
|
* InterlockedCompareExchangePointer(
|
|
* IN OUT PVOID *Destination,
|
|
* IN PVOID Exchange,
|
|
* IN PVOID Comparand)
|
|
*/
|
|
#define InterlockedCompareExchangePointer(Destination, Exchange, Comparand) \
|
|
((PVOID) InterlockedCompareExchange((PLONG) Destination, (LONG) Exchange, (LONG) Comparand))
|
|
|
|
#define InterlockedExchangeAddSizeT(a, b) InterlockedExchangeAdd((LONG *)a, b)
|
|
#define InterlockedIncrementSizeT(a) InterlockedIncrement((LONG *)a)
|
|
#define InterlockedDecrementSizeT(a) InterlockedDecrement((LONG *)a)
|
|
|
|
#endif // !defined (_WIN64)
|
|
|
|
#if defined (_M_AMD64)
|
|
|
|
#define InterlockedExchangeAddSizeT(a, b) InterlockedExchangeAdd64((LONGLONG *)a, (LONGLONG)b)
|
|
#define InterlockedIncrementSizeT(a) InterlockedIncrement64((LONGLONG *)a)
|
|
#define InterlockedDecrementSizeT(a) InterlockedDecrement64((LONGLONG *)a)
|
|
#define InterlockedAnd _InterlockedAnd
|
|
#define InterlockedOr _InterlockedOr
|
|
#define InterlockedXor _InterlockedXor
|
|
#define InterlockedIncrement _InterlockedIncrement
|
|
#define InterlockedDecrement _InterlockedDecrement
|
|
#define InterlockedAdd _InterlockedAdd
|
|
#define InterlockedExchange _InterlockedExchange
|
|
#define InterlockedExchangeAdd _InterlockedExchangeAdd
|
|
#define InterlockedCompareExchange _InterlockedCompareExchange
|
|
#define InterlockedAnd64 _InterlockedAnd64
|
|
#define InterlockedOr64 _InterlockedOr64
|
|
#define InterlockedXor64 _InterlockedXor64
|
|
#define InterlockedIncrement64 _InterlockedIncrement64
|
|
#define InterlockedDecrement64 _InterlockedDecrement64
|
|
#define InterlockedAdd64 _InterlockedAdd64
|
|
#define InterlockedExchange64 _InterlockedExchange64
|
|
#define InterlockedExchangeAdd64 _InterlockedExchangeAdd64
|
|
#define InterlockedCompareExchange64 _InterlockedCompareExchange64
|
|
#define InterlockedCompareExchangePointer _InterlockedCompareExchangePointer
|
|
#define InterlockedExchangePointer _InterlockedExchangePointer
|
|
#define InterlockedBitTestAndSet64 _interlockedbittestandset64
|
|
#define InterlockedBitTestAndReset64 _interlockedbittestandreset64
|
|
|
|
#endif // _M_AMD64
|
|
|
|
#if defined(_M_AMD64) && !defined(RC_INVOKED) && !defined(MIDL_PASS)
|
|
//#if !defined(_X86AMD64_) // FIXME: what's _X86AMD64_ used for?
|
|
FORCEINLINE
|
|
LONG64
|
|
InterlockedAdd64(
|
|
_Inout_ _Interlocked_operand_ LONG64 volatile *Addend,
|
|
_In_ LONG64 Value)
|
|
{
|
|
return InterlockedExchangeAdd64(Addend, Value) + Value;
|
|
}
|
|
//#endif
|
|
#endif
|
|
|
|
#endif /* !__INTERLOCKED_DECLARED */
|
|
|
|
|