public static string CreateBitMask(int maxBits = kDefaultSize, bool defaultBitValue = false) { // Creates a new bitmask with all bits set to defaultBitValue. var t = new BitMask(maxBits, defaultBitValue); return(t.ToString()); }
public static bool IsBitSet(int bitPos, string base64String) { // is bit set? // bitPos = bit position in the base64String var t = new BitMask(base64String); return(t.IsSet(bitPos)); }
public static string CreateBitMask2(int bitPos, bool bitValue, string base64String) { // Create a new bitmask with one bit changed. // bitPos = bit position in the base64String to set. zero based. var t = new BitMask(base64String); t.SetBit(bitPos, bitValue); return(t.ToString()); }
public void OpOr(BitMask bits) { // Combine these bits. Or bits. if (bits._binary == null) { return; } int bytes1 = bits._binary.Length; if (bytes1 <= 0) { return; } int bytes2 = (_binary == null) ? 0 : _binary.Length; if (bytes2 < bytes1) { Array.Resize(ref _binary, bytes1); } for (int i = 0; i < bytes1; i++) { _binary[i] |= bits._binary[i]; } }