I am learning about masking techniques in C. Here is a practice problem I am working on: Need to find the complement of 0x87654321 while leaving the least significant byte intact which should look like this 0x789ABC21
The only mask I'm familiar with right now is using x & 0xFF to strip all but the last byte. I don't know which bitwise operator to use to get the complement of a hex number. How do I approach that?
My book doesn't explain what a one complement of a hex number is but I googled that and found out the shortcut method to determine a one complement is to take 15 - hexDigit = complement Please correct me if I'm wrong.