kwboot: Marvell Dove UART booting

Marek Behún marek.behun at nic.cz
Sun Feb 13 22:33:20 CET 2022


On Sun, 13 Feb 2022 22:23:10 +0100
Pali Rohár <pali at 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



More information about the U-Boot mailing list