summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2020-08-24 07:59:18 -0400
committerMatthias Clasen <mclasen@redhat.com>2020-08-25 12:15:45 -0400
commit76699a4813a05fd89114a29965d2532adc1553b0 (patch)
tree9966ae387d33acc9ffbe9845f1f3015a88e2670d
parent835f9bbdbe7c023bce27f699c8906ace9b62a051 (diff)
downloadfontconfig-76699a4813a05fd89114a29965d2532adc1553b0.tar.gz
Add FC_LIKELY and FC_UNLIKELY macros
These wrap __builtin_expect where it exists.
-rw-r--r--src/fcint.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/fcint.h b/src/fcint.h
index 08a0cd6..fb173b5 100644
--- a/src/fcint.h
+++ b/src/fcint.h
@@ -58,6 +58,14 @@
#endif
#ifdef _WIN32
+#define FC_LIKELY(expr) (expr)
+#define FC_UNLIKELY(expr) (expr)
+#else
+#define FC_LIKELY(expr) (__builtin_expect (expr, 1))
+#define FC_UNLIKELY(expr) (__builtin_expect (expr, 0))
+#endif
+
+#ifdef _WIN32
# include "fcwindows.h"
typedef UINT (WINAPI *pfnGetSystemWindowsDirectory)(LPSTR, UINT);
typedef HRESULT (WINAPI *pfnSHGetFolderPathA)(HWND, int, HANDLE, DWORD, LPSTR);