Hi Pali,

On Sun, Feb 13, 2022 at 1:33 PM Marek Behún <marek.be...@nic.cz> wrote:
>
> On Sun, 13 Feb 2022 22:23:10 +0100
> Pali Rohár <p...@kernel.org> wrote:
>
> > > In that case the whole ternary operator can be dropped, i.e. instead of
> > >   ((hdr->ext > 1) ? (hdr->ext * 0x20) : 0)
> > > you can have
> > >   ((hdr->ext - 1) * 0x20)
> > > if I interpret this correctly.
> >
> > No, it cannot be dropped, with correction it is:
> >
> >    ((hdr->ext > 1) ? ((hdr->ext - 1) * 0x20) : 0)
> >
> > When hdr->ext is zero, result must be also 0, not (uint8_t)-1 * 0x20.
>
> Oh, so hdr->ext can be zero. OK.
>
> So you can drop at least the "> 1":
>   hdr->ext ? ((hdr->ext - 1) * 0x20) : 0
> but that is almost as horrible as with "> 1", so you can keep it if you
> want :)
>
> Marek
>

Thanks for the patch! I'll give it a try.

Tony

Reply via email to