/* --- PRINTF_BYTE_TO_BINARY macro's --- */
#define BINARY_PATTERN "%c%c%c%c%c%c%c%c"
#define BYTE_TO_BINARY(i) \
(((i) & 0x80) ? '1' : '0'), \
(((i) & 0x40) ? '1' : '0'), \
(((i) & 0x20) ? '1' : '0'), \
(((i) & 0x10) ? '1' : '0'), \
(((i) & 0x08) ? '1' : '0'), \
(((i) & 0x04) ? '1' : '0'), \
(((i) & 0x02) ? '1' : '0'), \
(((i) & 0x01) ? '1' : '0')
/* --- end macros --- */
#include <stdio.h>
int main() {
// Bit positions
// 76543210
int val1 = 0b00101101;
int val2 = 0b00000000;
int val3 = 0b00101101
| 0b00000000;
printf("result: "
BINARY_PATTERN "\n",
BYTE_TO_BINARY(val3));
return 0;
}