Hi can someone please help me understand how to set or rest certain bits. i believe it is known as masking but unsure how to proceed. I would be grateful for any help with my studies. The question is:
Given numbers a) 01111001 and b) 10001010.
What 8 bit binary number would you use to RESET bits 6 and bits 0 of number a) and what logical operation would you use?
What 8 bit binary number would you use to SET bits 5 and bits 2 of number b) and what logical operation would you use?
I assume:
To reset a bit, you have to use the $AND$ operation with a mask where the affected bit is set to $0$ and all other bits are set to $1$:
To set a bit, you have to use the $OR$ operation with a mask where the affected bit is set to $1$ and all other bits are set to $0$: