Linux in General > Linux Development & Programming

What exactly compiler.h does?

(1/1)

jeeva:
#if __GNUC__ == 2 && __GNUC_MINOR__ < 96
#define __builtin_expect(x, expected_value) (x)
#endif
#define likely(x)       __builtin_expect((x),1)
#define unlikely(x)     __builtin_expect((x),0)
#endif /* __LINUX_COMPILER_H */

Can anyone tell me, what exactly the above code does?

like if i say for eg:

struct usb_device temp;

if( likely( temp ) )
       printk( "\nCondition: TRUE\n" );
else
       printk( "\nCondition: FALSE\n" );

What will be the out put and why?

Thank you,
Regards,
Jeeva

Navigation

[0] Message Index

Go to full version