Thread: item db
View Single Post
  #13  
Old 10-17-2003, 03:32 AM
a_Guest03
Demi-God
 
Join Date: Jun 2002
Posts: 1,693
Default

Trust me; Lethal's way is the best. I've done only minimal programming, and don't know jack about sockets, modules, OS-specific stuff, etc. But when it comes to adding binary values like 10000000 and 00010000 and 00000100 to get 10010100, instead of 1 + 4 + 16 + 64 + 256 + 1012 to get some number I don't feel like calculating, just do it like the man says.

Bit flags are WAY easier than math.

Examples:

11111111 is everything.
11101111 excludes something.
10000000 is only one class.

It's REALLY easy. When you convert these back to decimal, it does the adding of 1, 2, 4, 8, 16, 32, 64, 128. In this case, mine only add up to 255, but you get my drift. Add more binary and you get bigger numbers.
__________________
It's never too late to be something great.
Reply With Quote