private GetBit ( byte input, byte position ) : bool | ||
input | byte | The input byte |
position | byte | The position where the byte stands. |
Результат | bool |
private bool GetBit(byte input, byte position)
{
bool ret = false;
int mask = (0x80 >> (int)position);
int masked = (int)input & mask;
int shifted = masked >> 7 - (int)position;
ret = (1 == shifted) ? true : false;
return ret;
}