| Message |
*ahem* I think I know how a bit-based flag system works. :) I'm not sure why they found it necessary to give the bitmasks letters... but, whatever.
Ints aren't as small as you think. I think you're not quite sure how these flags work. They are bitmasks. The number you gave just happens to be, in binary: 1000000000000000000. And if you look at R, lo and behold, it will be: 100000000000000000. Every time your letters move down (silly notation, BVxx or BMxx is much better) you will lose one zero in binary.
When you combine flags, for instance: 1 (1) and 2 (10), you get in binary 11.
So, if you were to combine from A to S, you get in binary: 1111111111111111111, which is 524,287 in decimal.
The maximum value for integers is 4294967296, assuming unsigned integers. You're probably using signed integers, in which case you "only" have 2,147,483,648. If 2 billion is "tiny" for you, I wonder what big is! That being said, the numeric decimal size of the integer is basically worthless; here we are only interested in the bits.
In any case you have two options. Either you stick with a bitmask system and go from 32-bit integers to 64-bit integers (long long on Unix, __int64 on Windows)... or you get rid of the bitmask system, and use something else (an array of bools, for example, or even smarter, a custom data structure that uses an array of integer bitmasks.) In the bitmask system, you are *always* limited to the number of bits you have available. 32-bit integers will provide no more than 32 flags. That's just the way it is. And if you use 64-bit integers, you will have no more than 64. |
David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone
http://david.the-haleys.org | top |
|