On Tue, Apr 16, 2024 at 03:40:43PM +0100, Kieran Bingham wrote: > Quoting Kieran Bingham (2024-04-16 15:37:39) > > Quoting Andy Shevchenko (2024-04-16 14:34:45) > > > On Tue, Apr 16, 2024 at 12:25 PM Hans de Goede <hdegoede@xxxxxxxxxx> wrote: > > > > On 4/15/24 4:40 PM, Andy Shevchenko wrote: > > > > > On Mon, Apr 15, 2024 at 02:02:08PM +0200, Hans de Goede wrote: ... > > > > >> unsigned int hblank_cycles = 100, > > > > >> vblank_lines = 6, > > > > >> width, > > > > > > > > > > Urgh... These comma operators probably is subject to replace with separate > > > > > definitions or being grouped on a single line (as it suppose to be in this > > > > > case). > > > > > > > > That indeed is ugly, but fixing this is out of scope for this patch, > > > > so I've added an extra patch to the set to address this: > > > > > > > > https://git.kernel.org/pub/scm/linux/kernel/git/hansg/linux.git/commit/?h=media-atomisp&id=48d93af9d9b0fd40a21a656cb8cd8e25700bfed5 > > > > > > WFM, thanks! > > > > > > Btw (yes, I see you tagged that already, so just FYI then) > > > (1 + (stream->config.pixels_per_clock == 2)); > > > is an interesting way of using > > > > > > (stream->config.pixels_per_clock == 2) ? 2 : 1); > > > > > > which likely can produce slightly better code (due to use of constant > > > 2 twice), although it is a pure speculation by me. > > Ooops, I didn't mean to send that. Well I wrote something but then > closed it when I wasn't going to bother and instead some how sent an > empty mail .. > > So now I guess I should actually say what I wasn't going to end up > saying? haha. > > This was too intriguing (to me) so I threw it in godbolt, and for > various levels of compiler optimsations, both options generate the same > code, even with -O0. Of course the different optimsation levels produce > different code, but the two options above always match at the given > level. Thanks for playing with this. The issue with the original code is readability and potential oddity about boolean to integer conversion. That said, I prefer my variant for the sake of clarity. > Fun with godbolt ;-) > > https://godbolt.org/z/hYjrvK6hn -- With Best Regards, Andy Shevchenko