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

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