Assume that the value of test is 1 or 0. Here I can implement the following if statement using bitwise operators as below.
if (test)
output = a;
else
output = b;
Using bit wise operators
output = (((test << 31) >> 31) & a) | (((test << 31) >> 31) & b);
Now I want to implement the following if statements using bitwise operators.
if (test1)
output = a;
else if (test2)
output = b;
else if (test3)
output = c;
else
output = d;
The values of test1, test2, test3 are either 0 or 1.
Any suggestions to do that ?
!?+is not a bitwise operator.test?