public Method

Fixnum.>>(p1)

fix >> count      integer

Shifts fix right count positions (left if count is negative).

Source Code

/*
* call-seq:
*   fix >> count     => integer
*
* Shifts _fix_ right _count_ positions (left if _count_ is negative).
*/

static VALUE
rb_fix_rshift(x, y)
   VALUE x, y;
{
   long i, val;

   val = FIX2LONG(x);
   if (!FIXNUM_P(y))
       return rb_big_rshift(rb_int2big(val), y);
   i = FIX2LONG(y);
   if (i == 0) return x;
   if (i < 0)
       return fix_lshift(val, (unsigned long)-i);
   return fix_rshift(val, i);
}
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.