diff --git a/c/allergies/src/allergies.c b/c/allergies/src/allergies.c index 9a879ae..d469726 100644 --- a/c/allergies/src/allergies.c +++ b/c/allergies/src/allergies.c @@ -1,9 +1,11 @@ #include "allergies.h" +#ifdef USE_ALLERGIC_TO_FUNCTION bool is_allergic_to(const allergen_t all, const uint32_t val) { return !!(val & (1 << all)); } +#endif allergen_list_t get_allergens(uint32_t val) { diff --git a/c/allergies/src/allergies.h b/c/allergies/src/allergies.h index bb42ebb..5a8e122 100644 --- a/c/allergies/src/allergies.h +++ b/c/allergies/src/allergies.h @@ -21,9 +21,13 @@ typedef struct { bool allergens[ALLERGEN_COUNT]; } allergen_list_t; -// We could use macro... -// #define is_allergic_to(allerg, val) (!!((val) & (1 << (allerg)))) +// We can choose macro or function +#ifdef USE_ALLERGIC_TO_FUNCTION bool is_allergic_to(const allergen_t allergen, const uint32_t value); +#else +#define is_allergic_to(allerg, val) (!!((val) & (1 << (allerg)))) +#endif + allergen_list_t get_allergens(uint32_t value); /* See GNUmakefile below for explanation diff --git a/c/templates/ex.h b/c/templates/ex.h index 3c82085..7517664 100644 --- a/c/templates/ex.h +++ b/c/templates/ex.h @@ -5,6 +5,7 @@ #include #include #endif + #ifdef TESTALL #undef TEST_IGNORE #define TEST_IGNORE() {}