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

Refactor `FMPI_PRIV_FUTHARK_ARRAY_ENTRY{_LIST}()` macros

- `FMPI_PRIV_FUTHARK_ARRAY_ENTRY()` => `FMPI_PRIV_FUTHARK_FUNC_ENTRY()`
- `FMPI_PRIV_FUTHARK_ARRAY_ENTRY_LIST()` =>
  `FMPI_FUTHARK_FUNC_ENTRY_LIST()`
- Add `FUNC` parameter to both of the macros
parent 5eeecf57
Branches
No related tags found
No related merge requests found
...@@ -45,11 +45,11 @@ struct fmpi_futhark_ctx; ...@@ -45,11 +45,11 @@ struct fmpi_futhark_ctx;
#define FMPI_PRIV_FUTHARK_FUNC_IDX(d, t) \ #define FMPI_PRIV_FUTHARK_FUNC_IDX(d, t) \
(((t) * FMPI_DIM_MAX) + (d) - 1) (((t) * FMPI_DIM_MAX) + (d) - 1)
#define FMPI_PRIV_FUTHARK_ARRAY_ENTRY(D, T) \ #define FMPI_PRIV_FUTHARK_FUNC_ENTRY(FUNC, D, T) \
[FMPI_PRIV_FUTHARK_FUNC_IDX(D, FMPI_TYPE_##T)] = fmpi_futhark_new_##D##d_##T [FMPI_PRIV_FUTHARK_FUNC_IDX(D, FMPI_TYPE_##T)] = fmpi_futhark_##FUNC##_##D##d_##T
#define FMPI_FUTHARK_ARRAY_ENTRY_LIST(D) \ #define FMPI_FUTHARK_FUNC_ENTRY_LIST(FUNC, D) \
CPL_MAP_FIXED(FMPI_PRIV_FUTHARK_ARRAY_ENTRY, CPL_COMMA, (D), FMPI_FUTHARK_TYPES) CPL_MAP_FIXED(FMPI_PRIV_FUTHARK_FUNC_ENTRY, CPL_COMMA, (FUNC, D), FMPI_FUTHARK_TYPES)
// In a comma separeted list of expressions contained in a pair of parentheses // In a comma separeted list of expressions contained in a pair of parentheses
// only the last one is returned, allowing to silence warnings about unused // only the last one is returned, allowing to silence warnings about unused
......
...@@ -40,9 +40,9 @@ typedef void * (*fmpi_futhark_new_data_func)( ...@@ -40,9 +40,9 @@ typedef void * (*fmpi_futhark_new_data_func)(
size_t x, size_t y, size_t z size_t x, size_t y, size_t z
); );
static const fmpi_futhark_new_data_func fmpi_futhark_new_data_func_list[] = { static const fmpi_futhark_new_data_func fmpi_futhark_new_data_func_list[] = {
FMPI_FUTHARK_ARRAY_ENTRY_LIST(1), FMPI_FUTHARK_FUNC_ENTRY_LIST(new, 1),
FMPI_FUTHARK_ARRAY_ENTRY_LIST(2), FMPI_FUTHARK_FUNC_ENTRY_LIST(new, 2),
FMPI_FUTHARK_ARRAY_ENTRY_LIST(3) FMPI_FUTHARK_FUNC_ENTRY_LIST(new, 3)
}; };
/*============================================================================== /*==============================================================================
MACRO MACRO
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment