/// <summary> /// Ensure that all provided flags are on or off /// </summary> /// <param name="flag">Set of values to modify</param> /// <param name="on">True to turn on and False to clear</param> /// <returns></returns> protected bool Flag(BigBitBlob flag, bool on) { if (Max != flag?.Max) { return(false); } Blob = (on) ? NumberEx.Or(Blob, flag.Blob, false) : NumberEx.And(Blob, NumberEx.Complement(flag.Blob, true)); return(true); }
public static BigBitBlob operator &(BigBitBlob a, BigBitBlob b) { return((a == null || b == null) ? null : new BigBitBlob(Math.Max(a.Max, b.Max), false, NumberEx.And(a.Blob, b.Blob, true))); }