Re: Bitvectors

From: Edward Glamkowski (EGlamkowski@MATHEMATICA-MPR.COM)
Date: 02/16/98


Its a structure in which you address individual bits.
Something like:

struct bitfield {
  bit0  unsigned:1;
  bit1  unsigned:1;
  flag  unsigned:3;
} some_variable;

In this case, the structure is 5 bits long, where bit0 and bit1 are
one bit long, and flag is 3 bits long.
You can add as many bits as you want to the structure (well, there
*is* some limit, but you will never reach it ;)  and each member can
be as many bits long as you want.  For AFF_xxx bits, they will all
most likely be one bit long, since you only need 1 or 0, either you
are effected or you aren't.

Manipulating bitfields is a bit trickier than bitvectors.
I suggest finding a good book that has examples ;)
Or, look at the the bitfield source on the ftp site.  It is based on
patch level 8, so isn't ideal to start with, however...


Edward Glamkowski, Programmer           Mathematica Policy Research
EGlamkowski@mathematic-MPR.COM          Princeton, NJ
                http://www.mathematica-mpr.com/

"We simply cannot deny the existance of metaphores - not even the bad
ones!"
                        (hat) A Halo Called Fred

>----------
>From:  Price Hall[SMTP:phall@DUFUS.CC.WESTGA.EDU]
>Sent:  Monday, February 16, 1998 8:40 AM
>To:    CIRCLE@POST.QUEENSU.CA
>Subject:       Re:  Bitvectors
>
>>
>> Bitfields!
>> I haven't been able to work on a bitfields patch as my computer
>> has been in the shop the past couple of days :(
>
>What ARE bitfields?  I proudly proclaim my ignorance!  I assume its, uh, a
>field...of bits...but then...isn't everything? heheh
>
>Educate me :)
>
>-Maxx
>
>
>     +------------------------------------------------------------+
>     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
>     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
>     +------------------------------------------------------------+
>


     +------------------------------------------------------------+
     | 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