1 /******************************************************************************
2 * INTERLOCKED Functions *
3 ******************************************************************************/
5 #define BitScanForward _BitScanForward
6 #define BitScanReverse _BitScanReverse
7 #define BitTest _bittest
8 #define BitTestAndComplement _bittestandcomplement
9 #define BitTestAndSet _bittestandset
10 #define BitTestAndReset _bittestandreset
11 #define InterlockedBitTestAndSet _interlockedbittestandset
12 #define InterlockedBitTestAndReset _interlockedbittestandreset
15 #define BitScanForward64 _BitScanForward64
16 #define BitScanReverse64 _BitScanReverse64
17 #define BitTest64 _bittest64
18 #define BitTestAndComplement64 _bittestandcomplement64
19 #define BitTestAndSet64 _bittestandset64
20 #define BitTestAndReset64 _bittestandreset64
21 #define InterlockedBitTestAndSet64 _interlockedbittestandset64
22 #define InterlockedBitTestAndReset64 _interlockedbittestandreset64
25 #if !defined(__INTERLOCKED_DECLARED)
26 #define __INTERLOCKED_DECLARED
29 #if defined(NO_INTERLOCKED_INTRINSICS)
34 _Inout_ _Interlocked_operand_ LONG
volatile *Addend
);
40 _Inout_ _Interlocked_operand_ LONG
volatile *Addend
);
45 InterlockedCompareExchange(
46 _Inout_ _Interlocked_operand_ LONG
volatile *Destination
,
54 _Inout_ _Interlocked_operand_ LONG
volatile *Destination
,
60 InterlockedExchangeAdd(
61 _Inout_ _Interlocked_operand_ LONG
volatile *Addend
,
64 #else /* !defined(NO_INTERLOCKED_INTRINSICS) */
66 #define InterlockedExchange _InterlockedExchange
67 #define InterlockedIncrement _InterlockedIncrement
68 #define InterlockedDecrement _InterlockedDecrement
69 #define InterlockedExchangeAdd _InterlockedExchangeAdd
70 #define InterlockedCompareExchange _InterlockedCompareExchange
71 #define InterlockedOr _InterlockedOr
72 #define InterlockedAnd _InterlockedAnd
73 #define InterlockedXor _InterlockedXor
75 #endif /* !defined(NO_INTERLOCKED_INTRINSICS) */
77 #endif /* defined (_X86_) */
82 * InterlockedExchangePointer(
83 * IN OUT PVOID volatile *Target,
86 #define InterlockedExchangePointer(Target, Value) \
87 ((PVOID) InterlockedExchange((PLONG) Target, (LONG) Value))
91 * InterlockedCompareExchangePointer(
92 * IN OUT PVOID *Destination,
96 #define InterlockedCompareExchangePointer(Destination, Exchange, Comparand) \
97 ((PVOID) InterlockedCompareExchange((PLONG) Destination, (LONG) Exchange, (LONG) Comparand))
99 #define InterlockedExchangeAddSizeT(a, b) InterlockedExchangeAdd((LONG *)a, b)
100 #define InterlockedIncrementSizeT(a) InterlockedIncrement((LONG *)a)
101 #define InterlockedDecrementSizeT(a) InterlockedDecrement((LONG *)a)
103 #endif // !defined (_WIN64)
105 #if defined (_M_AMD64)
107 #define InterlockedExchangeAddSizeT(a, b) InterlockedExchangeAdd64((LONGLONG *)a, (LONGLONG)b)
108 #define InterlockedIncrementSizeT(a) InterlockedIncrement64((LONGLONG *)a)
109 #define InterlockedDecrementSizeT(a) InterlockedDecrement64((LONGLONG *)a)
110 #define InterlockedAnd _InterlockedAnd
111 #define InterlockedOr _InterlockedOr
112 #define InterlockedXor _InterlockedXor
113 #define InterlockedIncrement _InterlockedIncrement
114 #define InterlockedDecrement _InterlockedDecrement
115 #define InterlockedAdd _InterlockedAdd
116 #define InterlockedExchange _InterlockedExchange
117 #define InterlockedExchangeAdd _InterlockedExchangeAdd
118 #define InterlockedCompareExchange _InterlockedCompareExchange
119 #define InterlockedAnd64 _InterlockedAnd64
120 #define InterlockedOr64 _InterlockedOr64
121 #define InterlockedXor64 _InterlockedXor64
122 #define InterlockedIncrement64 _InterlockedIncrement64
123 #define InterlockedDecrement64 _InterlockedDecrement64
124 #define InterlockedAdd64 _InterlockedAdd64
125 #define InterlockedExchange64 _InterlockedExchange64
126 #define InterlockedExchangeAdd64 _InterlockedExchangeAdd64
127 #define InterlockedCompareExchange64 _InterlockedCompareExchange64
128 #define InterlockedCompareExchangePointer _InterlockedCompareExchangePointer
129 #define InterlockedExchangePointer _InterlockedExchangePointer
130 #define InterlockedBitTestAndSet64 _interlockedbittestandset64
131 #define InterlockedBitTestAndReset64 _interlockedbittestandreset64
135 #if defined(_M_AMD64) && !defined(RC_INVOKED) && !defined(MIDL_PASS)
136 //#if !defined(_X86AMD64_) // FIXME: what's _X86AMD64_ used for?
140 _Inout_ _Interlocked_operand_ LONG64
volatile *Addend
,
143 return InterlockedExchangeAdd64(Addend
, Value
) + Value
;
148 #endif /* !__INTERLOCKED_DECLARED */