Zebediah Figura : include: Add InterlockedOr().
Alexandre Julliard
julliard at winehq.org
Wed Jan 20 16:58:43 CST 2021
Module: wine
Branch: master
Commit: 377f721362e41a6acaa8b9b4af6ac5ff532cfaf5
URL: https://source.winehq.org/git/wine.git/?a=commit;h=377f721362e41a6acaa8b9b4af6ac5ff532cfaf5
Author: Zebediah Figura <z.figura12 at gmail.com>
Date: Mon Jan 18 21:55:02 2021 -0600
include: Add InterlockedOr().
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/msvcrt/lock.c | 9 ---------
include/winnt.h | 12 ++++++++++++
2 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/dlls/msvcrt/lock.c b/dlls/msvcrt/lock.c
index b6b5d4b78db..c10445becda 100644
--- a/dlls/msvcrt/lock.c
+++ b/dlls/msvcrt/lock.c
@@ -1157,15 +1157,6 @@ static inline void spin_wait_for_next_rwl(rwl_queue *q)
SpinWait_dtor(&sw);
}
-/* Remove when proper InterlockedOr implementation is added to wine */
-static LONG InterlockedOr(LONG *d, LONG v)
-{
- LONG l;
- while (~(l = *d) & v)
- if (InterlockedCompareExchange(d, l|v, l) == l) break;
- return l;
-}
-
static LONG InterlockedAnd(LONG *d, LONG v)
{
LONG l = *d, old;
diff --git a/include/winnt.h b/include/winnt.h
index 8abc11a7dd5..61368d43d3c 100644
--- a/include/winnt.h
+++ b/include/winnt.h
@@ -6905,6 +6905,7 @@ static inline BOOLEAN BitScanReverse(DWORD *index, DWORD mask)
#pragma intrinsic(_InterlockedExchangeAdd)
#pragma intrinsic(_InterlockedIncrement)
#pragma intrinsic(_InterlockedDecrement)
+#pragma intrinsic(_InterlockedOr)
long _InterlockedCompareExchange(long volatile*,long,long);
long long _InterlockedCompareExchange64(long long volatile*,long long,long long);
@@ -6915,6 +6916,7 @@ long _InterlockedDecrement(long volatile*);
long _InterlockedExchange(long volatile*,long);
long _InterlockedExchangeAdd(long volatile*,long);
long _InterlockedIncrement(long volatile*);
+long _InterlockedOr(long volatile *,long);
static FORCEINLINE LONG WINAPI InterlockedCompareExchange( LONG volatile *dest, LONG xchg, LONG compare )
{
@@ -6953,6 +6955,11 @@ static FORCEINLINE LONG WINAPI InterlockedDecrement( LONG volatile *dest )
return _InterlockedDecrement( (long volatile *)dest );
}
+static FORCEINLINE LONG WINAPI InterlockedOr( LONG volatile *dest, LONG val )
+{
+ return _InterlockedOr( (long volatile *)dest, val );
+}
+
#ifndef __i386__
#pragma intrinsic(_InterlockedCompareExchangePointer)
@@ -7056,6 +7063,11 @@ static FORCEINLINE void * WINAPI InterlockedExchangePointer( void *volatile *des
return ret;
}
+static FORCEINLINE LONG WINAPI InterlockedOr( LONG volatile *dest, LONG val )
+{
+ return __sync_fetch_and_or( dest, val );
+}
+
#endif /* __GNUC__ */
#ifdef __cplusplus
More information about the wine-cvs
mailing list