On Thu, 23 Feb 2023 13:11:33 +0100 Lorenzo Bianconi wrote: > + if const['type'] == 'flags': > + max_name = c_upper(name_pfx + 'mask') > + max_val = f' = {(entry.user_value() << 1) - 1},' > + cw.p(max_name + max_val) Could you use EnumSet::get_mask instead() ? I think it also needs to be fixed to actually walk the elements and combine the user_value()s rather than count them and assume there are no gaps.