Re: bitfield advantages

From: Jaco van Iterson (J.C.vanIterson@ET.TUDelft.NL)
Date: 03/13/96


On Mon, 11 Mar 1996, Graham Gilmore wrote:

> 
> 	Instead of declaring the bitfield as a struct, you could use a 
> union instead, and have one of your union members as a single int or long 
> (or long long, if you have a large bitfield.. :);  that way you can use 
> the | operator on the whole thing in one shot without overloading, while 
> still being able to access your bitfields as structure members.  Of 
> course, if you have something like 4 1/2 bytes of bits, this may seem 
> wasteful.
> 
> 	Graham Gilmore
> 
> 

Yep you could use the | operater then, but then you would have the 32 bit
limit again and there is no way of telling how the bits are related between
the (long) int and the bitfield struct.

Jaco



This archive was generated by hypermail 2b30 : 12/07/00 PST