Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
public struct BitMask
{
private static int[] Masks;
private BitVector32 Vector;
static BitMask()
{
Masks = new int[32];
{
Masks[0] = BitVector32.CreateMask();
}
for (int i = 1; i < 32; i++)
{
Masks[i] = BitVector32.CreateMask(Masks[i - 1]);
}
}
public int Data
{
get
{
return Vector.Data;
}
}
public BitMask(int data)
{
Vector = new BitVector32(data);
}
public bool IsSet(int position)
{
return Vector[Masks[position]];
}
public void Set(int position, bool flag)
{
Vector[Masks[position]] = flag;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.