Exemplo n.º 1
0
        public static BitString AND(BitString sourceLeft, BitString sourceRight)
        {
            BitString left  = sourceLeft.GetDeepCopy();
            BitString right = sourceRight.GetDeepCopy();

            BitString.PadShorterBitStringWithZeroes(ref left, ref right);
            BitArray andArray = left.Bits.And(right.Bits);

            return(new BitString(new BitArray(andArray)));
        }
Exemplo n.º 2
0
        public static BitString OR(BitString sourceLeft, BitString sourceRight)
        {
            // Deep copies to avoid accidental assignment
            BitString left  = sourceLeft.GetDeepCopy();
            BitString right = sourceRight.GetDeepCopy();

            BitString.PadShorterBitStringWithZeroes(ref left, ref right);
            BitArray orArray = left.Bits.Or(right.Bits);

            return(new BitString(new BitArray(orArray)));
        }
Exemplo n.º 3
0
        public static BitString XOR(BitString sourceLeft, BitString sourceRight)
        {
            // Deep copies to avoid accidental assignment
            BitString left  = sourceLeft.GetDeepCopy();
            BitString right = sourceRight.GetDeepCopy();

            // Pad shorter BitString with 0s to match longer BitString length
            BitString.PadShorterBitStringWithZeroes(ref left, ref right);
            BitArray xorArray = left.Bits.Xor(right.Bits);

            return(new BitString(new BitArray(xorArray)));
        }