On Fri, 8 Dec 2023 18:35:58 +0100 Martin Mareš <mj@xxxxxx> wrote: > > +union margin_payload { > > + unsigned int payload : 8; > > + > > + struct caps { > > + bool volt_support : 1; > > + bool ind_up_down_volt : 1; > > + bool ind_left_right_tim : 1; > > + bool sample_report_method : 1; > > + bool ind_error_sampler : 1; > > + } caps; > > + > > + unsigned int timing_steps : 6; > > + unsigned int voltage_steps : 7; > > + unsigned int offset : 7; > > + unsigned int max_lanes : 5; > > + unsigned int sample_rate : 6; > > + > > + struct step_resp { > > + unsigned int err_count : 6; > > + unsigned int status : 2; > > + } step_resp; > > + > > + struct step_tim { > > + unsigned int steps : 6; > > + bool go_left : 1; > > + } step_tim; > > + > > + struct step_volt { > > + unsigned int steps : 7; > > + bool go_down : 1; > > + } step_volt; > > + > > +} __attribute__((packed)); > > Please do not assume that every compiler used to compile the pciutils supports > GCC extensions. See lib/sysdep.h for how we handle such things. > > Also, I am not sure that bit fields are good idea: they save a little data > space, but they expand code. I had an idea to use anonymous structures here, which would make field accesses shorter. And actually I would prefer to use bit fields instead of manipulating bits. But looks like it will be hard to implement this approach without using GCC packed feature and make it portable. It seems that I will have to implement the option with a pack of macro wrappers around bit masks. Best regards, Nikita Proshkin