> What is this 128 bit deal? What does it do? I seen it on the ftp site, and > now in here. Its bugging me. A common use for keeping track of large numbers of options (preferences, etc) is using "bitflags". The idea is, since an "int" is (usually) 32 bits, you can set each bit individually, and since you know which ones mean what, you can store 32 distinct settings within one int. This is to save space and also allows cool things like checking multiple settings with one statement, etc. So how does this work? Ok define an integer: int test_bits=0; The bits are numbered 0 .. 31, so say you want to set bit 0.. so you do this: test_bits |= (1 << 0); (1 << 0) tells the compiler to shift the number one left zero places, so it basically just returns the number one (which in binary is 00000...001, one bit set) If you wanted bit 13, you'd have used (1 << 13) |= says, take test_bits, "or" it with 00000..001 and set it to the result. So all this does is turn on bit 0. Then, if you want to see if bit 0 is set, you can do the opposite: if (test_bits & (1 << 0)) ... the single & is a bitwise "and", and returns true only if all the bits set on the right operand are set on the left. The problem you encounter is, depending on what platform you use, about the biggest entity you can get is 32 or 64 bits (a long long). If you want to have more than 64 affect flags (or whatever) you need some workaround, hence 128-bitflags (or others). Hope this helps.. if not, feel free to mail me off the list and I'll try to be more thorough.. -alex -- +---------------------------------------------------------------+ | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html | | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html | | Newbie List: http://groups.yahoo.com/group/circle-newbies/ | +---------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 06/25/03 PDT