If I have for example: a = (b << 8) | (c << 4) | d how would I get b c and d from a? Or if I had a and d and needed to get b and c?
1 Answer
Unfortunately there isn't a single solution for a problem like this (unless in very specific cases). The OR operator (|) doesn't have an inverse, so even the simplified problem of:
a = b | c
where a and c are known, is not solvable (at least to get a single solution).
For a more practical example, you can consider something super simple:
11 = 10 | c
then c could either be 11 or 01 and the number of solutions keep growing with the number of bits.
b,c,d? Try doing some examples and writing them in binary.d==a&15andc==(a>>4)&15make sense (15 being 1111 binary). But Henry Twist's answer is right that in general "reverse these bitwise operations" doesn't have a unique solution.