mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 18:15:11 +00:00
Implement RtlFindLeastSignificantBit() and RtlFindMostSignificantBit().
svn path=/trunk/; revision=7991
This commit is contained in:
parent
fb0bca238a
commit
e61405acd5
1 changed files with 43 additions and 1 deletions
|
@ -1,4 +1,4 @@
|
|||
/* $Id: bitmap.c,v 1.6 2004/02/01 20:48:06 ekohl Exp $
|
||||
/* $Id: bitmap.c,v 1.7 2004/02/02 13:34:01 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -743,4 +743,46 @@ RtlSetBits (
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
CCHAR STDCALL
|
||||
RtlFindLeastSignificantBit (IN ULONGLONG Set)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (Set == 0ULL)
|
||||
return -1;
|
||||
|
||||
for (i = 0; i < 64; i++)
|
||||
{
|
||||
if (Set & (1 << i))
|
||||
return (CCHAR)i;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
CCHAR STDCALL
|
||||
RtlFindMostSignificantBit (IN ULONGLONG Set)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (Set == 0ULL)
|
||||
return -1;
|
||||
|
||||
for (i = 63; i >= 0; i--)
|
||||
{
|
||||
if (Set & (1 << i))
|
||||
return (CCHAR)i;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
Loading…
Reference in a new issue