I found a couple of lines in apples sample codes for SpriteKit
static const uint32_t missileCategory = 0x1 << 0;
I know what static const
is but what is an uint32_t
and what does 0x1 << 0
mean? is it some sort of hex?
<<
is bitwise left shift (multiply by 2) operator.
<< 0
is the same as *1
So equivalent statement would be:
static const uint32_t missileCategory = 0x1;
I wrote more on this here.
For example:
0x1 << 4
would return 0x10
.
Looking at it binary:
00000001 << 4 = 00010000
Decimaly speaking this would mean 1 * 2 * 2 * 2 * 2
or 1 * 2^4
And since this is uint32_t
value it would actualy be
0x00000010
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With