src/NeinMath/Integer.cs
/// <summary>
/// Performs a bitwise XOR operation on two Integers.
/// </summary>
/// <param name="right">The second value.</param>
/// <returns>The result of the bitwise XOR operation.</returns>
Performs a bitwise XOR operation on two Integers.
Performs a bitwise XOR operation on two Integers .
public Integer Xor(Integer right)
        {
            var leftBits = sign
                ? Bits.TwosComplement(bits, length) : bits;
            var leftPad = sign
                ? 0xFFFFFFFF : 0x00000000;
            var rightBits = right.sign
                ? Bits.TwosComplement(right.bits, right.length) : right.bits;
            var rightPad = right.sign
                ? 0xFFFFFFFF : 0x00000000;
            var result = length < right.length
                ? Calc.Xor(rightBits, right.length, leftBits, length, leftPad)
                : Calc.Xor(leftBits, length, rightBits, right.length, rightPad);
            var signed = sign ^ right.sign;
            if (signed)
                result = Bits.TwosComplement(result, result.Length);
            return new Integer(result, result.Length, signed);
        }
public Integer Xor ( Integer right ) { var leftBits = sign ? Bits . TwosComplement ( bits , length ) : bits ; var leftPad = sign ? 0xFFFFFFFF : 0x00000000 ; var rightBits = right . sign ? Bits . TwosComplement ( right . bits , right . length ) : right . bits ; var rightPad = right . sign ? 0xFFFFFFFF : 0x00000000 ; var result = length < right . length ? Calc . Xor ( rightBits , right . length , leftBits , length , leftPad ) : Calc . Xor ( leftBits , length , rightBits , right . length , rightPad ) ; var signed = sign ^ right . sign ; if ( signed ) result = Bits . TwosComplement ( result , result . Length ) ; return new Integer ( result , result . Length , signed ) ; }
Performs a bitwise XOR operation on two Integers.
Performs a bitwise XOR operation on two Integers .
The result of the bitwise XOR operation.
The result of the bitwise XOR operation .
right
Integer
The second value.
The second value .