4.7.4. __builtin_expect

This intrinsic provides the compiler with branch prediction information. Calling __builtin_expect(expr, , c) informs the compiler that it is expected that expr == c.

Note

This builtin function is a GNU compiler extension that is supported by the ARM compiler.

Syntax

long __builtin_expect(long int expr, long int c)

Where:

expr

is an integral expression

c

is a compile-time constant.

Return value

__builtin_expect returns the value of expr.

Example

if (__builtin_expect(i, 0))
{
    foo();                   // we do not expect foo to be called,
}                            // because we expect i to be zero
Copyright © 2007, 2010 ARM Limited. All rights reserved.ARM DUI 0348A
Non-Confidential