-----Original Message----- From: Matt Lowe <modem-burn@geocities.com> To: CIRCLE@post.queensu.ca <CIRCLE@post.queensu.ca> Date: Saturday, November 28, 1998 11:16 PM Subject: [Newbie] Breaking down bitvectors To breake down a bitvector you subtract and goto the next lowest correct? Let me explaine. Now if we add a, f and j together we get 145. Well the lowest to 145 is j. So lets subtract 128(j's value) and we get 17. Then lets goto the next lowest ... 16. So lets subtract 16. (So far we have got j(128) and f(16)) Now we are left with one which is the same as a. Is this the correct method? This is the way you'd have to work it if you wanted to write something from scratch, but there are tools in C/C++ using bitwise checks and changes that simplify the whole process. This is how the macros IS_SET, REMOVE_BIT, and SET_BIT are derived. Rick +------------------------------------------------------------+ | Ensure that you have read the CircleMUD Mailing List FAQ: | | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html | +------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/15/00 PST