On Wed, 2024-02-28 at 13:36 -0800, Andrii Nakryiko wrote: [...] > I'd say it's not about a number of lines, it's about ease of > understanding, reasoning, and using these helpers. > > I do prefer the code you wrote below, but I'm not going to die on this > hill if you insist. I'll go think about the rest of the logic. Ok, code is meant to be read, so I'll switch to below in v2. [...] > > static u64 linked_reg_set_pack(struct linked_reg_set *s) > > { > > u64 val = 0; > > int i; > > > > for (i = 0; i < s->cnt; ++i) { > > struct reg_or_spill *r = &s->reg_set[i]; > > u64 tmp = 0; > > > > tmp |= r->frameno & ES_FRAMENO_MASK; > > tmp |= (r->spi & ES_SPI_MASK) << ES_SPI_OFF; > > nit: we shouldn't mask anything here, it just makes an impression that > r->frameno can be bigger than we have bits for it in a bitmask Ok, I'll add bitmasks to field definitions and remove masks here. [...]