I noticed that when using bitX() fields, the generated code changes the bit order depending on the selected endianness.
With .endianness("little"):
vars.b1 = $tmp0 >> 0 & 0x1;
vars.b2 = $tmp0 >> 1 & 0x1;
vars.b3 = $tmp0 >> 2 & 0x1;
vars.b4 = $tmp0 >> 3 & 0x1;
With .endianness("big"):
vars.b1 = $tmp0 >> 7 & 0x1;
vars.b2 = $tmp0 >> 6 & 0x1;
vars.b3 = $tmp0 >> 5 & 0x1;
vars.b4 = $tmp0 >> 4 & 0x1;
Since bit fields are extracted from a single byte (getUint8), and endianness typically affects only multi-byte values (e.g., uint16, uint32), I would not expect bit order within a byte to change.
Is this behavior intentional?
Why does endianness affect the order of bits inside a single byte?