I understand the meaning of likely() and unlikely() in linux/compiler.h,
but I don't undertand the meaning of !! in the definition.
#define likely(x) __builtin_expect(!!(x), 1)
#define unlikely(x) __builtin_expect(!!(x), 0)
why not this?:
#define likely(x) __builtin_expect((x), 1)
#define unlikely(x) __builtin_expect((x), 0)
!!(x) ensures, the first argument to __builtin_expect is always 0 or 1
regardless of input.
Regards,
Mohan
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/