TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: HERMAN SCHONFELD
from: CAMERON CLARK
date: 1997-05-01 23:32: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;
    Why not do bit-wise manipulation and create a bit_array class?
    Allocate a buffer of char (you may have 7 wasted bits) and calculate
    which character has the 31st bit and the offset of that bit within
    that char. Overload the [] operator and walla: You can know store
    8 boolean values per character. 800 booleans = 100 bytes(?)
--- GEcho 1.00
---------------
* Origin: Digital OnLine Magazine! - (409)838-8237 (1:3811/350)

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™.