Skip to content

Instantly share code, notes, and snippets.

@komori-n
Created July 9, 2020 12:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save komori-n/9e4d290618982cba573a546c14215d41 to your computer and use it in GitHub Desktop.
Save komori-n/9e4d290618982cba573a546c14215d41 to your computer and use it in GitHub Desktop.
#define A 0
#define B 1
#define CFG_1_MODE A
#define CFG_2_MODE B
#define CFG_3_MODE A
#define EXPAND(i) IMPL_TMP(CFG_##i##_MODE)(i)
#define IMPL_TMP(mode) IMPL_CAT(mode)
#define IMPL_CAT(mode) IMPL_##mode
#define IMPL_0 IMPL_A
#define IMPL_1 IMPL_B
EXPAND(1)
EXPAND(2)
EXPAND(3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment