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
/* | |
* printbinary.c | |
* | |
* Created on: Mar 11, 2015 | |
* Author: prasadnair | |
*/ | |
/* | |
* printBinary.cpp | |
* | |
* Created on: Mar 11, 2015 | |
* Author: prasadnair | |
*/ | |
#include <stdio.h> | |
#define BYTETOBINARYPATTERN "%d%d%d%d%d%d%d%d" | |
#define BYTETOBINARY(byte) \ | |
(byte & 0x80 ? 1 : 0), \ | |
(byte & 0x40 ? 1 : 0), \ | |
(byte & 0x20 ? 1 : 0), \ | |
(byte & 0x10 ? 1 : 0), \ | |
(byte & 0x08 ? 1 : 0), \ | |
(byte & 0x04 ? 1 : 0), \ | |
(byte & 0x02 ? 1 : 0), \ | |
(byte & 0x01 ? 1 : 0) | |
int main() | |
{ | |
printf("Leading text "BYTETOBINARYPATTERN, BYTETOBINARY(32)); | |
return 0; | |
} |
No comments:
Post a Comment