9 #ifndef _LIBQI_QI_ATOMIC_HPP_
10 #define _LIBQI_QI_ATOMIC_HPP_
14 # pragma intrinsic(_InterlockedIncrement16)
15 # pragma intrinsic(_InterlockedDecrement16)
16 # pragma intrinsic(_InterlockedIncrement)
17 # pragma intrinsic(_InterlockedDecrement)
19 extern "C" long __cdecl _InterlockedIncrement(
long volatile *);
20 extern "C" long __cdecl _InterlockedDecrement(
long volatile *);
21 extern "C" short __cdecl _InterlockedIncrement16(
short volatile *);
22 extern "C" short __cdecl _InterlockedDecrement16(
short volatile *);
60 return __sync_add_and_fetch(&_value, 1);
64 T atomic<T>::operator--()
66 return __sync_sub_and_fetch(&_value, 1);
72 inline short atomic<short>::operator++()
74 return _InterlockedIncrement16(&_value);
78 inline short atomic<short>::operator--()
80 return _InterlockedDecrement16(&_value);
84 inline long atomic<long>::operator++()
86 return _InterlockedIncrement(&_value);
90 inline long atomic<long>::operator--()
92 return _InterlockedDecrement(&_value);
97 #endif // _LIBQI_QI_ATOMIC_HPP_