likely/unlikely macros

Title: likely/unlikely macros

#include

/* Unlikely : #define unlikely(x) __builtin_expect((x),0)
*
* if (__builtin_expect (x, 0))
* foo ();
*
*
* [This] would indicate that we do not expect to call `foo’, since we
* expect `x’ to be zero.
*/

int main(int argc, char **argv)
{
int x = 1;

if (__builtin_expect(x, 0)) {
printf(“Value of x was expected to be 0 but x is =%d\n”, x);
}
return 0;
}

READ  How to resolve : fatal error: curses.h: No such file or directory

Reference URL: http://kerneltrap.org/node/4705

Leave a Reply

Your email address will not be published. Required fields are marked *