1 #define __INTRINSIC_ONLYSPECIAL
2 #define __INTRINSIC_SPECIAL__InterlockedAnd64 /* Causes code generation in intrin-impl.h */
3
4 #include <intrin.h>
5
6 #ifdef _WIN64
7 #else
8 __int64 __stdcall InterlockedCompareExchange64(__int64 volatile *Destination,
9 __int64 Exchange, __int64 Comperand);
10 __int64 _InterlockedAnd64 (__int64 volatile *Destination,__int64 Value);
_InterlockedAnd64(__int64 volatile * Destination,__int64 Value)11 __int64 _InterlockedAnd64 (__int64 volatile *Destination,__int64 Value)
12 {
13 __int64 Old;
14 do {
15 Old = *Destination;
16 } while(InterlockedCompareExchange64(Destination,Old & Value,Old)!=Old);
17 return Old;
18 }
19 #endif
20
21 #ifdef _WIN64
22 __int64 InterlockedAnd64(__int64 volatile *, __int64) __attribute__((alias("_InterlockedAnd64")));
23 #else
24 __int64 __stdcall InterlockedAnd64(__int64 volatile *Destination, __int64 Value);
InterlockedAnd64(__int64 volatile * Destination,__int64 Value)25 __int64 __stdcall InterlockedAnd64(__int64 volatile *Destination, __int64 Value)
26 {
27 return _InterlockedAnd64(Destination, Value);
28 }
29 #endif
30