[PATCH 01/10] compiler.h: add statically_false()
David Laight
David.Laight at ACULAB.COM
Fri Dec 6 03:39:59 UTC 2024
From: Vincent Mailhol
> Sent: 05 December 2024 15:26
>
> On Thu. 5 Dec 2024 at 03:30, David Laight <David.Laight at aculab.com> wrote:
> > From: Vincent Mailhol
> > > Sent: 02 December 2024 17:33
> > >
> > > From: Vincent Mailhol <mailhol.vincent at wanadoo.fr>
> > >
> > > For completion, add statically_false() which is the equivalent of
> > > statically_true() except that it will return true only if the input is
> > > known to be false at compile time.
> >
> > This is pretty much pointless.
> > It is just as easy to invert the condition at the call site.
>
> To start with, I will argue that:
>
> statically_false(foo)
>
> is more pretty than
>
> statically_true(!(foo))
Except that the test is more likely to be:
statically_false(x > y)
and the invert is then
statically_true(x <= y)
No different from C itself, there is no 'ifnot (condition) {...}'
(don't talk to me about perl...)
I suspect you need to pretty much remove all the comments that
cross-refer to statically_true() from the other patches.
So is_const_true() is just 'return true if the expression
is a 'non-zero constant integer expression'.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
More information about the Intel-gfx
mailing list