Sha256: c606918cc3dfa83b80707ab688ad6a1763e395f61d2e574f9dbde74096f6db96

Contents?: true

Size: 681 Bytes

Versions: 3

Compression:

Stored size: 681 Bytes

Contents

static VALUE
<%=c_func%>(VALUE self)
{
    narray_t *na;
    char *ptr;

    GetNArray(self,na);

    switch(NA_TYPE(na)) {
    case NARRAY_DATA_T:
        ptr = NA_DATA_PTR(na);
        if (na->size > 0 && ptr == NULL) {
            ptr = xmalloc(((na->size-1)/sizeof(BIT_DIGIT)+1)*sizeof(BIT_DIGIT)/8);
            NA_DATA_PTR(na) = ptr;
        }
        break;
    //case NARRAY_FILEMAP_T:
    // to be implemented
    //    ptr = ((narray_filemap_t*)na)->ptr;
    //    break;
    case NARRAY_VIEW_T:
        rb_funcall(NA_VIEW_DATA(na), rb_intern("allocate"), 0);
        break;
    default:
        rb_raise(rb_eRuntimeError,"invalid narray type");
    }
    return self;
}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
numo-narray-0.9.0.3-x86-mingw32 ext/numo/narray/gen/tmpl_bit/allocate.c
numo-narray-0.9.0.3-x64-mingw32 ext/numo/narray/gen/tmpl_bit/allocate.c
numo-narray-0.9.0.3 ext/numo/narray/gen/tmpl_bit/allocate.c