summaryrefslogtreecommitdiff
path: root/misc.c
diff options
context:
space:
mode:
Diffstat (limited to 'misc.c')
-rw-r--r--misc.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/misc.c b/misc.c
index 4e82ff8..9b21209 100644
--- a/misc.c
+++ b/misc.c
@@ -77,3 +77,13 @@ static char const *indefinite_article(char const *s) {
return "a";
}
+#ifdef __GNUC__
+#define if_likely(x) if (__builtin_expect(x, 1))
+#define if_unlikely(x) if (__builtin_expect(x, 0))
+#else
+#define if_likely if
+#define if_unlikely if
+#endif
+
+#define check(x) do { if_unlikely (!x) return false; } while (0);
+