[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 4/4] bitmaps/bitops: Clarify tests for small constant size.



At 10:07 +0000 on 29 Nov (1385716068), Jan Beulich wrote:
> >>> On 28.11.13 at 17:37, Tim Deegan <tim@xxxxxxx> wrote:
> > No semantic changes, just makes the control flow a bit clearer.
> > 
> > I was looking at this bcause the (-!__builtin_constant_p(x) | x__)
> > formula is too clever for Coverity, but in fact it always takes me a
> > minute or two to understand it too. :)
> 
> I nevertheless like things like this...

Yes, it's a nice trick, but I think we're better off with the
readable code.

> Anyway - did you check the
> generated code is no worse with this change?

Yep, the generated code is identical.

> > -#define find_next_bit(addr, size, off) ({ \
> > -    unsigned int r__ = (size); \
> > -    unsigned int o__ = (off); \
> > -    switch ( -!__builtin_constant_p(size) | r__ ) \
> > -    { \
> > -    case 0: (void)(addr); break; \
> 
> This dummy evaluation of addr ...

Oops, yep.  I'll fix for v2.

Tim.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.