Sha256: d4f2b6a2d45462919f3eee5666653fb624ef6fabc44cfcc79a5d25e0eda8d111
Contents?: true
Size: 1.56 KB
Versions: 1
Compression:
Stored size: 1.56 KB
Contents
static void <%=c_iter%>(na_loop_t *const lp) { size_t n; size_t p3; ssize_t s3; size_t *idx3; int len; BIT_DIGIT *a3; BIT_DIGIT y; VALUE x = lp->option; // TODO(sonots): CUDA kernelize SHOW_SYNCHRONIZE_FIXME_WARNING_ONCE("<%=name%>", "<%=type_name%>"); cumo_cuda_runtime_check_status(cudaDeviceSynchronize()); if (x==INT2FIX(0) || x==Qfalse) { y = 0; } else if (x==INT2FIX(1) || x==Qtrue) { y = ~(BIT_DIGIT)0; } else { rb_raise(rb_eArgError, "invalid value for Bit"); } INIT_COUNTER(lp, n); INIT_PTR_BIT_IDX(lp, 0, a3, p3, s3, idx3); if (idx3) { y = y&1; for (; n--;) { STORE_BIT(a3, p3+*idx3, y); idx3++; } } else if (s3!=1) { y = y&1; for (; n--;) { STORE_BIT(a3, p3, y); p3+=s3; } } else { if (p3>0 || n<NB) { len = NB - p3; if ((int)n<len) len=n; *a3 = (y & (SLB(len)<<p3)) | (*a3 & ~(SLB(len)<<p3)); a3++; n -= len; } for (; n>=NB; n-=NB) { *(a3++) = y; } if (n>0) { *a3 = (y & SLB(n)) | (*a3 & BALL<<n); } } } /* Fill elements with other. @overload <%=name%> other @param [Numeric] other @return [Cumo::<%=class_name%>] self. */ static VALUE <%=c_func(1)%>(VALUE self, VALUE val) { ndfunc_arg_in_t ain[2] = {{OVERWRITE,0},{sym_option}}; ndfunc_t ndf = {<%=c_iter%>, FULL_LOOP, 2,0, ain,0}; na_ndloop(&ndf, 2, self, val); return self; }
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
cumo-0.1.0 | ext/cumo/narray/gen/tmpl_bit/fill.c |