// Bitwise operators public static BitList operator ~(BitList bits) { if (bits == null) { throw new ArgumentNullException(); } var list = new BitList(bits.Count, bits._bits); for (var i = 0; i < list._bits.Length; i++) { list._bits[i] = ~list._bits[i]; } list._bits[list._bits.Length - 1] &= ~(~0U << (list.Count & 31)); return(list); }
static BitList Combine(BitList left, BitList right, Func <uint, uint, uint> func) { if ((left == null) || (right == null)) { throw new ArgumentNullException(); } if (left.Count != right.Count) { throw new ArgumentException(string.Format( "BitLists are not the same size ({0} != {1})", left.Count, right.Count)); } var list = new BitList(left.Count); for (var i = 0; i < list._bits.Length; i++) { list._bits[i] = func(left._bits[i], right._bits[i]); } return(list); }