Re: [PATCH 1/9] bitfield: add FIELD_GET_SIGNED()
From: David Laight
Date: Fri Apr 24 2026 - 17:37:42 EST
On Fri, 24 Apr 2026 12:35:51 -0400
Yury Norov <ynorov@xxxxxxxxxx> 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
>