c_src/hyper_carray.c
/*
 * Allocate a new hyper_carray for use as an Erlang NIF resource.
 */
Allocate a new hyper_carray for use as an Erlang NIF resource.
Allocate a new hyper_carray for use as an Erlang NIF resource .
static void carray_alloc(unsigned int precision, carray_ptr * arr)
{
	unsigned int nitems = pow(2, precision);
	size_t header_size = HYPER_CARRAY_SIZE;
	size_t res_size = header_size + nitems;
	void *res = enif_alloc_resource(carray_resource, res_size);
	*arr = res;
	memset(*arr, 0, header_size);
	(*arr)->precision = precision;
	(*arr)->size = nitems;
	(*arr)->items = res + header_size;
}
static void carray_alloc ( unsigned int precision , carray_ptr * arr ) { unsigned int nitems = pow ( 2 , precision ) ; size_t header_size = HYPER_CARRAY_SIZE ; size_t res_size = header_size + nitems ; void * res = enif_alloc_resource ( carray_resource , res_size ) ; * arr = res ; memset ( * arr , 0 , header_size ) ; ( * arr ) -> precision = precision ; ( * arr ) -> size = nitems ; ( * arr ) -> items = res + header_size ; }
Allocate a new hyper_carray for use as an Erlang NIF resource.
Allocate a new hyper_carray for use as an Erlang NIF resource .