From 367d9f6f71420e4c7ed5f273e04d280655bb3d7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20P=C3=B6sel?= Date: Mon, 24 Dec 2012 21:30:41 +0000 Subject: SMS plugin adopted (32bit version only) git-svn-id: http://svn.miranda-ng.org/main/trunk@2831 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- .../src/AdditionalFunctions/InterlockedFunctions.h | 127 +++++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100644 plugins/SMS/src/AdditionalFunctions/InterlockedFunctions.h (limited to 'plugins/SMS/src/AdditionalFunctions/InterlockedFunctions.h') diff --git a/plugins/SMS/src/AdditionalFunctions/InterlockedFunctions.h b/plugins/SMS/src/AdditionalFunctions/InterlockedFunctions.h new file mode 100644 index 0000000000..3fb008b216 --- /dev/null +++ b/plugins/SMS/src/AdditionalFunctions/InterlockedFunctions.h @@ -0,0 +1,127 @@ +#if !defined(AFX_INTERLOCKED_FUNCTIONS__H__INCLUDED_) +#define AFX_INTERLOCKED_FUNCTIONS__H__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + + + + + +#ifdef InterlockedCompareExchange +#ifndef InterlockedAnd +LONG FORCEINLINE InterlockedAnd(LONG volatile *Destination,LONG Value) +{ + LONG Old; + + do + { + Old=*Destination; + }while(InterlockedCompareExchange(Destination,(Old&Value),Old)!=Old); +return(Old); +} +#endif //InterlockedAnd + + +#ifndef InterlockedOr +LONG FORCEINLINE InterlockedOr(LONG volatile *Destination,LONG Value) +{ + LONG Old; + + do + { + Old=*Destination; + }while(InterlockedCompareExchange(Destination,(Old|Value),Old)!=Old); +return(Old); +} +#endif //InterlockedOr + + +#ifndef InterlockedXor +LONG FORCEINLINE InterlockedXor(LONG volatile *Destination,LONG Value) +{ + LONG Old; + + do + { + Old=*Destination; + }while(InterlockedCompareExchange(Destination,(Old^Value),Old)!=Old); +return(Old); +} +#endif //InterlockedXor +#endif //InterlockedCompareExchange + + + + + +#ifdef InterlockedCompareExchange64 +#ifndef InterlockedAnd64 +LONGLONG FORCEINLINE InterlockedAnd64(LONGLONG volatile *Destination,LONGLONG Value) +{ + LONGLONG Old; + + do + { + Old=*Destination; + }while(InterlockedCompareExchange64(Destination,(Old&Value),Old)!=Old); +return(Old); +} +#endif //InterlockedAnd64 + + +#ifndef InterlockedOr64 +LONGLONG FORCEINLINE InterlockedOr64(LONGLONG volatile *Destination,LONGLONG Value) +{ + LONGLONG Old; + + do + { + Old=*Destination; + }while(InterlockedCompareExchange64(Destination,(Old|Value),Old)!=Old); +return(Old); +} +#endif //InterlockedOr64 + + +#ifndef InterlockedXor64 +LONGLONG FORCEINLINE InterlockedXor64(LONGLONG volatile *Destination,LONGLONG Value) +{ + LONGLONG Old; + + do + { + Old=*Destination; + }while(InterlockedCompareExchange64(Destination,(Old^Value),Old)!=Old); +return(Old); +} +#endif //InterlockedXor64 +#endif //InterlockedCompareExchange64 + + + + + +#ifndef InterlockedIncrementPointer +#if defined(_WIN64) +#define InterlockedIncrementPointer(lpAddend) (LPVOID)InterlockedIncrement64((LONGLONG volatile*)lpAddend) +#else +#define InterlockedIncrementPointer(lpAddend) (LPVOID)InterlockedIncrement((LONG volatile*)lpAddend) +#endif +#endif //InterlockedIncrementPointer + + +#ifndef InterlockedDecrementPointer +#if defined(_WIN64) +#define InterlockedDecrementPointer(lpAddend) (LPVOID)InterlockedDecrement64((LONGLONG volatile*)lpAddend) +#else +#define InterlockedDecrementPointer(lpAddend) (LPVOID)InterlockedDecrement((LONG volatile*)lpAddend) +#endif +#endif //InterlockedDecrementPointer + + + + + +#endif // !defined(AFX_INTERLOCKED_FUNCTIONS__H__INCLUDED_) -- cgit v1.2.3