Method: Integer#&
- Defined in:
- numeric.c
#&(other) ⇒ Integer
Bitwise AND; each bit in the result is 1 if both corresponding bits in self and other are 1, 0 otherwise:
"%04b" % (0b0101 & 0b0110) # => "0100"
Raises an exception if other is not an Integer.
Related: Integer#| (bitwise OR), Integer#^ (bitwise EXCLUSIVE OR).
5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 |
# File 'numeric.c', line 5034 VALUE rb_int_and(VALUE x, VALUE y) { if (FIXNUM_P(x)) { return fix_and(x, y); } else if (RB_BIGNUM_TYPE_P(x)) { return rb_big_and(x, y); } return Qnil; } |