What does this line of code do?
I'm just not sure what the << is for. If you are wondering its from a game engine, I don't know if that is relevant or not.Code:#define FL_FLY (1<<0);
Printable View
What does this line of code do?
I'm just not sure what the << is for. If you are wondering its from a game engine, I don't know if that is relevant or not.Code:#define FL_FLY (1<<0);
>#define FL_FLY (1<<0);
defines FL_FLY as 1
the simi colon shouldn't be there though, it could lead to problems, and things like this
int p = FL_FLY
note the lack of a semi colon, this makes the code less readable, and more confusing
and printf("%d", FL_FLY); // is illegal because of the semi colon in the define
the '<<' shifts the bits to the left the specified number of times in this case '0'.
do a search for 'bit manipulation', or 'bit shifting', ect...
And >> is for right shifting, ~ for negation, ^ for xor, & for and, | for or'ing... etc :p