I have just finished writing a tutorial on bit flags, and how to manipulate them for your advantage. The link is here:
http://members.byond.com/UnknownPerson/files/bitflags.html
Hopefully people will realise the advantages to bit flags, and learn about them.
Any comments or questions are welcome to the comments box.
[edit] 20/1/06
Since the article was added to BYONDscape recently, disregard the above link and go to this link instead. It is a revised version:
http://www.byondscape.com/ascape.dmb/UnknownPerson.2005-1231/
Copyright © 2025 BYOND Software.
All rights reserved.
2. Your exclusive or description is very confusing:
"If the bits are on, the resulting bit is turned on. Otherwise, it is off. This includes if both of them are on."
Perhaps something like this: "If both bits you're comparing are the same, the result is 0. "
3. You small example in DM code for complement is wrong. ~5 is definitely not 12, but rather 65530 for 16 bit numbers. :)