diff options
author | Valentin Bartenev <vbart@nginx.com> | 2017-04-11 19:28:23 +0300 |
---|---|---|
committer | Valentin Bartenev <vbart@nginx.com> | 2017-04-11 19:28:23 +0300 |
commit | e0881fd85c55424025e64aa456b4bf8e18399e8b (patch) | |
tree | c7f7d28d522ebb6be446ee572c172d8ab56af1f9 /src/nxt_clang.h | |
parent | 60ae0314c076971e786e3c56a7514f081f4b16ee (diff) | |
download | unit-e0881fd85c55424025e64aa456b4bf8e18399e8b.tar.gz unit-e0881fd85c55424025e64aa456b4bf8e18399e8b.tar.bz2 |
The nxt_expect() macro.
Diffstat (limited to 'src/nxt_clang.h')
-rw-r--r-- | src/nxt_clang.h | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/nxt_clang.h b/src/nxt_clang.h index 0ed55b64..6cb752dd 100644 --- a/src/nxt_clang.h +++ b/src/nxt_clang.h @@ -31,17 +31,25 @@ nxt_pragma_loop_disable_vectorization #if (NXT_HAVE_BUILTIN_EXPECT) #define \ +nxt_expect(c, x) \ + __builtin_expect((long) (x), (c)) + +#define \ nxt_fast_path(x) \ - __builtin_expect((long) (x), 1) + nxt_expect(1, x) #define \ nxt_slow_path(x) \ - __builtin_expect((long) (x), 0) + nxt_expect(0, x) #else #define \ +nxt_expect(c, x) \ + (x) + +#define \ nxt_fast_path(x) \ (x) |