diff --git a/bit-ops.c b/bit-ops.c index f21994d..d671d6e 100644 --- a/bit-ops.c +++ b/bit-ops.c @@ -2,11 +2,24 @@ void do_bit_ops() { unsigned char PTAD = 0x10; - printf("PTAD = %#010x\n", PTAD); + printf("PTAD = %#x\n* OR\n", PTAD); PTAD |= 0x01; - printf("PTAD |= 0x01\t %#010x\n", PTAD); + printf("PTAD |= 0x01 --> %#010x (%#x)\n", PTAD, PTAD); + + printf("----------\n* AND\n"); + printf("PTAD = %#x\n", PTAD=0x1f); PTAD &= 0xfe; - printf("PTAD &= 0xfe\t %#010x\n", PTAD); + printf("PTAD &= 0xfe --> %#010x (%#x)\n", PTAD, PTAD); + + printf("----------\n* NOT\n"); + printf("PTAD = %#x\n", PTAD=0x10); + PTAD = ~PTAD; + printf("PTAD = ~PTAD --> %#010x (%#x)\n", PTAD, PTAD); + + printf("----------\n* XOR\n"); + printf("PTAD = %#x\n", PTAD=0x10); + PTAD ^= 0xfe; + printf("PTAD ^= 0xfe --> %#010x (%#x)\n", PTAD, PTAD); }