From feae6c58aaf710febdb160c1cfbb2e523bc10c1f Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Sun, 5 Oct 2025 14:04:30 +0000 Subject: [PATCH] util: Add macros for branch prediction Signed-off-by: Michael Tremer --- src/daemon/util.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/daemon/util.h b/src/daemon/util.h index bbe075b..86865e1 100644 --- a/src/daemon/util.h +++ b/src/daemon/util.h @@ -24,6 +24,10 @@ #include #include +// Macros to help the compiler with branch prediction +#define likely(x) __builtin_expect(!!(x), 1) +#define unlikely(x) __builtin_expect(!!(x), 0) + #ifndef HAVE_SECURE_GETENV # ifdef HAVE___SECURE_GETENV # define secure_getenv __secure_getenv -- 2.47.3