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