Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
4c2b6af1
Commit
4c2b6af1
authored
Jan 24, 2022
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
include: Define a few more intrinsic functions.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
a7f0e61e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
52 deletions
+38
-52
winnt.h
include/winnt.h
+38
-52
No files found.
include/winnt.h
View file @
4c2b6af1
...
...
@@ -6262,60 +6262,12 @@ typedef enum _PROCESS_MITIGATION_POLICY
MaxProcessMitigationPolicy
}
PROCESS_MITIGATION_POLICY
,
*
PPROCESS_MITIGATION_POLICY
;
#ifdef _MSC_VER
BOOLEAN
_BitScanForward
(
unsigned
long
*
,
unsigned
long
);
BOOLEAN
_BitScanReverse
(
unsigned
long
*
,
unsigned
long
);
#pragma intrinsic(_BitScanForward)
#pragma intrinsic(_BitScanReverse)
static
inline
BOOLEAN
BitScanForward
(
DWORD
*
index
,
DWORD
mask
)
{
return
_BitScanForward
((
unsigned
long
*
)
index
,
mask
);
}
static
inline
BOOLEAN
BitScanReverse
(
DWORD
*
index
,
DWORD
mask
)
{
return
_BitScanReverse
((
unsigned
long
*
)
index
,
mask
);
}
#elif defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)))
static
inline
BOOLEAN
BitScanForward
(
DWORD
*
index
,
DWORD
mask
)
{
*
index
=
__builtin_ctz
(
mask
);
return
mask
!=
0
;
}
static
inline
BOOLEAN
BitScanReverse
(
DWORD
*
index
,
DWORD
mask
)
{
*
index
=
31
-
__builtin_clz
(
mask
);
return
mask
!=
0
;
}
#else
static
inline
BOOLEAN
BitScanForward
(
DWORD
*
index
,
DWORD
mask
)
{
unsigned
int
r
=
0
;
while
(
r
<
31
&&
!
(
mask
&
(
1
<<
r
)))
r
++
;
*
index
=
r
;
return
mask
!=
0
;
}
static
inline
BOOLEAN
BitScanReverse
(
DWORD
*
index
,
DWORD
mask
)
{
unsigned
int
r
=
31
;
while
(
r
>
0
&&
!
(
mask
&
(
1
<<
r
)))
r
--
;
*
index
=
r
;
return
mask
!=
0
;
}
#endif
/* Interlocked functions */
/* Intrinsic functions */
#define BitScanForward _BitScanForward
#define BitScanReverse _BitScanReverse
#define InterlockedAdd _InlineInterlockedAdd
#define InterlockedAnd _InterlockedAnd
#define InterlockedCompareExchange _InterlockedCompareExchange
#define InterlockedCompareExchange64 _InterlockedCompareExchange64
...
...
@@ -6328,9 +6280,12 @@ static inline BOOLEAN BitScanReverse(DWORD *index, DWORD mask)
#define InterlockedIncrement _InterlockedIncrement
#define InterlockedIncrement16 _InterlockedIncrement16
#define InterlockedOr _InterlockedOr
#define InterlockedXor _InterlockedXor
#ifdef _MSC_VER
#pragma intrinsic(_BitScanForward)
#pragma intrinsic(_BitScanReverse)
#pragma intrinsic(_InterlockedAnd)
#pragma intrinsic(_InterlockedCompareExchange)
#pragma intrinsic(_InterlockedCompareExchange64)
...
...
@@ -6341,7 +6296,10 @@ static inline BOOLEAN BitScanReverse(DWORD *index, DWORD mask)
#pragma intrinsic(_InterlockedDecrement)
#pragma intrinsic(_InterlockedDecrement16)
#pragma intrinsic(_InterlockedOr)
#pragma intrinsic(_InterlockedXor)
BOOLEAN
_BitScanForward
(
unsigned
long
*
,
unsigned
long
);
BOOLEAN
_BitScanReverse
(
unsigned
long
*
,
unsigned
long
);
long
_InterlockedAnd
(
long
volatile
*
,
long
);
long
_InterlockedCompareExchange
(
long
volatile
*
,
long
,
long
);
long
long
_InterlockedCompareExchange64
(
long
long
volatile
*
,
long
long
,
long
long
);
...
...
@@ -6352,6 +6310,12 @@ long _InterlockedExchangeAdd(long volatile*,long);
long
_InterlockedIncrement
(
long
volatile
*
);
short
_InterlockedIncrement16
(
short
volatile
*
);
long
_InterlockedOr
(
long
volatile
*
,
long
);
long
_InterlockedXor
(
long
volatile
*
,
long
);
static
FORCEINLINE
long
InterlockedAdd
(
long
volatile
*
dest
,
long
val
)
{
return
InterlockedExchangeAdd
(
dest
,
val
)
+
val
;
}
#if !defined(__i386__) || _MSC_VER >= 1600
...
...
@@ -6412,6 +6376,23 @@ static FORCEINLINE void MemoryBarrier(void)
#elif defined(__GNUC__)
static
FORCEINLINE
BOOLEAN
WINAPI
BitScanForward
(
DWORD
*
index
,
DWORD
mask
)
{
*
index
=
__builtin_ctz
(
mask
);
return
mask
!=
0
;
}
static
FORCEINLINE
BOOLEAN
WINAPI
BitScanReverse
(
DWORD
*
index
,
DWORD
mask
)
{
*
index
=
31
-
__builtin_clz
(
mask
);
return
mask
!=
0
;
}
static
FORCEINLINE
LONG
WINAPI
InterlockedAdd
(
LONG
volatile
*
dest
,
LONG
val
)
{
return
__sync_add_and_fetch
(
dest
,
val
);
}
static
FORCEINLINE
LONG
WINAPI
InterlockedAnd
(
LONG
volatile
*
dest
,
LONG
val
)
{
return
__sync_fetch_and_and
(
dest
,
val
);
...
...
@@ -6491,6 +6472,11 @@ static FORCEINLINE LONG WINAPI InterlockedOr( LONG volatile *dest, LONG val )
return
__sync_fetch_and_or
(
dest
,
val
);
}
static
FORCEINLINE
LONG
WINAPI
InterlockedXor
(
LONG
volatile
*
dest
,
LONG
val
)
{
return
__sync_fetch_and_xor
(
dest
,
val
);
}
static
FORCEINLINE
void
MemoryBarrier
(
void
)
{
__sync_synchronize
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment