Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
2618162e
Commit
2618162e
authored
Jun 08, 2020
by
Jacek Caban
Committed by
Alexandre Julliard
Jun 09, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winnt.h: Add BitScanForward and BitScanReverse implementation.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
a240abf1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
0 deletions
+52
-0
winnt.h
include/winnt.h
+52
-0
No files found.
include/winnt.h
View file @
2618162e
...
...
@@ -6717,6 +6717,58 @@ 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
#ifdef __cplusplus
}
#endif
...
...
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