]> git.kaiwu.me - njs.git/commitdiff
The nxt_expect() macro.
authorValentin Bartenev <vbart@nginx.com>
Mon, 19 Dec 2016 11:19:43 +0000 (14:19 +0300)
committerValentin Bartenev <vbart@nginx.com>
Mon, 19 Dec 2016 11:19:43 +0000 (14:19 +0300)
nxt/nxt_clang.h

index aeadb117264319657bc55252c03323bf3a49aed6..32737201340d4da10abff9d324470d1f8c613aa9 100644 (file)
 
 
 #if (NXT_HAVE_BUILTIN_EXPECT)
-#define nxt_fast_path(x)   __builtin_expect((long) (x), 1)
-#define nxt_slow_path(x)   __builtin_expect((long) (x), 0)
+#define nxt_expect(c, x)   __builtin_expect((long) (x), (c))
+#define nxt_fast_path(x)   nxt_expect(1, x)
+#define nxt_slow_path(x)   nxt_expect(0, x)
 
 #else
+#define nxt_expect(c, x)   (x)
 #define nxt_fast_path(x)   (x)
 #define nxt_slow_path(x)   (x)
 #endif