Author: tkreuzer Date: Mon Jul 28 09:05:45 2008 New Revision: 34900
URL: http://svn.reactos.org/svn/reactos?rev=34900&view=rev Log: move the inlined InterlockedAnd/Or from rtl to winbase.h and rename it to InterlockedAnd/Or_Inline
Modified: branches/ros-amd64-bringup/reactos/include/psdk/winbase.h branches/ros-amd64-bringup/reactos/lib/rtl/srw.c
Modified: branches/ros-amd64-bringup/reactos/include/psdk/winbase.h URL: http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/includ... ============================================================================== --- branches/ros-amd64-bringup/reactos/include/psdk/winbase.h [iso-8859-1] (original) +++ branches/ros-amd64-bringup/reactos/include/psdk/winbase.h [iso-8859-1] Mon Jul 28 09:05:45 2008 @@ -1707,7 +1707,7 @@ #ifndef __INTERLOCKED_DECLARED #define __INTERLOCKED_DECLARED
-#if defined (_M_AMD64) +#if defined (_M_AMD64) || defined (_M_IA64)
#define InterlockedAnd _InterlockedAnd #define InterlockedOr _InterlockedOr @@ -1737,7 +1737,8 @@ #define InterlockedCompareExchange64 _InterlockedCompareExchange64 #define InterlockedCompareExchangeAcquire64 InterlockedCompareExchange64 #define InterlockedCompareExchangeRelease64 InterlockedCompareExchange64 -#else + +#else // !(defined (_M_AMD64) || defined (_M_IA64))
LONG WINAPI InterlockedOr(IN OUT LONG volatile *,LONG); LONG WINAPI InterlockedAnd(IN OUT LONG volatile *,LONG); @@ -1769,8 +1770,56 @@ PSLIST_ENTRY WINAPI InterlockedPushEntrySList(PSLIST_HEADER,PSLIST_ENTRY); #endif
-#endif /* !defined(_WIN64) */ +#endif // !(defined (_M_AMD64) || defined (_M_IA64)) + +#if !defined(InterlockedAnd) +#define InterlockedAnd InterlockedAnd_Inline +FORCEINLINE +LONG +InterlockedAnd_Inline(IN OUT volatile LONG *Target, + IN LONG Set) +{ + LONG i; + LONG j; + + j = *Target; + do { + i = j; + j = _InterlockedCompareExchange((PLONG)Target, + i & Set, + i); + + } while (i != j); + + return j; +} +#endif + +#if !defined(InterlockedOr) +#define InterlockedOr InterlockedOr_Inline +FORCEINLINE +LONG +InterlockedOr_Inline(IN OUT volatile LONG *Target, + IN LONG Set) +{ + LONG i; + LONG j; + + j = *Target; + do { + i = j; + j = _InterlockedCompareExchange((PLONG)Target, + i | Set, + i); + + } while (i != j); + + return j; +} +#endif + #endif /* __INTERLOCKED_DECLARED */ + BOOL WINAPI IsBadCodePtr(FARPROC); BOOL WINAPI IsBadHugeReadPtr(PCVOID,UINT_PTR); BOOL WINAPI IsBadHugeWritePtr(PVOID,UINT_PTR);
Modified: branches/ros-amd64-bringup/reactos/lib/rtl/srw.c URL: http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/lib/rt... ============================================================================== --- branches/ros-amd64-bringup/reactos/lib/rtl/srw.c [iso-8859-1] (original) +++ branches/ros-amd64-bringup/reactos/lib/rtl/srw.c [iso-8859-1] Mon Jul 28 09:05:45 2008 @@ -18,51 +18,6 @@ #define NDEBUG #include <debug.h>
-/* FIXME *********************************************************************/ - -/* FIXME: Interlocked functions that need to be made into a public header */ -#if 0 -FORCEINLINE -LONG -InterlockedAnd(IN OUT volatile LONG *Target, - IN LONG Set) -{ - LONG i; - LONG j; - - j = *Target; - do { - i = j; - j = _InterlockedCompareExchange((PLONG)Target, - i & Set, - i); - - } while (i != j); - - return j; -} - -FORCEINLINE -LONG -InterlockedOr(IN OUT volatile LONG *Target, - IN LONG Set) -{ - LONG i; - LONG j; - - j = *Target; - do { - i = j; - j = _InterlockedCompareExchange((PLONG)Target, - i | Set, - i); - - } while (i != j); - - return j; -} -#endif - /* FUNCTIONS *****************************************************************/
#ifdef _WIN64