int GetHighestBit(DWORD_PTR _dwValue) { int iRet = 0; while (_dwValue) { iRet++; _dwValue >>= 1; } return --iRet; }