I compute
c = a 'OR' b // bitwise OR operation here
Now given only values of c
and b
how can I compute the original value of a
?
I compute
c = a 'OR' b // bitwise OR operation here
Now given only values of c
and b
how can I compute the original value of a
?
This is impossible.
A simple case to demonstrate my point (assuming a, b, and c are all 1-bit):
If 'b' is 1, 'c' will always be 1, you cannot determine the value of 'a'.
That's not possible. There is no way to determine what 'a' will be
You cannot reliably go back. For example, a = 0010 and b = 0011. a OR b = 0011. The same result is true if a was different (0001 or 0011 for example).
from a mathematic point of view it is just not possible to deduce A from C and B. if, for the nth bit you have the value 1 in C and in B you can't know if the nth bit in A equals 0 or 1
Since a OR 1 is always 1 and a OR 0 is always a you can only find the value of a if b is 0.
Edit: AND and OR are lossy operations (cannot always be reversed). Whereas XOR and NOT are lossless/reversible.
That's not possible, the or operation is not reversible. There are many different values of a that give the same value for c.
You can get one possible value of a by doing an and operation with the complement of b.
a = c & ~b