Re: page_launder() bug

Kai Henningsen
2001-05-08T18:20:29Z

vonbrand@inf.utfsm.cl (Horst von Brand) wrote on 07.05.01 in <200105071452.f47Eq2jn008611@pincoya.inf.utfsm.cl>:

> "David S. Miller" <davem@redhat.com> said:
> > Jonathan Morton writes:
> > > >- page_count(page) == (1 + !!page->buffers));
> > >
> > > Two inversions in a row?
> >
> > It is the most straightforward way to make a '1' or '0'
> > integer from the NULL state of a pointer.
>
> IMVHO, it is clearer to write:
>
> page_count(page) == 1 + (page->buffers != NULL)
>
> At least, the original poster wouldn't have wondered, and I wouldn't have
> had to think a bit to find out what it meant... If gcc generates worse code
> for this, it should be fixed.

Huh. IMO, that is significantly *less* readable. And incidentally I'd be
less certain that it actually does what you want - it is rather easy to
convince yourself that !! has to do the right thing.

MfG Kai