Skip to content
Snippets Groups Projects
Verified Commit 5eeecf57 authored by raphael.bach's avatar raphael.bach
Browse files

Add `FMPI_PRIV_FUTHARK_FUNC_IDX()`

parent c78d69f5
No related branches found
No related tags found
No related merge requests found
......@@ -42,8 +42,11 @@ struct fmpi_futhark_ctx;
#define FMPI_FUTHARK_TYPES \
FMPI_TYPE_REAL
#define FMPI_PRIV_FUTHARK_FUNC_IDX(d, t) \
(((t) * FMPI_DIM_MAX) + (d) - 1)
#define FMPI_PRIV_FUTHARK_ARRAY_ENTRY(D, T) \
[FMPI_TYPE_##T * (FMPI_DIM_MAX) + ((D)-1)] = fmpi_futhark_new_##D##d_##T
[FMPI_PRIV_FUTHARK_FUNC_IDX(D, FMPI_TYPE_##T)] = fmpi_futhark_new_##D##d_##T
#define FMPI_FUTHARK_ARRAY_ENTRY_LIST(D) \
CPL_MAP_FIXED(FMPI_PRIV_FUTHARK_ARRAY_ENTRY, CPL_COMMA, (D), FMPI_FUTHARK_TYPES)
......
......@@ -148,7 +148,7 @@ void * fmpi_futhark_new_data(
assert(ctx != NULL);
assert(data != NULL);
assert(dim_cnt <= FMPI_DIM_MAX);
const size_t idx = (type * (FMPI_DIM_MAX) + ((dim_cnt)-1));
const size_t idx = FMPI_PRIV_FUTHARK_FUNC_IDX(dim_cnt, type);
return fmpi_futhark_new_data_func_list[idx](ctx, data, x, y, z);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment