c_src/hyper_carray.c
/*
 * Create a new hyper_carray resource with all items set to 0.
 */
Create a new hyper_carray resource with all items set to 0.
Create a new hyper_carray resource with all items set to 0 .
static ERL_NIF_TERM new_hyper_carray(ErlNifEnv * env, int argc,
				     const ERL_NIF_TERM argv[])
{
	unsigned int precision = 0;
	if (!enif_get_uint(env, argv[0], &precision))
		return enif_make_badarg(env);
	carray_ptr arr = NULL;
	carray_alloc(precision, &arr);
	memset(arr->items, 0, arr->size);
	ERL_NIF_TERM erl_res = enif_make_resource(env, arr);
	enif_release_resource(arr);
	return erl_res;
}
static ERL_NIF_TERM new_hyper_carray ( ErlNifEnv * env , int argc , const ERL_NIF_TERM argv [ ] ) { unsigned int precision = 0 ; if ( ! enif_get_uint ( env , argv [ 0 ] , & precision ) ) return enif_make_badarg ( env ) ; carray_ptr arr = NULL ; carray_alloc ( precision , & arr ) ; memset ( arr -> items , 0 , arr -> size ) ; ERL_NIF_TERM erl_res = enif_make_resource ( env , arr ) ; enif_release_resource ( arr ) ; return erl_res ; }
Create a new hyper_carray resource with all items set to 0.
Create a new hyper_carray resource with all items set to 0 .