Closed Robbepop closed 3 years ago
For checking whether a #[bitfield] struct is generated to be exactly N bytes big we could add a bytes = N parameter to the #[bitfield] proc. macro. For example for N = 32 a bitfield struct with a bid width of 25 up to 32 bits is going to be valid.
#[bitfield]
N
bytes = N
N = 32
#[bitfield(bytes = 4)] struct TtResp { mregion: u8, sregion: u8, mrvalid: bool, srvalid: bool, r: bool, rw: bool, nsr: bool, nsrw: bool, s: bool, irvalid: bool, iregion: u8, }
For checking whether a
#[bitfield]
struct is generated to be exactlyN
bytes big we could add abytes = N
parameter to the#[bitfield]
proc. macro. For example forN = 32
a bitfield struct with a bid width of 25 up to 32 bits is going to be valid.Example