summaryrefslogtreecommitdiff
path: root/base.h
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2022-12-05 19:05:14 -0500
committerpommicket <pommicket@gmail.com>2022-12-05 19:05:14 -0500
commit05862b802237df8bc61b0b45ef1ba4e70b0773f5 (patch)
tree2bfcd1a2915bd4907652f29453c92e40deaac3d0 /base.h
parent10c753107c6d9f9c90fef18b887b92c2290ca97d (diff)
full json parser
Diffstat (limited to 'base.h')
-rw-r--r--base.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/base.h b/base.h
index ee427fc..2af0820 100644
--- a/base.h
+++ b/base.h
@@ -115,6 +115,14 @@ typedef unsigned long long ullong;
#define arr_count(a) (sizeof (a) / sizeof *(a))
+
+// usage: if UNLIKELY (x > 2) ...
+#if __GNUC__
+#define UNLIKELY(x) (__builtin_expect(x,0))
+#else
+#define UNLIKELY(x) (x)
+#endif
+
#ifdef __GNUC__
#define no_warn_start _Pragma("GCC diagnostic push") \
_Pragma("GCC diagnostic ignored \"-Wpedantic\"") \