Hi, On Thu, Dec 6, 2012 at 3:20 PM, Shraddha Kamat <sh2008ka@gmail.com> wrote:
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 ?
The Operator ! is used to perform the Boolean operation NOT. For example: !(1) ---> Outputs to 0 (false). !(2.56565) ---> Outputs to 0 (false). !(2000000000) --------> Outputs to 0 (false). !(-123)---> Outputs to 0 (false). !(0)---------> Outputs to 1 (true). Similarly '!!' Performs twice NOT operation !!(1) ---> Outputs to 1 (true). !!(2.56565) ---> Outputs to 1 (true). !!(2000000000) --------> Outputs to 1 (true). !!(-123)---> Outputs to 1 (true). !!(0)---------> Outputs to 0 (false). Hope that clears your doubt. Regards, --Prabhakar Lad
-- Shraddha
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies