1 | //======================================================================== |
2 | // |
3 | // GooLikely.h |
4 | // |
5 | // This file is licensed under the GPLv2 or later |
6 | // |
7 | // Copyright (C) 2008 Kees Cook <kees@outflux.net> |
8 | // |
9 | //======================================================================== |
10 | |
11 | #ifndef GOOLIKELY_H |
12 | #define GOOLIKELY_H |
13 | |
14 | #if defined(__GNUC__) && (__GNUC__ > 2) && defined(__OPTIMIZE__) |
15 | # define likely(x) __builtin_expect((x), 1) |
16 | # define unlikely(x) __builtin_expect((x), 0) |
17 | #else |
18 | # define likely(x) (x) |
19 | # define unlikely(x) (x) |
20 | #endif |
21 | |
22 | #endif |
23 | |