Blame SOURCES/0001-util.h-add-unlikely-and-likely-macros.patch

b15ea1
From cb0b1c30103abc17dbbed14210bbc59a73802206 Mon Sep 17 00:00:00 2001
b15ea1
From: Peter Jones <pjones@redhat.com>
b15ea1
Date: Mon, 7 Jan 2019 10:30:23 -0500
b15ea1
Subject: [PATCH 01/86] util.h: add unlikely() and likely() macros
b15ea1
b15ea1
Signed-off-by: Peter Jones <pjones@redhat.com>
b15ea1
---
b15ea1
 src/util.h | 9 +++++++++
b15ea1
 1 file changed, 9 insertions(+)
b15ea1
b15ea1
diff --git a/src/util.h b/src/util.h
b15ea1
index f63a8907611..ba8fee35ae9 100644
b15ea1
--- a/src/util.h
b15ea1
+++ b/src/util.h
b15ea1
@@ -52,6 +52,15 @@
b15ea1
 #define PACKED __attribute__((__packed__))
b15ea1
 #define VERSION(sym, ver) __asm__(".symver " # sym "," # ver)
b15ea1
 
b15ea1
+#define __branch_check__(x, expect, is_constant) \
b15ea1
+	__builtin_expect(!!(x), expect)
b15ea1
+#ifndef likely
b15ea1
+#define likely(x) (__branch_check__(x, 1, __builtin_constant_p(x)))
b15ea1
+#endif
b15ea1
+#ifndef unlikely
b15ea1
+#define unlikely(x) (__branch_check__(x, 0, __builtin_constant_p(x)))
b15ea1
+#endif
b15ea1
+
b15ea1
 /*
b15ea1
  * I'm not actually sure when these appear, but they're present in the
b15ea1
  * version in front of me.
b15ea1
-- 
b15ea1
2.24.1
b15ea1