18.09.2010, 11:22
(
Last edited by Kyosaur; 18/09/2010 at 11:43 AM.
)
Quote:
Great tutorial!
Learned alot from it! I still (as I'm only 16 years old) don't know in what situation I can take use of binary, but oh well.. I'll find out sooner or later. Again, amazingly done! |
You can use binary as a way to store multiple bool values (can stuff 31 bools in a single variable) as well. To do this you would use bitwise AND once again to check if the bit is set, and use the exclusive operator to toggle it on and off. Y_less has a pre-written system in YSI which allows you to store more than 31 values (using arrays of course), i haven't personally checked it out yet though.
Off topic: First one to figure out what this macro does wins a high five!
Code:
#define FUNC_NAME(%0) ((%0) & 0x80000000)?(~(%0) + 0b1):(%0)
Edit:
My grammar has gone to hell, i obviously need to get some sleep
![undecided](images/smilies/neutral.gif)
@Hiddos - yes, everything in here can be used in pawn. Also, when using the operators the numbers do not have to be a physical binary number (which in pawn is preceded by "0b" like hex is with "0x" :P) i would hope everyone would already understand after reading my post lol. Things like:
Code:
Tmp = Var << 3; Tmp = Var & 4; Tmp = Var ^ 5; //and Var <<= 3; Var &= 4; Var ^= 5; //etc