efivar/0001-util.h-add-unlikely-and-likely-macros.patch
Petr Šabata 974b936917 RHEL 9.0.0 Alpha bootstrap
The content of this branch was automatically imported from Fedora ELN
with the following as its source:
https://src.fedoraproject.org/rpms/efivar#9f54d8029387895b7b1389d9a9f9e0bf476a027f
2020-10-14 23:58:29 +02:00

34 lines
955 B
Diff

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