{un}likely macros?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi there people,
first of all i would like to thank everybody for their help in figuring out 
the yesterday's asm oneliner. I have another q, though :)
The kernel extensively uses these macros. 

<from include/linux/compiler.h,45>
45 #define likely(x)       __builtin_expect(!!(x), 1)
46 #define unlikely(x)     __builtin_expect(!!(x), 0)

As far as I understand it, they evaluate to something only when the compiler's 
minor number is < 96:

<from include/linux/compiler-gcc2.h,11>
 11 #if __GNUC_MINOR__ < 96
 12 # define __builtin_expect(x, expected_value) (x)
 13 #endif

otherwise they evalute to nothing(?). However, what i don't understand is, 
what do i accomplish by negating a value twice (!!(x)). I read somewhere on 
the kernel mailing list that it had something to do with pointer conversion 
but the context of the message was rather different so i think that this 
might not hold true.

Thanks in advance,
Boris.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFA477XiBySr3Fn37QRAoV3AKC8zOWg8+3y41IDb/0D0bD9CLMOjwCeP88x
7uiOHxpxXJQ+J2fhfp3nOKQ=
=mEsu
-----END PGP SIGNATURE-----

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux