Beispiel #1
0
 private void EnsureLength(BitArrayX value)
 {
     if (Length != value.Length)
     {
         throw new ArgumentException("Lengths are differ");
     }
 }
Beispiel #2
0
        public BitArrayX(BitArrayX bits, int additionalLength)
        {
            Length = bits.Length + additionalLength;

            arr = new int[GetArrayLength(Length, 32)];

            Array.Copy(bits.arr, arr, bits.arr.Length);
        }
Beispiel #3
0
        public BitArrayX(BitArrayX bits)
        {
            var arrayLength = GetArrayLength(bits.Length, 32);

            arr    = new int[arrayLength];
            Length = bits.Length;

            Array.Copy(bits.arr, arr, arrayLength);
        }
Beispiel #4
0
        public BitArrayX Xor(BitArrayX value)
        {
            EnsureLength(value);

            var ints = GetArrayLength(Length, 32);

            for (var i = 0; i < ints; i++)
            {
                arr[i] ^= value.arr[i];
            }

            return(this);
        }
Beispiel #5
0
        public BitArrayX AndNot(BitArrayX value)
        {
            EnsureLength(value);

            var ints = GetArrayLength(Length, 32);

            for (var i = 0; i < ints; i++)
            {
                arr[i] &= ~(value.arr[i]);
            }

            return(this);
        }
Beispiel #6
0
        public static bool Equals(BitArrayX x, BitArrayX y)
        {
            if (x.Length != y.Length)
            {
                return(false);
            }

            for (var i = 0; i < x.arr.Length; i++)
            {
                if (x.arr[i] != y.arr[i])
                {
                    return(false);
                }
            }

            return(true);
        }