cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
General C++ Programming
Can anyone explain this bit shift to me.
Can anyone explain this bit shift to me...
Oct 14, 2017 at 5:02pm UTC
Darkpony
(4)
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
Oct 14, 2017 at 5:04pm UTC
Oct 14, 2017 at 5:18pm UTC
Repeater
(3046)
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
Oct 14, 2017 at 5:19pm UTC
Oct 15, 2017 at 3:04am UTC
Darkpony
(4)
FUCKING NAILING IT MAN THANKS!!! I totally get it even though 1011 is 11
Last edited on
Oct 15, 2017 at 3:07am UTC
Topic archived. No new replies allowed.