Re: [PATCH 1/9] bitfield: add FIELD_GET_SIGNED()

David Laight
2026-04-24T21:37:20Z

On Fri, 24 Apr 2026 12:35:51 -0400
Yury Norov <ynorov@nvidia.com> wrote:

...
> > Any chance it'd be simple to generate u32_get_bits_signed() etc.? Could
> > be especially useful for le32_get_bits_signed() for example, to have the
> > endian conversion built-in unlike FIELD_GET_SIGNED().
>
> Maybe this:
>
> x = FIELD_GET_SIGNED(mask, le32_to_cpu(reg))

But if you are going to follow it by:
x1 = FIELD_GET_SIGNED(mask1, le32_to_cpu(reg))

you really want to to the byteswap once, best as:
reg = le32_to_cpu(struct->member);

David

>
> Thanks,
> Yury
>