Sha256: 8824b04e4e90f29db37ea2d97e27e9cd1d225e5b211e3915e89812942139f8b9

Contents?: true

Size: 946 Bytes

Versions: 9

Compression:

Stored size: 946 Bytes

Contents

static void
<%=c_iter%>(na_loop_t *const lp)
{
    size_t   i;
    BIT_DIGIT *a1, x=0;
    size_t   p1;
    ssize_t  s1;
    size_t  *idx1;
    VALUE  y;

    INIT_COUNTER(lp, i);
    INIT_PTR_BIT_IDX(lp, 0, a1, p1, s1, idx1);
    if (idx1) {
        for (; i--;) {
            LOAD_BIT(a1, p1+*idx1, x); idx1++;
            y = m_data_to_num(x);
            rb_yield(y);
        }
    } else {
        for (; i--;) {
            LOAD_BIT(a1, p1, x); p1+=s1;
            y = m_data_to_num(x);
            rb_yield(y);
        }
    }
}

/*
  Calls the given block once for each element in self,
  passing that element as a parameter.
  @overload <%=name%>
  @return [Numo::NArray] self
  For a block {|x| ... }
  @yield [x]  x is element of NArray.
*/
static VALUE
<%=c_func(0)%>(VALUE self)
{
    ndfunc_arg_in_t ain[1] = {{Qnil,0}};
    ndfunc_t ndf = {<%=c_iter%>, FULL_LOOP_NIP, 1,0, ain,0};

    na_ndloop(&ndf, 1, self);
    return self;
}

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
numo-narray-0.9.2.1 ext/numo/narray/gen/tmpl_bit/each.c
numo-narray-0.9.2.0 ext/numo/narray/gen/tmpl_bit/each.c
numo-narray-0.9.1.9 ext/numo/narray/gen/tmpl_bit/each.c
numo-narray-0.9.1.8 ext/numo/narray/gen/tmpl_bit/each.c
numo-narray-0.9.1.7 ext/numo/narray/gen/tmpl_bit/each.c
numo-narray-0.9.1.6 ext/numo/narray/gen/tmpl_bit/each.c
numo-narray-0.9.1.5 ext/numo/narray/gen/tmpl_bit/each.c
numo-narray-0.9.1.4 ext/numo/narray/gen/tmpl_bit/each.c
numo-narray-0.9.1.3 ext/numo/narray/gen/tmpl_bit/each.c