ext/cumo/narray/gen/tmpl_bit/store_array.c in cumo-0.1.0 vs ext/cumo/narray/gen/tmpl_bit/store_array.c in cumo-0.1.1

- old
+ new

@@ -1,26 +1,26 @@ static void -<%=c_iter%>(na_loop_t *const lp) +<%=c_iter%>(cumo_na_loop_t *const lp) { size_t i, n; size_t i1, n1; VALUE v1, *ptr; - BIT_DIGIT *a1; + CUMO_BIT_DIGIT *a1; size_t p1; size_t s1, *idx1; VALUE x; double y; - BIT_DIGIT z; + CUMO_BIT_DIGIT z; size_t len, c; double beg, step; // TODO(sonots): CUDA kernelize - SHOW_SYNCHRONIZE_FIXME_WARNING_ONCE("<%=name%>", "<%=type_name%>"); + CUMO_SHOW_SYNCHRONIZE_FIXME_WARNING_ONCE("<%=name%>", "<%=type_name%>"); cumo_cuda_runtime_check_status(cudaDeviceSynchronize()); - INIT_COUNTER(lp, n); - INIT_PTR_BIT_IDX(lp, 0, a1, p1, s1, idx1); + CUMO_INIT_COUNTER(lp, n); + CUMO_INIT_PTR_BIT_IDX(lp, 0, a1, p1, s1, idx1); v1 = lp->args[1].value; i = 0; if (lp->args[1].ptr) { if (v1 == Qtrue) { @@ -50,59 +50,59 @@ } if (idx1) { for (i=i1=0; i1<n1 && i<n; i++,i1++) { x = ptr[i1]; - if (rb_obj_is_kind_of(x, rb_cRange) || rb_obj_is_kind_of(x, na_cStep)) { - nary_step_sequence(x,&len,&beg,&step); + if (rb_obj_is_kind_of(x, rb_cRange) || rb_obj_is_kind_of(x, cumo_na_cStep)) { + cumo_na_step_sequence(x,&len,&beg,&step); for (c=0; c<len && i<n; c++,i++) { y = beg + step * c; z = m_from_double(y); - STORE_BIT(a1, p1+*idx1, z); idx1++; + CUMO_STORE_BIT(a1, p1+*idx1, z); idx1++; } } if (TYPE(x) != T_ARRAY) { if (x == Qnil) x = INT2FIX(0); z = m_num_to_data(x); - STORE_BIT(a1, p1+*idx1, z); idx1++; + CUMO_STORE_BIT(a1, p1+*idx1, z); idx1++; } } } else { for (i=i1=0; i1<n1 && i<n; i++,i1++) { x = ptr[i1]; - if (rb_obj_is_kind_of(x, rb_cRange) || rb_obj_is_kind_of(x, na_cStep)) { - nary_step_sequence(x,&len,&beg,&step); + if (rb_obj_is_kind_of(x, rb_cRange) || rb_obj_is_kind_of(x, cumo_na_cStep)) { + cumo_na_step_sequence(x,&len,&beg,&step); for (c=0; c<len && i<n; c++,i++) { y = beg + step * c; z = m_from_double(y); - STORE_BIT(a1, p1, z); p1+=s1; + CUMO_STORE_BIT(a1, p1, z); p1+=s1; } } if (TYPE(x) != T_ARRAY) { z = m_num_to_data(x); - STORE_BIT(a1, p1, z); p1+=s1; + CUMO_STORE_BIT(a1, p1, z); p1+=s1; } } } loop_end: z = m_zero; if (idx1) { for (; i<n; i++) { - STORE_BIT(a1, p1+*idx1, z); idx1++; + CUMO_STORE_BIT(a1, p1+*idx1, z); idx1++; } } else { for (; i<n; i++) { - STORE_BIT(a1, p1, z); p1+=s1; + CUMO_STORE_BIT(a1, p1, z); p1+=s1; } } } static VALUE <%=c_func(:nodef)%>(VALUE self, VALUE rary) { - ndfunc_arg_in_t ain[2] = {{OVERWRITE,0}, {rb_cArray,0}}; - ndfunc_t ndf = {<%=c_iter%>, FULL_LOOP, 2, 0, ain, 0}; + cumo_ndfunc_arg_in_t ain[2] = {{CUMO_OVERWRITE,0}, {rb_cArray,0}}; + cumo_ndfunc_t ndf = {<%=c_iter%>, CUMO_FULL_LOOP, 2, 0, ain, 0}; - na_ndloop_store_rarray(&ndf, self, rary); + cumo_na_ndloop_store_rarray(&ndf, self, rary); return self; }