Hi
Try something like this
int WhichBit( long value )
{
long mask = 1 ;
for ( int i = 0 ; i < 32 ; i++ )
{
if ( ( mask & value ) != 0 )
{
return i+1 ;
}
mask <<= 1 ;
}
}
Hope this helps
Gabriel
| CodeGuru Home | VC++ / MFC / C++ | .NET / C# | Visual Basic | VB Forums | Developer.com |
|
Results 1 to 7 of 7
Thread: BitsThreaded View
|
Click Here to Expand Forum to Full Width |