Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdint.h> // uint64_t
- #define TSH(a,b) ((uint64_t)(a) << (b * 8))
- #define TAG_1(a) (TSH(a,0))
- #define TAG_2(b,a) (TSH(b,1)|TSH(a,0))
- #define TAG_3(c,b,a) (TSH(c,2)|TSH(b,1)|TSH(a,0))
- #define TAG_4(d,c,b,a) (TSH(d,3)|TSH(c,2)|TSH(b,1)|TSH(a,0))
- #define TAG_5(e,d,c,b,a) (TSH(e,4)|TSH(d,3)|TSH(c,2)|TSH(b,1)|TSH(a,0))
- #define TAG_6(f,e,d,c,b,a) (TSH(f,5)|TSH(e,4)|TSH(d,3)|TSH(c,2)|TSH(b,1)|TSH(a,0))
- #define TAG_7(g,f,e,d,c,b,a) (TSH(g,6)|TSH(f,5)|TSH(e,4)|TSH(d,3)|TSH(c,2)|TSH(b,1)|TSH(a,0))
- #define TAG_8(h,g,f,e,d,c,b,a) (TSH(h,7)|TSH(g,6)|TSH(f,5)|TSH(e,4)|TSH(d,3)|TSH(c,2)|TSH(b,1)|TSH(a,0))
- #define TFN(_1, _2, _3, _4, _5, _6, _7, _8, n, ...) TAG_ ## n
- #define TAG(...) TFN(__VA_ARGS__, 8, 7, 6, 5, 4, 3, 2, 1) (__VA_ARGS__)
- enum {
- TST_ENABLE = TAG('e','n','a','b','l','e'),
- TST_DISABLE = TAG('d','i','s','a','b','l','e')
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement