Dec. 6, 2012
10:05 a.m.
Hi,
# define likely(x) __builtin_expect(!!(x), 1) # define unlikely(x) __builtin_expect(!!(x), 0)
I see these !! in the above expressions. Please explain me the meaning of those double exclamations. What is their significance ?
This is a kind of cast to a "bool". After applying !!(x), the value will be either 0 or 1. It's roughly equivalent to (((x) != 0) ? 1 : 0) Regards. -- Yann Droneaud OPTEYA