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
23ce5b8f
Commit
23ce5b8f
authored
Apr 22, 2023
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Reimplement RtlAreBitsSet() to check 32 bits at a time.
parent
500ec80e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
62 deletions
+11
-62
rtlbitmap.c
dlls/ntdll/rtlbitmap.c
+11
-62
No files found.
dlls/ntdll/rtlbitmap.c
View file @
23ce5b8f
...
@@ -164,75 +164,24 @@ void WINAPI RtlClearBits( RTL_BITMAP *bitmap, ULONG start, ULONG count)
...
@@ -164,75 +164,24 @@ void WINAPI RtlClearBits( RTL_BITMAP *bitmap, ULONG start, ULONG count)
/*************************************************************************
/*************************************************************************
* RtlAreBitsSet [NTDLL.@]
* RtlAreBitsSet [NTDLL.@]
*
* Determine if part of a bitmap is set.
*
* PARAMS
* lpBits [I] Bitmap pointer
* ulStart [I] First bit to check from
* ulCount [I] Number of consecutive bits to check
*
* RETURNS
* TRUE, If ulCount bits from ulStart are set.
* FALSE, Otherwise.
*/
*/
BOOLEAN
WINAPI
RtlAreBitsSet
(
PCRTL_BITMAP
lpBits
,
ULONG
ulStart
,
ULONG
ulCount
)
BOOLEAN
WINAPI
RtlAreBitsSet
(
const
RTL_BITMAP
*
bitmap
,
ULONG
start
,
ULONG
count
)
{
{
LPBYTE
lpOut
;
ULONG
end
=
start
+
count
;
ULONG
ulRemainder
;
ULONG
pos
=
start
/
32
;
ULONG
end_pos
=
end
/
32
;
TRACE
(
"(%p,%lu,%lu)
\n
"
,
lpBits
,
ulStart
,
ulCount
);
if
(
!
lpBits
||
!
ulCount
||
ulStart
>=
lpBits
->
SizeOfBitMap
||
ulCount
>
lpBits
->
SizeOfBitMap
-
ulStart
)
return
FALSE
;
/* FIXME: It might be more efficient/cleaner to manipulate four bytes
* at a time. But beware of the pointer arithmetics...
*/
lpOut
=
((
BYTE
*
)
lpBits
->
Buffer
)
+
(
ulStart
>>
3u
);
/* Check bits in first byte, if ulStart isn't a byte boundary */
TRACE
(
"(%p,%lu,%lu)
\n
"
,
bitmap
,
start
,
count
);
if
(
ulStart
&
7
)
{
if
(
ulCount
>
7
)
{
/* Check from start bit to the end of the byte */
if
((
*
lpOut
&
((
0xff
<<
(
ulStart
&
7
)))
&
0xff
)
!=
((
0xff
<<
(
ulStart
&
7
)
&
0xff
)))
return
FALSE
;
lpOut
++
;
ulCount
-=
(
8
-
(
ulStart
&
7
));
}
else
{
/* Check from the start bit, possibly into the next byte also */
USHORT
initialWord
=
NTDLL_maskBits
[
ulCount
]
<<
(
ulStart
&
7
);
if
((
*
lpOut
&
(
initialWord
&
0xff
))
!=
(
initialWord
&
0xff
))
if
(
!
count
||
start
>=
bitmap
->
SizeOfBitMap
||
count
>
bitmap
->
SizeOfBitMap
-
start
)
return
FALSE
;
if
((
initialWord
&
0xff00
)
&&
((
lpOut
[
1
]
&
(
initialWord
>>
8
))
!=
(
initialWord
>>
8
)))
return
FALSE
;
return
FALSE
;
return
TRUE
;
}
}
/* Check bits in blocks of 8 bytes */
if
(
end_pos
==
pos
)
return
(
bitmap
->
Buffer
[
pos
]
|
~
maskbits
(
start
)
|
maskbits
(
end
))
==
~
0u
;
ulRemainder
=
ulCount
&
7
;
ulCount
>>=
3
;
while
(
ulCount
--
)
{
if
(
*
lpOut
++
!=
0xff
)
return
FALSE
;
}
/* Check remaining bits, if any */
if
((
bitmap
->
Buffer
[
pos
++
]
|
~
maskbits
(
start
))
!=
~
0u
)
return
FALSE
;
if
(
ulRemainder
&&
while
(
pos
<
end_pos
)
if
(
bitmap
->
Buffer
[
pos
++
]
!=
~
0u
)
return
FALSE
;
(
*
lpOut
&
NTDLL_maskBits
[
ulRemainder
])
!=
NTDLL_maskBits
[
ulRemainder
])
if
(
!
(
end
&
31
))
return
TRUE
;
return
FALSE
;
return
(
bitmap
->
Buffer
[
pos
]
|
maskbits
(
end
))
==
~
0u
;
return
TRUE
;
}
}
/*************************************************************************
/*************************************************************************
...
...
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