Created
October 8, 2013 13:41
-
-
Save pierrejoye/6884858 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#define flag1 1<<0 | |
#define flag2 1<<1 | |
#define flag3 1<<2 | |
#define flag4 1<<3 | |
long arg1 = flag1|flag2; | |
long arg2 = flag1|flag4; | |
printf("%i %i %i %i \n", flag1, flag2, flag3, flag4); | |
printf("%i %i %i %i \n", flag1|flag2, flag1|flag4); | |
if (arg1 & (flag1)) { | |
printf("b1 set\n"); | |
} | |
if (arg1 & (flag2)) { | |
printf("b2 set\n"); | |
} | |
if (arg1 & (flag3)) { | |
printf("b3 set\n"); | |
} | |
if (arg1 & (flag4)) { | |
printf("b4 set\n"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment