In the Linux,
You can see the below code
if ( likely(x == 0) )
{
// code ...
}
or
if ( unlikely(x == 1) )
{
// code ...
}
#define likely(x) __builtin_expect((x),1)
#define unlikely(x) __builtin_expect((x),0)
As I know, its another expression is "Branch Prediction".
It is supported gcc 2.96 or later version.
likely/unlikely macros in the Linux kernel
http://stackoverflow.com/questions/109710/likely-unlikely-macros-in-the-linux-kernel
Tuesday, August 16, 2011
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment