c_src/hyper_carray.c
/*
 * Encode the given hyper_carray as an Erlang binary.
 */
Encode the given hyper_carray as an Erlang binary.
Encode the given hyper_carray as an Erlang binary .
static ERL_NIF_TERM encode_registers(ErlNifEnv * env, int argc,
				     const ERL_NIF_TERM argv[])
{
	carray_ptr arr = NULL;
	HYPER_CARRAY_OR_BADARG(argv[0], arr);
	size_t nbytes = arr->size;
	ERL_NIF_TERM bin;
	unsigned char *buf = enif_make_new_binary(env, nbytes, &bin);
	memcpy(buf, arr->items, nbytes);
	return bin;
}
static ERL_NIF_TERM encode_registers ( ErlNifEnv * env , int argc , const ERL_NIF_TERM argv [ ] ) { carray_ptr arr = NULL ; HYPER_CARRAY_OR_BADARG ( argv [ 0 ] , arr ) ; size_t nbytes = arr -> size ; ERL_NIF_TERM bin ; unsigned char * buf = enif_make_new_binary ( env , nbytes , & bin ) ; memcpy ( buf , arr -> items , nbytes ) ; return bin ; }
Encode the given hyper_carray as an Erlang binary.
Encode the given hyper_carray as an Erlang binary .