Binary operations 1011 & (~0 << 2)

1.4k Views Asked by At

My thought process to solving this is that 1011 & (~0 << 2) = 1011 & (1 << 2) = 1011 & 0100 = 0000. But my book says the answer is 1000, what am I doing wrong?

1

There are 1 best solutions below

0
On BEST ANSWER

This is not really a mathematics question...

If we assume for example a 16 bit word size, then $\sim\!0=1111\,1111\,1111\,1111$ and $(\sim\!0 <\!< 2) = 1111\,1111\,1111\,1100$. The rest should be clear.