Sha256: a93d4808b4445e55866d76059e1abacb18ce181a7da9d0163efccfe01509bd78
Contents?: true
Size: 835 Bytes
Versions: 1
Compression:
Stored size: 835 Bytes
Contents
/* Extract an element only if self is a dimensionless NArray. @overload extract @return [Numeric,Cumo::NArray] --- Extract element value as Ruby Object if self is a dimensionless NArray, otherwise returns self. */ // TODO(sonots): Return Cumo::Bit instead of ruby built-in object to avoid synchronization static VALUE <%=c_func(0)%>(VALUE self) { BIT_DIGIT *ptr, val; size_t pos; narray_t *na; GetNArray(self,na); if (na->ndim==0) { pos = na_get_offset(self); ptr = (BIT_DIGIT*)na_get_pointer_for_read(self); SHOW_SYNCHRONIZE_WARNING_ONCE("<%=name%>", "<%=type_name%>"); cumo_cuda_runtime_check_status(cudaDeviceSynchronize()); val = ((*((ptr)+(pos)/NB)) >> ((pos)%NB)) & 1u; na_release_lock(self); return INT2FIX(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/extract.c |