projects
/
platform
/
upstream
/
Vulkan-Tools.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
51d58df
)
icd: add likely()/unlikely()
author
Chia-I Wu
<olv@lunarg.com>
Tue, 17 Feb 2015 21:20:58 +0000
(14:20 -0700)
committer
Chia-I Wu
<olv@lunarg.com>
Wed, 18 Feb 2015 17:28:49 +0000
(10:28 -0700)
They will be expanded to __builtin_expect(...) on gcc.
icd/common/icd-utils.h
patch
|
blob
|
history
diff --git
a/icd/common/icd-utils.h
b/icd/common/icd-utils.h
index
c8eedea
..
5304d15
100644
(file)
--- a/
icd/common/icd-utils.h
+++ b/
icd/common/icd-utils.h
@@
-40,6
+40,14
@@
#define U_ASSERT_ONLY
#endif
+#if defined(__GNUC__)
+#define likely(x) __builtin_expect(!!(x), 1)
+#define unlikely(x) __builtin_expect(!!(x), 0)
+#else
+#define likely(x) (x)
+#define unlikely(x) (x)
+#endif
+
#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
#define u_popcount(u) __builtin_popcount(u)