Can anyone explain this bit shift to me...

Suppose I have two integers. Suppose int a = 7 and int b = 3. I know that
a | b will be 0x7 because 0111 and 0011 will be 0111. But why does a|(b <<4) come out to be 0x37?
Last edited on
b = 00000011

so (b << 4) is 00110000

a = 00001011

So what is (a | (b<<4)) ?

1
2
3
4
a    : 00001011
b<<4 : 00110000

       00111011


What is 00111011 in hex? 0x37
Last edited on
FUCKING NAILING IT MAN THANKS!!! I totally get it even though 1011 is 11
Last edited on
Topic archived. No new replies allowed.