[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VcmW2StPqb_LtKFyNyJ2+jz3c19zNRDiSuGs06Bseq04w@mail.gmail.com>
Date: Wed, 14 Jun 2023 14:51:43 +0300
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Herve Codina <herve.codina@...tlin.com>
Cc: Liam Girdwood <lgirdwood@...il.com>,
Mark Brown <broonie@...nel.org>,
Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Conor Dooley <conor+dt@...nel.org>,
Jonathan Cameron <jic23@...nel.org>,
Lars-Peter Clausen <lars@...afoo.de>,
Jaroslav Kysela <perex@...ex.cz>,
Takashi Iwai <tiwai@...e.com>,
Kuninori Morimoto <kuninori.morimoto.gx@...esas.com>,
alsa-devel@...a-project.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-iio@...r.kernel.org,
Christophe Leroy <christophe.leroy@...roup.eu>,
Thomas Petazzoni <thomas.petazzoni@...tlin.com>
Subject: Re: [PATCH v4 07/13] minmax: Introduce {min,max}_array()
On Wed, Jun 14, 2023 at 12:42 PM Herve Codina <herve.codina@...tlin.com> wrote:
> On Wed, 14 Jun 2023 12:02:57 +0300
> Andy Shevchenko <andy.shevchenko@...il.com> wrote:
> > On Wed, Jun 14, 2023 at 10:49 AM Herve Codina <herve.codina@...tlin.com> wrote:
...
> > > + typeof(__array[0] + 0) __element = __array[--__len]; \
> >
> > Do we need the ' + 0' part?
>
> Yes.
>
> __array can be an array of const items and it is legitimate to get the
> minimum value from const items.
>
> typeof(__array[0]) keeps the const qualifier but we need to assign __element
> in the loop.
> One way to drop the const qualifier is to get the type from a rvalue computed
> from __array[0]. This rvalue has to have the exact same type with only the const
> dropped.
> '__array[0] + 0' was a perfect canditate.
Seems like this also deserves a comment. But if the series is accepted
as is, it may be done as a follow up.
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists