Hi, On Thu, Dec 6, 2012 at 3:20 PM, Shraddha Kamat <sh2008ka@xxxxxxxxx> 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@xxxxxxxxxxxxxxxxx > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies _______________________________________________ Kernelnewbies mailing list Kernelnewbies@xxxxxxxxxxxxxxxxx http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies