WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] code question?

Keir Fraser wrote:
On 11 Aug 2005, at 18:03, M.A. Williamson wrote:

I think that:
!!a & !b === (a != 0 ) && ( b == 0 )

It's just more efficient to do it directly using bitwise ops than to use the full logical operators (can gcc really not optimise this sort of thing???).

It can't optimise out short-circuit semantics.

Yes it can, if the second branch of the short-circuit is guaranteed to
terminate with no side effects when it has defined behaviour.

The function thread_jump in
<http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cfgcleanup.c?rev=1.140.2.7>
attempts to prove that a basic block satisfies this property, although I'm
not sure whether gcc is capable of doing the specific optimization we're
talking about here. I know that some other C compilers are.

--
David Hopwood <david.nospam.hopwood@xxxxxxxxxxxxxxxx>


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>