Skip to content

wrong order of bits in bit fields #307

Description

@AndreaOrru
const VGAEntry = packed struct {
    c:  u8,
    fg: u4,
    bg: u4,
};

Expected bit layout as implemented by C compilers (c = char bits, b = bg bits, f = fg bits):
cccccccc bbbbffff

Zig produces this instead:
cccccccc ffffbbbb

Is this expected behavior?

Metadata

Metadata

Assignees

No one assigned

    Labels

    breakingImplementing this issue could cause existing code to no longer compile or have different behavior.bugObserved behavior contradicts documented or intended behavior

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions