Re: likely/unlikely macro.

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

 



Shinpei Kato wrote:
Thank you for your reply.

So, for example, the expression "if (likely(prev != next))" is same as "if
((prev != next) == 1)", isn't it?
More correct would be next:
if (gcc support __builtin_expect) {
we do nothing and likely(prev!=next) => __builtin_expect((prev!=next),1)
then gcc use this information for optimization, this branch of code would be more otimized then alternatives.
} else {
likely(prev!=next) => (prev != next)
so we don't break compilation and don't do any optimization.
}
Then, unlikely is opposite of that.
yes
[snip]
		Best regards. Ruslan.

--
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