TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: CAMERON CLARK
from: HERMAN SCHONFELD
date: 1997-05-03 23:03:00
subject: Re: Bit Fields

HS> This should expand your knowledge abit..
HS>
HS> struct  bit_field
HS>   {
HS>         int bit0    : 1;
HS>         int bit1    : 1;
HS>         int bit2    : 1;
HS>         int bit3    : 1;
HS>         int bit4    : 1;
HS>         int bit5    : 1;
HS>         int bit6    : 1;
HS>         int bit7    : 1;
CC>    Why not do bit-wise manipulation and create a bit_array class?
CC>    Allocate a buffer of char (you may have 7 wasted bits) and calculate
CC>    which character has the 31st bit and the offset of that bit within
CC>    that char. Overload the [] operator and walla: You can know store
CC>    8 boolean values per character. 800 booleans = 100 bytes(?)
That is what I did.
... A pedestrian hit me and went under my car.
--- Ezycom V1.48g0 01fd016b
---------------
* Origin: Fox's Lair BBS Bris Aus +61-7-38033908 V34+ Node 2 (3:640/238)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.