Не могу понять смысл данных макросов ( в <linux/compiler.h> ). Как я понял - это как-то позволяет генерировать "intelligent code". Об этом написано ниже. Если кто может, поясните, в чём преимущество. Из блога на kerneltrap.org (http://kerneltrap.org/node/4705): Ever wondered what the likely and unlikely macros in the linux kernel are ? The macros are defined as : #define likely(x) __builtin_expect((x),1) #define unlikely(x) __builtin_expect((x),0) The __builtin_expect is a method that gcc (versions >= 2.96) offer for programmers to indicate branch prediction information to the compiler. The return value of __builtin_expect is the first argument (which could only be an integer) passed to it. To check it out how it could be beneficial, an excerpt from "info gcc" : if (__builtin_expect (x, 0)) foo (); [This] would indicate that we do not expect to call `foo', since we expect `x' to be zero. Based on this information the compiler generates intelligent code, such that the most expected result is favored.

Ответ на:
комментарий
от alexru
Ответ на:
комментарий
от RomanU
Ответ на:
комментарий
от anonymous
Ответ на:
комментарий
от erDiZz
Ответ на:
комментарий
от anonymous
Вы не можете добавлять комментарии в эту тему: топик перемещен в архив.