because i know http://chessprogramming.wikispaces.com/BitScan where all sorts of bitscans are descriped, i missed the following
approaches.(using _32bit intrinsics_) (i also couldnt find it elsewhere)
so i thought i will post this.
Code: Select all
//****************************************************************************
//* DESCRIPTION : 32Bit Version for _BitScanForward64 *
//****************************************************************************
ULONG bsf64(BTB_T bb)
{
UI_32 *const ptr = (UI_32*)&bb;
ULONG id=64;
_BitScanForward(&id,*(ptr+1));
id+=32;
_BitScanForward(&id,*ptr);
return(id);
}
//****************************************************************************
//* DESCRIPTION : 32Bit Version for _BitScanReverse64 *
//****************************************************************************
ULONG bsr64(BTB_T bb)
{
UI_32 *const ptr = (UI_32*)&bb;
ULONG id=64;
_BitScanReverse(&id,*(ptr+1)) ? id+=32 : _BitScanReverse(&id,*ptr);
return(id);
}
Cheers