Method: Integer#^

Defined in:
numeric.c

#^(other) ⇒ Integer

Bitwise EXCLUSIVE OR; each bit in the result is 1 if the corresponding bits in self and other are different, 0 otherwise:

"%04b" % (0b0101 ^ 0b0110) # => "0011"

Raises an exception if other is not an Integer.

Related: Integer#& (bitwise AND), Integer#| (bitwise OR).

Returns:



5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
# File 'numeric.c', line 5118

static VALUE
int_xor(VALUE x, VALUE y)
{
    if (FIXNUM_P(x)) {
        return fix_xor(x, y);
    }
    else if (RB_BIGNUM_TYPE_P(x)) {
        return rb_big_xor(x, y);
    }
    return Qnil;
}