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;
  • Bitfields Anonymous via Digitalmars-d-learn
    • Re: Bitfiel... Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
      • Re: Bit... Anonymous via Digitalmars-d-learn
        • Re:... Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
        • Re:... monkyyy via Digitalmars-d-learn
        • Re:... Dennis via Digitalmars-d-learn
          • ... Anonymous via Digitalmars-d-learn

Reply via email to