Bitfields

Anonymous anonymous at anonymous.anonymous
Wed Nov 11 17:13:53 UTC 2026


On Tuesday, 10 November 2026 at 15:08:12 UTC, Dennis wrote:
> I would consider using a basic integer for the bit packing, and 
> adding getter methods to access it as the 2 different types 
> like the union fields would.

Yeah, I experimented a bit and came to a similar conclusion. 
Since Node_Type is a union I need only one getter returning 
Node_Type. So I can do `Node.Type` or `Node.Type.Id`. I've been 
trying to figure how to streamline this so I only need to declare 
a single special field or property and nothing else.

P.S. You can't take address of a bitfield:
>Node_Type    Type()    const => *cast(Node_Type*) &Type_storage;


More information about the Digitalmars-d-learn mailing list