What happens when there is a NOT (~) on a bit shift operation

Viewed 21

Just looking for some clarification on this homework question

The bitshift operation is ((1010 & ~(1 << 3))

So it's a left shift by 3 which would then be 0000, but with a the not, would it become 1111?

1 Answers

1 << 3 is not 0000, it's 1000. Complementing that yields 0111, which then you AND with 1010:

  1010
& 0111
------
  0010
Related