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
b5d8f532
Commit
b5d8f532
authored
Mar 07, 2003
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rewrote RtlFind{Most,Least}SignificantBit in a more portable way.
parent
361e6919
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
48 deletions
+44
-48
rtlbitmap.c
dlls/ntdll/rtlbitmap.c
+44
-48
No files found.
dlls/ntdll/rtlbitmap.c
View file @
b5d8f532
...
...
@@ -50,8 +50,8 @@ static const BYTE NTDLL_leastSignificant[16] = {
};
/* Last set bit in a nibble; used for determining most significant bit */
static
const
BYTE
NTDLL_mostSignificant
[
16
]
=
{
0
,
0
,
1
,
1
,
2
,
2
,
2
,
2
,
3
,
3
,
3
,
3
,
3
,
3
,
3
,
3
static
const
signed
char
NTDLL_mostSignificant
[
16
]
=
{
-
1
,
0
,
1
,
1
,
2
,
2
,
2
,
2
,
3
,
3
,
3
,
3
,
3
,
3
,
3
,
3
};
/*************************************************************************
...
...
@@ -568,37 +568,35 @@ ULONG WINAPI RtlNumberOfClearBits(PCRTL_BITMAP lpBits)
*
* Find the most significant bit in a 64 bit integer.
*
* PARAMS
* lpBits [I] Bitmap pointer
* ulStart [I] First bit to search from
*
* RETURNS
* The position of the most significant bit.
*/
CCHAR
WINAPI
RtlFindMostSignificantBit
(
ULONGLONG
ulLong
)
{
LONG
lCount
=
64
;
LPBYTE
lpOut
=
(
LPBYTE
)
&
ulLong
+
7
;
TRACE
(
"(%lld)
\n
"
,
ulLong
);
signed
char
ret
=
32
;
DWORD
dw
;
if
(
!
(
ulLong
&
0xffffffff00000000ul
))
{
lpOut
-=
4
;
lCount
-=
32
;
}
for
(;
lCount
>
0
;
lCount
-=
8
)
{
if
(
*
lpOut
)
if
(
!
(
dw
=
(
ulLong
>>
32
)))
{
if
(
*
lpOut
&
0xf0
)
return
lCount
-
4
+
NTDLL_mostSignificant
[
*
lpOut
>>
4
];
return
lCount
-
8
+
NTDLL_mostSignificant
[
*
lpOut
&
0x0f
];
ret
=
0
;
dw
=
(
DWORD
)
ulLong
;
}
lpOut
--
;
}
return
-
1
;
if
(
dw
&
0xffff0000
)
{
dw
>>=
16
;
ret
+=
16
;
}
if
(
dw
&
0xff00
)
{
dw
>>=
8
;
ret
+=
8
;
}
if
(
dw
&
0xf0
)
{
dw
>>=
4
;
ret
+=
4
;
}
return
ret
+
NTDLL_mostSignificant
[
dw
];
}
/*************************************************************************
...
...
@@ -606,37 +604,35 @@ CCHAR WINAPI RtlFindMostSignificantBit(ULONGLONG ulLong)
*
* Find the least significant bit in a 64 bit integer.
*
* PARAMS
* lpBits [I] Bitmap pointer
* ulStart [I] First bit to search from
*
* RETURNS
* The position of the least significant bit.
*/
CCHAR
WINAPI
RtlFindLeastSignificantBit
(
ULONGLONG
ulLong
)
{
ULONG
ulCount
=
0
;
LPBYTE
lpOut
=
(
LPBYTE
)
&
ulLong
;
TRACE
(
"(%lld)
\n
"
,
ulLong
);
if
(
!
(
ulLong
&
0xffffffff
))
{
lpOut
+=
4
;
ulCount
=
32
;
}
signed
char
ret
=
0
;
DWORD
dw
;
for
(;
ulCount
<
64
;
ulCount
+=
8
)
{
if
(
*
lpOut
)
if
(
!
(
dw
=
(
DWORD
)
ulLong
))
{
if
(
*
lpOut
&
0x0f
)
return
ulCount
+
NTDLL_leastSignificant
[
*
lpOut
&
0x0f
];
return
ulCount
+
4
+
NTDLL_leastSignificant
[
*
lpOut
>>
4
];
ret
=
32
;
if
(
!
(
dw
=
ulLong
>>
32
))
return
-
1
;
}
lpOut
++
;
}
return
-
1
;
if
(
!
(
dw
&
0xffff
))
{
dw
>>=
16
;
ret
+=
16
;
}
if
(
!
(
dw
&
0xff
))
{
dw
>>=
8
;
ret
+=
8
;
}
if
(
!
(
dw
&
0x0f
))
{
dw
>>=
4
;
ret
+=
4
;
}
return
ret
+
NTDLL_leastSignificant
[
dw
&
0x0f
];
}
/*************************************************************************
...
...
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