Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. #include <stdint.h> // uint64_t
  2.  
  3. #define TSH(a,b) ((uint64_t)(a) << (b * 8))
  4.  
  5. #define TAG_1(a) (TSH(a,0))
  6. #define TAG_2(b,a) (TSH(b,1)|TSH(a,0))
  7. #define TAG_3(c,b,a) (TSH(c,2)|TSH(b,1)|TSH(a,0))
  8. #define TAG_4(d,c,b,a) (TSH(d,3)|TSH(c,2)|TSH(b,1)|TSH(a,0))
  9. #define TAG_5(e,d,c,b,a) (TSH(e,4)|TSH(d,3)|TSH(c,2)|TSH(b,1)|TSH(a,0))
  10. #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))
  11. #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))
  12. #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))
  13.  
  14. #define TFN(_1, _2, _3, _4, _5, _6, _7, _8, n, ...) TAG_ ## n
  15. #define TAG(...) TFN(__VA_ARGS__, 8, 7, 6, 5, 4, 3, 2, 1) (__VA_ARGS__)
  16.  
  17. enum {
  18. TST_ENABLE = TAG('e','n','a','b','l','e'),
  19. TST_DISABLE = TAG('d','i','s','a','b','l','e')
  20. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement