From: Michael Tremer Date: Sun, 5 Oct 2025 14:04:30 +0000 (+0000) Subject: util: Add macros for branch prediction X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=feae6c58aaf710febdb160c1cfbb2e523bc10c1f;p=collecty.git util: Add macros for branch prediction Signed-off-by: Michael Tremer --- 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