Check if Bit is set, Set Bit to 1 or 0
2010-12-16
1: Check if Bit is set
//Check if a bit is set
bool IsBitSet(Int32 aInt, int pos)
{
return (aInt & (1 << pos)) != 0;
}
2: Set Bit to 0:
static int SetZeroBit(int value, int position)
{
return value & ~(1 << position);
}
3: Set Bit to 1:
static int SetBit(int value, int position)
{
return value | (1 << position);
}