On Thu, 7 Mar 1996, Brian Pape wrote: > > > I found a bug in the bitfield code. > > > should be changed to: > > > *b &= ~(*c); } > > > > Now I've heard a lot about bitfields recently but I'm mnot exactlyu sure > > what iut is they do. Can someone let me know what advantage bitfields have > > over bitvectors? > > They're the same thing (at least as applied to circle code), it just lets > you store up to (for instance) 32 on/off or true/false (whatever you want > to call it) flags in a 32 bit integer. Technically, you could consider a > 'bit field' to be of a storage field of 1 or more bits, and a bitvector to > be a value holding 'n' bitfields of the same size, but since they aren't > used that way in the circlemud code, you can consider bitfield and > bitvector to be identical. (as in a value holding up to 'n' single-bit > flags). > > Brian Pape > bpape@ezl.com > > You can of course store a bitvector in a bitfield but that wouldn't give you much advantages above using a normal integer to do that (maybe you can use a tiny bit less memory that way). Better use of bitfields would be to make them all the size of 1 bit and put them together in a structure. That way you can have a unlimited number of bits. Every bit(field) is then a variable which can be 0 or 1 tightly packed into a structure. Jaco
This archive was generated by hypermail 2b30 : 12/07/00 PST