All of lore.kernel.org
 help / color / mirror / Atom feed
* Re Likely and Unlikely Macro
@ 2011-10-10  6:19 Asutosh Das
  2011-10-10  7:29 ` bob
  2011-10-10 15:52 ` Mulyadi Santosa
  0 siblings, 2 replies; 5+ messages in thread
From: Asutosh Das @ 2011-10-10  6:19 UTC (permalink / raw)
  To: kernelnewbies

Hi
In lxr, I saw the likely and unlikely macro defined as (compiler.h)

#  define likely(x)     (__builtin_constant_p(x) ? !!(x) :
__branch_check__(x, 1))
 116# endif
 117# ifndef unlikely
 118#  define unlikely(x)   (__builtin_constant_p(x) ? !!(x) :
__branch_check__(x, 0))
 119# endif
 120
..... some other defines

#else
 146# define likely(x)      __builtin_expect(!!(x), 1)
 147# define unlikely(x)    __builtin_expect(!!(x), 0)
 148#endif

I cannot understand the intention behind !!(x).
Please can you let me know why !!(x) is required here.

TIA
--
~/asd

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-10-12  4:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-10  6:19 Re Likely and Unlikely Macro Asutosh Das
2011-10-10  7:29 ` bob
2011-10-10 15:52 ` Mulyadi Santosa
2011-10-11  4:18   ` Asutosh Das
2011-10-12  4:36     ` pankaj singh

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.