Calculate A xor B, given two binary strings of the same length.

Uses pack() and unpack() to avoid cache-timing leaks caused by
chr().

@param string $left
@param string $right
@return string
@throws InvalidType
173358
public static function xorStrings(string $left, string $right): string
    {
        $length = Binary::safeStrlen($left);
        if ($length !== Binary::safeStrlen($right)) {
            throw new InvalidType(
                'Both strings must be the same length'
            );
        }
        if ($length < 1) {
            return '';
        }
        return (string) ($left ^ $right);
    }
206485
public function mergeWithCombine($left, $right)
    {
        if (is_array($left) && is_array($right)) {
            foreach ($left as $key => $val) {
                if (is_int($key)) {
                    $right[] = $val;
                } else {
                    if (isset($right[$key])) {
                        $val = $this->mergeWithCombine($val, $right[$key]);
                    }
                    $right[$key] = $val;
                }
            }
            return $right;
        } elseif ($left === null && is_array($right)) {
            return $right;
        }

        if (! empty($right) && (array) $left !== (array) $right) {
            return $this->mergeWithCombine((array) $right, (array) $left);
        }

        return $left;
    }
120949
private static function padString(string $string, int $left, int $right, string $char): string
    {
        $leftPadding = str_repeat($char, $left);
        $rightPadding = str_repeat($char, $right);

        return $leftPadding.$string.$rightPadding;
    }
976952
public function equalFields($left, $right)
    {
        $wrapIdentifier = function ($field) {
            if ($field instanceof ExpressionInterface) {
                return $field;
            }

            return new IdentifierExpression($field);
        };

        return $this->eq($wrapIdentifier($left), $wrapIdentifier($right));
    }
1327552
public static function unsignedRightShift(int $a, int $b) : int
    {
        return (
            $a >= 0
            ? $a >> $b
            : (($a & 0x7fffffff) >> $b) | (0x40000000 >> ($b - 1))
        );
    }
99970
def binary(left, operator, right)
      parentheses do
        left.visit(self)
        append(" #{operator} ")
        right.visit(self)
      end
    end
455826
def xor(left, right):
    
    maxlength = max(map(len, (left, right)))

    ileft = string_to_int(rpad(left, maxlength))
    iright = string_to_int(rpad(right, maxlength))
    xored = ileft ^ iright
    return int_to_string(xored)
1363513
public function onRelationalExpression($expressionType, $left, $right)
    {
        $type = $this->unpackExpressionType($expressionType);
        switch ($type) {
            case ExpressionType::GREATERTHAN:
                return $this->prepareBinaryExpression(self::GREATER_THAN, $left, $right);
            case ExpressionType::GREATERTHAN_OR_EQUAL:
                return $this->prepareBinaryExpression(self::GREATER_THAN_OR_EQUAL, $left, $right);
            case ExpressionType::LESSTHAN:
                return $this->prepareBinaryExpression(self::LESS_THAN, $left, $right);
            case ExpressionType::LESSTHAN_OR_EQUAL:
                return $this->prepareBinaryExpression(self::LESS_THAN_OR_EQUAL, $left, $right);
            case ExpressionType::EQUAL:
                return $this->prepareBinaryExpression(self::EQUAL, $left, $right);
            case ExpressionType::NOTEQUAL:
                return $this->prepareBinaryExpression(self::NOT_EQUAL, $left, $right);
            default:
                throw new \InvalidArgumentException('onRelationalExpression');
        }
    }
345626
private function buildLeftExpression($left)
    {
        if(self::CONTEXT_HAVING === $this->getContext())
        {
            return $this->parser->parseLeftHavingSoql($left);
        }
        return $this->parser->parseLeftWhereSoql($left);
    }
555160
private function _binaryXor($left, $round)
    {
        $xOr = gmp_xor(
            gmp_init($left, 2),
            gmp_init($round, 2)
        );

        $bin = gmp_strval($xOr, 2);

        return str_pad($bin, $this->sideSize, '0', STR_PAD_LEFT);
    }
643285
public function compare(Type $left, Type $right)
    {
        return
            $right->accept(new TypeEquivalenceComparatorVisitor($this, $left));
    }
162758
public function binary($operator = null, AbstractBuilder $leftExpression = null, AbstractBuilder $rightExpression = null)
    {
        return new BinaryOperator($operator, $leftExpression, $rightExpression);
    }
655771
public static function strContainsCaseInsensitive(Expr $left, Expr $right) : BinOp
    {
        return new BinOp($left, BinOp::STR_CONTAINS_CASE_INSENSITIVE, $right);
    }
784787
public static function greaterThan(Expr $left, Expr $right) : BinOp
    {
        return new BinOp($left, BinOp::GREATER_THAN, $right);
    }
990647
function (operator, left, right) {
			var type = (operator === '||' || operator === '&&') ? LOGICAL_EXP : BINARY_EXP;
			return {
				type: type,
				operator: operator,
				left: left,
				right: right
			};
		}
731443
public static function notEqual(Expr $left, Expr $right) : BinOp
    {
        return new BinOp($left, BinOp::NOT_EQUAL, $right);
    }
1330068
public function xorBits(self $other) : void
    {
        $bitsLength = count($this->bits);
        $otherBits  = $other->getBitArray();

        if ($bitsLength !== count($otherBits)) {
            throw new InvalidArgumentException('Sizes don\'t match');
        }

        for ($i = 0; $i < $bitsLength; ++$i) {
            $this->bits[$i] = $this->bits[$i] ^ $otherBits[$i];
        }
    }