ext/numo/narray/gen/tmpl_bit/bit_count.c in numo-narray-0.9.1.4 vs ext/numo/narray/gen/tmpl_bit/bit_count.c in numo-narray-0.9.1.5

- old
+ new

@@ -73,13 +73,18 @@ */ static VALUE <%=c_func(-1)%>(int argc, VALUE *argv, VALUE self) { VALUE v, reduce; + narray_t *na; ndfunc_arg_in_t ain[3] = {{cT,0},{sym_reduce,0},{sym_init,0}}; ndfunc_arg_out_t aout[1] = {{numo_cInt64,0}}; ndfunc_t ndf = { <%=c_iter%>, FULL_LOOP_NIP, 3, 1, ain, aout }; + GetNArray(self,na); + if (NA_SIZE(na)==0) { + return INT2FIX(0); + } reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, 0); v = na_ndloop(&ndf, 3, self, reduce, INT2FIX(0)); return rb_funcall(v,rb_intern("extract"),0); }