From 571bee89d71d1dd07e564ac58d8af7f570497064 Mon Sep 17 00:00:00 2001 From: "raphael.bach" <raphael.bach@etu.hesge.ch> Date: Wed, 22 Jun 2022 23:14:39 +0200 Subject: [PATCH] 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 --- include/internal/generic/fmpi_futhark_generic.h | 8 ++++---- src/fmpi_futhark.c | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/internal/generic/fmpi_futhark_generic.h b/include/internal/generic/fmpi_futhark_generic.h index 139cf0a..cfecb3b 100644 --- a/include/internal/generic/fmpi_futhark_generic.h +++ b/include/internal/generic/fmpi_futhark_generic.h @@ -45,11 +45,11 @@ struct fmpi_futhark_ctx; #define FMPI_PRIV_FUTHARK_FUNC_IDX(d, t) \ (((t) * FMPI_DIM_MAX) + (d) - 1) -#define FMPI_PRIV_FUTHARK_ARRAY_ENTRY(D, T) \ - [FMPI_PRIV_FUTHARK_FUNC_IDX(D, FMPI_TYPE_##T)] = fmpi_futhark_new_##D##d_##T +#define FMPI_PRIV_FUTHARK_FUNC_ENTRY(FUNC, D, T) \ + [FMPI_PRIV_FUTHARK_FUNC_IDX(D, FMPI_TYPE_##T)] = fmpi_futhark_##FUNC##_##D##d_##T -#define FMPI_FUTHARK_ARRAY_ENTRY_LIST(D) \ - CPL_MAP_FIXED(FMPI_PRIV_FUTHARK_ARRAY_ENTRY, CPL_COMMA, (D), FMPI_FUTHARK_TYPES) +#define FMPI_FUTHARK_FUNC_ENTRY_LIST(FUNC, D) \ + 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 // only the last one is returned, allowing to silence warnings about unused diff --git a/src/fmpi_futhark.c b/src/fmpi_futhark.c index 706880c..a76aeb3 100644 --- a/src/fmpi_futhark.c +++ b/src/fmpi_futhark.c @@ -40,9 +40,9 @@ typedef void * (*fmpi_futhark_new_data_func)( size_t x, size_t y, size_t z ); static const fmpi_futhark_new_data_func fmpi_futhark_new_data_func_list[] = { - FMPI_FUTHARK_ARRAY_ENTRY_LIST(1), - FMPI_FUTHARK_ARRAY_ENTRY_LIST(2), - FMPI_FUTHARK_ARRAY_ENTRY_LIST(3) + FMPI_FUTHARK_FUNC_ENTRY_LIST(new, 1), + FMPI_FUTHARK_FUNC_ENTRY_LIST(new, 2), + FMPI_FUTHARK_FUNC_ENTRY_LIST(new, 3) }; /*============================================================================== MACRO -- GitLab