-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
51 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* https://stackoverflow.com/questions/319328 | ||
*/ | ||
#define QUOTE(x...) #x | ||
|
||
#define EMPTY() | ||
#define DEFER(id) id EMPTY() | ||
#define OBSTRUCT(id) id DEFER(EMPTY)() | ||
#define EXPAND(args...) args | ||
#define EAT(args...) | ||
|
||
#define EVAL(args...) EVAL1(EVAL1(EVAL1(args))) | ||
#define EVAL1(args...) EVAL2(EVAL2(EVAL2(args))) | ||
#define EVAL2(args...) EVAL3(EVAL3(EVAL3(args))) | ||
#define EVAL3(args...) EVAL4(EVAL4(EVAL4(args))) | ||
#define EVAL4(args...) EVAL5(EVAL5(EVAL5(args))) | ||
#define EVAL5(args...) args | ||
|
||
#define CAT(a, args...) a ## args | ||
|
||
#define CHECK_N(x, n, args...) n | ||
#define CHECK(args...) CHECK_N(args, 0) | ||
|
||
#define NOT_0 ~, 1, | ||
#define NOT(x) CHECK(CAT(NOT_, x)) | ||
|
||
#define COMPL_0 1 | ||
#define COMPL_1 0 | ||
#define COMPL(b) CAT(COMPL_, b) | ||
|
||
#define BOOL(x) COMPL(NOT(x)) | ||
|
||
#define IIF_0(t, args...) args | ||
#define IIF_1(t, args...) t | ||
#define IIF(c) CAT(IIF_, c) | ||
|
||
#define IF(c) IIF(BOOL(c)) | ||
|
||
#define WHEN(c) IF(c)(EXPAND, EAT) |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters