Created
October 2, 2014 04:59
-
-
Save jeradesign/3ad3b1490758af958d29 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 BIT1 0x01 | |
#define BIT2 0x02 | |
#define BIT3 0x04 | |
// ... | |
unsigned char value = 0; | |
if (flag1) { | |
value += BIT1; | |
} | |
if (flag2) { | |
value += BIT2; | |
} | |
if (flag3) { | |
value += BIT3; | |
} | |
NSData *data = [NSData dataWithBytes:&value length:1]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment