Re: [PATCH] bitfield.h: add FIELD_MAX() and field_max()

From: Jakub Kicinski
Date: Sat Feb 29 2020 - 15:17:09 EST


On Sat, 29 Feb 2020 07:10:45 -0600 Alex Elder wrote:
> I should have actually checked my code before I sent this. Yes
> I am using the macro as I described, to see if something fits.
> But I'm also using it this way:
>
> foo = u32_get_bits(register, FOO_COUNT_FMASK);
> if (foo == field_max(FOO_COUNT_MASK))
> ; /* This has special meaning */
>
> And another way:
>
> size_limit = field_max(FOO_COUNT_MASK) * sizeof(struct foo);
>
> So field_max() is really what I need here.

Makes sense, in that case:

Acked-by: Jakub Kicinski <kuba@xxxxxxxxxx>