aboutsummaryrefslogtreecommitdiff
path: root/src/common/compat.h
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2007-03-09 21:39:19 +0000
committerNick Mathewson <nickm@torproject.org>2007-03-09 21:39:19 +0000
commitd62e37b4a9200c35f44176b6e3fd159f9d7d1ea2 (patch)
treea6239faefd83d9a704d7412d689114b0f8c4e54e /src/common/compat.h
parentd26a587309d8174f1180758fe4630ea99250752c (diff)
downloadtor-d62e37b4a9200c35f44176b6e3fd159f9d7d1ea2.tar.gz
tor-d62e37b4a9200c35f44176b6e3fd159f9d7d1ea2.zip
r12473@Kushana: nickm | 2007-03-06 15:49:45 -0500
Excise PREDICT and PREDICT_FALSE in favor of PREDICT_LIKELY and PREDICT_UNLIKELY. svn:r9781
Diffstat (limited to 'src/common/compat.h')
-rw-r--r--src/common/compat.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/common/compat.h b/src/common/compat.h
index 07f194282f..a6c339ee73 100644
--- a/src/common/compat.h
+++ b/src/common/compat.h
@@ -98,15 +98,17 @@ extern INLINE double U64_TO_DBL(uint64_t x) {
#define ATTR_PURE __attribute__((pure))
#define ATTR_MALLOC __attribute__((malloc))
#define ATTR_NONNULL(x) __attribute__((nonnull x))
-#define PREDICT(exp, val) __builtin_expect((exp), (val))
-#define PREDICT_LIKELY(exp) PREDICT((exp), 1)
-#define PREDICT_UNLIKELY(exp) PREDICT((exp), 0)
+/** Macro: Evaluates to <b>exp</b> and hints the compiler that the value
+ * of <b>exp</b> will probably be true. */
+#define PREDICT_LIKELY(exp) __builtin_expect((exp), 1)
+/** Macro: Evaluates to <b>exp</b> and hints the compiler that the value
+ * of <b>exp</b> will probably be false. */
+#define PREDICT_UNLIKELY(exp) __builtin_expect((exp), 0)
#else
#define ATTR_NORETURN
#define ATTR_PURE
#define ATTR_MALLOC
#define ATTR_NONNULL(x)
-#define PREDICT(exp, val) (exp)
#define PREDICT_LIKELY(exp) (exp)
#define PREDICT_UNLIKELY(exp) (exp)
#endif