[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=whaUtqsgLGk3a+1+SJ2+KGK+GK-WbSK0dX2JpVN3bs0hQ@mail.gmail.com>
Date: Sun, 17 Nov 2024 11:09:51 -0800
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: David Laight <David.Laight@...lab.com>
Cc: Vincent Mailhol <mailhol.vincent@...adoo.fr>, Yury Norov <yury.norov@...il.com>,
Rasmus Villemoes <linux@...musvillemoes.dk>, Luc Van Oostenryck <luc.vanoostenryck@...il.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-sparse@...r.kernel.org" <linux-sparse@...r.kernel.org>,
Rikard Falkeborn <rikard.falkeborn@...il.com>
Subject: Re: [PATCH v4 1/2] compiler.h: add const_true()
On Sun, 17 Nov 2024 at 11:05, David Laight <David.Laight@...lab.com> wrote:
>
> I think everything can be built on a base if_const_zero(x, if_z, if_nz)
> #define const_true(x) if_const_zero(!(x), 1, 0)
> #define is_constexpr(x) if_const_zero((x) * 0), 1, 0)
> which gives a bit more flexibility.
The is_constexpr() should probably be if_const_zero(0*!(x)),1,0) to be
ok with pointers and with "long long" constants.
And the "1,0" arguments should have a real reason for existing. I'm
not entirely convinced any other cases make much sense.
Linus
Powered by blists - more mailing lists