using System; using Microsoft.SPOT; namespace UTILS { public class BitArray { private UInt32 _bits; public BitArray() { ClearAll(); } public void ClearAll() { _bits = 0; } public void Set(int bit) { _bits |= (UInt32) 1L << bit; } void Clear(int bit) { UInt32 mask = (UInt32) 1L << bit; mask = ~mask; _bits &= mask; } public bool IsSet(int bit) { UInt32 mask = (UInt32) 1L << bit; return (_bits & mask) != 0; } public UInt32 Serialize() { return _bits; } public void DeSerialize(UInt32 value) { _bits = value; } } }