This is the mail archive of the
java-patches@sourceware.cygnus.com
mailing list for the Java project.
Re: Patch proposal: use __builtin_expect
- To: aph at pasanda dot cygnus dot co dot uk
- Subject: Re: Patch proposal: use __builtin_expect
- From: Anthony Green <green at cygnus dot com>
- Date: Sat, 22 Apr 2000 10:57:18 -0700
- CC: java-patches at sourceware dot cygnus dot com
- References: <20000422174946.23828.qmail@pasanda.cygnus.co.uk>
- Reply-to: green at cygnus dot com
Andrew wrote:
> Hmm. So __builtin_expect means that we expect the result *not* to be
> true; it actually means "expect false".
Not quite. You always provide the expected result. I always gave `0',
so it does mean expect false in those cases.
__builtin_expect (x, 5)
...means we expect x to be 5. It seems safest/easiest to just expect 0.
You can also do things like..
if (__builtin_expect (x, 0) == 5)
{
// Handle the unlikely case that x == 5.
}
AG
--
Anthony Green Red Hat
Sunnyvale, California