/******************************************************************************
* INTERLOCKED Functions *
******************************************************************************/
-//
-// Intrinsics (note: taken from our winnt.h)
-// FIXME: 64-bit
-//
-#if defined(__GNUC__)
-
-static __inline__ BOOLEAN
-InterlockedBitTestAndSet(
- IN LONG volatile *Base,
- IN LONG Bit)
-{
-#if defined(_M_IX86)
- LONG OldBit;
- __asm__ __volatile__("lock "
- "btsl %2,%1\n\t"
- "sbbl %0,%0\n\t"
- :"=r" (OldBit),"+m" (*Base)
- :"Ir" (Bit)
- : "memory");
- return OldBit;
-#else
- return (_InterlockedOr(Base, 1 << Bit) >> Bit) & 1;
-#endif
-}
-
-static __inline__ BOOLEAN
-InterlockedBitTestAndReset(
- IN LONG volatile *Base,
- IN LONG Bit)
-{
-#if defined(_M_IX86)
- LONG OldBit;
- __asm__ __volatile__("lock "
- "btrl %2,%1\n\t"
- "sbbl %0,%0\n\t"
- :"=r" (OldBit),"+m" (*Base)
- :"Ir" (Bit)
- : "memory");
- return OldBit;
-#else
- return (_InterlockedAnd(Base, ~(1 << Bit)) >> Bit) & 1;
-#endif
-}
-
-#endif /* defined(__GNUC__) */
#define BitScanForward _BitScanForward
#define BitScanReverse _BitScanReverse
#define InterlockedBitTestAndReset _interlockedbittestandreset
#ifdef _M_AMD64
+#define BitScanForward64 _BitScanForward64
+#define BitScanReverse64 _BitScanReverse64
#define BitTest64 _bittest64
#define BitTestAndComplement64 _bittestandcomplement64
#define BitTestAndSet64 _bittestandset64
LONG
FASTCALL
InterlockedIncrement(
- IN OUT LONG volatile *Addend);
+ _Inout_ _Interlocked_operand_ LONG volatile *Addend);
NTKERNELAPI
LONG
FASTCALL
InterlockedDecrement(
- IN OUT LONG volatile *Addend);
+ _Inout_ _Interlocked_operand_ LONG volatile *Addend);
NTKERNELAPI
LONG
FASTCALL
InterlockedCompareExchange(
- IN OUT LONG volatile *Destination,
- IN LONG Exchange,
- IN LONG Comparand);
+ _Inout_ _Interlocked_operand_ LONG volatile *Destination,
+ _In_ LONG Exchange,
+ _In_ LONG Comparand);
NTKERNELAPI
LONG
FASTCALL
InterlockedExchange(
- IN OUT LONG volatile *Destination,
- IN LONG Value);
+ _Inout_ _Interlocked_operand_ LONG volatile *Destination,
+ _In_ LONG Value);
NTKERNELAPI
LONG
FASTCALL
InterlockedExchangeAdd(
- IN OUT LONG volatile *Addend,
- IN LONG Value);
+ _Inout_ _Interlocked_operand_ LONG volatile *Addend,
+ _In_ LONG Value);
#else /* !defined(NO_INTERLOCKED_INTRINSICS) */
FORCEINLINE
LONG64
InterlockedAdd64(
- IN OUT LONG64 volatile *Addend,
- IN LONG64 Value)
+ _Inout_ _Interlocked_operand_ LONG64 volatile *Addend,
+ _In_ LONG64 Value)
{
return InterlockedExchangeAdd64(Addend, Value) + Value;
}