Sha256: 3e235231127c3e10498b53a9a21cfe102f5c50b2a12f641e6bf282e99ea978b0

Contents?: true

Size: 1.96 KB

Versions: 12

Compression:

Stored size: 1.96 KB

Contents

o:$YARD::CodeObjects::MethodObject:
@name:[]:@docstringIC:YARD::Docstring"Bit Reference---Returns the <em>n</em>th bit in the binary
representation of <i>fix</i>, where <i>fix</i>[0] is the least
significant bit.

   a = 0b11001100101010
   30.downto(0) do |n| print a[n] end

<em>produces:</em>

   0000000000000000011001100101010
:@objectu:YARD::StubProxyFixnum#[]:
@summary0:	@all"%Bit Reference---Returns the <em>n</em>th bit in the binary
representation of <i>fix</i>, where <i>fix</i>[0] is the least
significant bit.

   a = 0b11001100101010
   30.downto(0) do |n| print a[n] end

<em>produces:</em>

   0000000000000000011001100101010


@overload [](n)
  @return [0,  1]:@ref_tags[:
@tags[o:YARD::Tags::OverloadTag
;
u;Fixnum#[];;;IC;	"
;
u;Fixnum#[];0;
"@return [0,  1];[;[o:YARD::Tags::Tag
;
0;0:@types["0"1:
@text":@tag_name"return;0:@parameters[[:n0;0:@signature"
[](n);"
overload:@current_file_has_commentsF:@scope:
instance;[:@docstring_extra0:@files[["numeric.c0:@namespaceu;Fixnum:
@path"Fixnum#[];[:@visibility:public:@source"r/*
 *  call-seq:
 *     fix[n]     => 0, 1
 *
 *  Bit Reference---Returns the <em>n</em>th bit in the binary
 *  representation of <i>fix</i>, where <i>fix</i>[0] is the least
 *  significant bit.
 *
 *     a = 0b11001100101010
 *     30.downto(0) do |n| print a[n] end
 *
 *  <em>produces:</em>
 *
 *     0000000000000000011001100101010
 */

static VALUE
fix_aref(fix, idx)
    VALUE fix, idx;
{
    long val = FIX2LONG(fix);
    long i;

    if (!FIXNUM_P(idx = fix_coerce(idx))) {
    idx = rb_big_norm(idx);
    if (!FIXNUM_P(idx)) {
        if (!RBIGNUM(idx)->sign || val >= 0)
        return INT2FIX(0);
        return INT2FIX(1);
    }
    }
    i = FIX2LONG(idx);

    if (i < 0) return INT2FIX(0);
    if (sizeof(VALUE)*CHAR_BIT-1 < i) {
    if (val < 0) return INT2FIX(1);
    return INT2FIX(0);
    }
    if (val & (1L<<i))
    return INT2FIX(1);
    return INT2FIX(0);
}:@source_type:c

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
pry-doc-0.4.4 lib/pry-doc/core_docs_18/objects/Fixnum/_5B_5D_i.dat
pry-doc-0.4.3 lib/pry-doc/core_docs_18/objects/Fixnum/_5B_5D_i.dat
pry-doc-0.4.2 lib/pry-doc/core_docs_18/objects/Fixnum/_5B_5D_i.dat
pry-doc-0.4.1 lib/pry-doc/core_docs_18/objects/Fixnum/_5B_5D_i.dat
pry-doc-0.4.0 lib/pry-doc/core_docs_18/objects/Fixnum/_5B_5D_i.dat
pry-doc-0.3.0 lib/pry-doc/core_docs_18/objects/Fixnum/_5B_5D_i.dat
pry-doc-0.2.4pre1 lib/pry-doc/core_docs_18/objects/Fixnum/_5B_5D_i.dat
pry-doc-0.2.3pre1 lib/pry-doc/core_docs_18/objects/Fixnum/_5B_5D_i.dat
pry-doc-0.2.1 lib/pry-doc/core_docs_18/objects/Fixnum/_5B_5D_i.dat
pry-doc-0.2.0 lib/pry-doc/core_docs_18/objects/Fixnum/_5B_5D_i.dat
pry-doc-0.1.5pre1 lib/pry-doc/core_docs_18/objects/Fixnum/_5B_5D_i.dat
pry-0.6.9pre1-i386-mingw32 lib/pry/core_docs_18/objects/Fixnum/_5B_5D_i.dat