Ruby Newbie homepage Ruby Newbie homepage

How to use

Quick guide

Official content
Returns true if any bit that is set (=1) in mask is also set in self; returns false otherwise.
Example values:
0b10000010  self
0b11111111  mask
0b10000010  self & mask
      true  self.anybits?(mask)

0b00000000  self
0b11111111  mask
0b00000000  self & mask
     false  self.anybits?(mask)
               static VALUE
int_anybits_p(VALUE num, VALUE mask)
    mask = rb_to_int(mask);
    return int_zero_p(rb_int_and(num, mask)) ? Qfalse : Qtrue;

Was this page useful?