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

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