Linux Forums - Linux Help,Advice & support community:LinuxSolved.com

Linux in General => Linux Development & Programming => Topic started by: jeeva on October 03, 2004, 07:16:55 AM

Title: What exactly compiler.h does?
Post by: jeeva on October 03, 2004, 07:16:55 AM
#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