This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[cygnus.project.sid] branch probability hinting


Tom Tromey writes:
 > I've always thought the __builtin_expect code in libgcj was a bit
 > ugly.  I find it hard to read and understand.
 > 
 > I think we ought to adopt macros like the appended.

I think the macros should be used in parens:

   if UNLIKELY(error)

is non-idiomatic C.

   if (UNLIKELY(error))

is better IMO.  Otherwise this is a good idea; I've never liked the
builtin_expect syntax much.

Also please everyone note that the compiler already knows that

   if (p == NULL)

is unlikely, so let's not obfuscate our code unnecessarily.

Andrew.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]